Changeset 7876 in orxonox.OLD for branches/gui/src
- Timestamp:
- May 26, 2006, 10:50:45 PM (19 years ago)
- Location:
- branches/gui/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/graphics/importer/material.h
r7788 r7876 51 51 void setTransparency (char* trans); 52 52 53 void getDiffuseColor(float& r, float& g, float& b) const { r = diffuse[0], g = diffuse[1], b = diffuse[2]; } 53 54 54 55 // MAPPING // -
branches/gui/src/lib/graphics/render2D/element_2d.cc
r7874 r7876 449 449 this->relCoordinate += shift; 450 450 this->bRelCoorChanged = true; 451 452 451 } 453 452 -
branches/gui/src/lib/gui/gl_gui/glgui.h
r7873 r7876 14 14 #include "glgui_colorselector.h" 15 15 #include "glgui_pushbutton.h" 16 #include "glgui_cursor.h" 16 17 17 18 namespace OrxGui -
branches/gui/src/lib/gui/gl_gui/glgui_cursor.cc
r7873 r7876 17 17 18 18 #include "glgui_cursor.h" 19 #include "color.h" 19 20 20 21 namespace OrxGui … … 28 29 this->init(); 29 30 31 this->subscribeEvent(ES_MENU, EV_MOUSE_MOTION); 32 33 30 34 } 31 35 32 36 33 37 /** 34 * standard deconstructor35 */38 * @brief standard deconstructor 39 */ 36 40 GLGuiCursor::~GLGuiCursor() 37 { 38 } 41 {} 42 43 float GLGuiCursor::_mouseSensitivity = 1.0; 44 39 45 40 46 /** 41 * initializes the GUI-element47 * @brief initializes the GUI-element 42 48 */ 43 49 void GLGuiCursor::init() … … 45 51 this->setClassID(CL_GLGUI_CURSOR, "GLGuiCursor"); 46 52 53 this->backMaterial().setDiffuse(1.0,0.0,0.0); 54 this->setSize2D(10, 20); 55 this->setAbsCoor2D(100, 100); 56 this->setLayer(E2D_LAYER_ABOVE_ALL); 57 58 } 59 60 void GLGuiCursor::tick(float dt) 61 { 62 Vector color; 63 this->backMaterial().getDiffuseColor(color.x, color.y, color.z); 64 color = Color::HSVtoRGB(Color::RGBtoHSV(color)+Vector(80.0*dt,0.0,.0)); 65 this->backMaterial().setDiffuse(color.x, color.y, color.z); 66 67 if (this->movement != Vector2D()) 68 { 69 /* if (this->getAbsCoor2D().x < 0.0 ) 70 movement.x = -this->getAbsCoor2D().x; 71 if (this->getAbsCoor2D().x > 200.0) 72 movement.x = (200.0-this->getAbsCoor2D().x); 73 if (this->getAbsCoor2D().y < 0.0 ) 74 movement.x = -this->getAbsCoor2D().y; 75 if (this->getAbsCoor2D().y > 200.0) 76 movement.x = (200.0-this->getAbsCoor2D().y);*/ 77 78 79 80 //this->shiftCoor2D(movement); 81 this->setAbsCoor2D(newPos); 82 movement = Vector2D(); 83 } 47 84 } 48 85 49 86 /** 50 * draws the GLGuiCursor87 * @brief draws the GLGuiCursor 51 88 */ 52 void GLGuiCursor::draw() 89 void GLGuiCursor::draw() const 53 90 { 91 this->startDraw(); 92 GLGuiWidget::draw(); 93 this->endDraw(); 94 } 95 96 void GLGuiCursor::process(const Event& event) 97 { 98 switch (event.type) 99 { 100 case EV_MOUSE_MOTION: 101 newPos = Vector2D(event.x, event.y); 102 movement += Vector2D(event.xRel * _mouseSensitivity, event.yRel * _mouseSensitivity); 103 break; 104 105 } 54 106 } 55 107 } -
branches/gui/src/lib/gui/gl_gui/glgui_cursor.h
r7873 r7876 10 10 #include "glgui_widget.h" 11 11 #include "event_listener.h" 12 #include "vector2D.h" 12 13 13 14 namespace OrxGui … … 26 27 virtual ~GLGuiCursor(); 27 28 29 static void setMouseSensitivity(float mouseSensitivity); 30 static float mouseSensitivity() { return GLGuiCursor::_mouseSensitivity; }; 31 28 32 void init(); 33 const Vector2D& position() const { return Element2D::getAbsCoor2D(); } 29 34 30 virtual void draw();31 35 36 virtual void tick(float dt); 37 virtual void draw() const; 38 virtual void process(const Event& event); 32 39 private: 40 41 Vector2D newPos; 42 Vector2D movement; 43 44 static float _mouseSensitivity; 33 45 34 46 }; -
branches/gui/src/lib/gui/gl_gui/glgui_widget.cc
r7855 r7876 52 52 this->clickable = true; 53 53 this->setVisibility(GLGUI_WIDGET_DEFAULT_VISIBLE); 54 // this->setParent2D((Element2D*)NULL);55 54 56 55 this->backMat.setDiffuse(1.0, 1.0, 1.0); -
branches/gui/src/lib/math/vector2D.h
r6616 r7876 40 40 41 41 /** @param v: the Vecor to compare with this one @returns true, if the Vecors are the same, false otherwise */ 42 inline bool operator== (const Vector2D& v) const { return (this->x==v.x && this->y==v.y)?true:false; }; 42 inline bool operator== (const Vector2D& v) const { return (this->x==v.x && this->y==v.y); }; 43 /** @param v: the Vector to negative-compare with this one @returns true if the two vectors are different */ 44 inline bool operator!= (const Vector2D& v) const { return (this->x!=v.x && this->y!=v.y); }; 43 45 /** @param index The index of the "array" @returns the x/y coordinate */ 44 46 inline float operator[] (float index) const { return ( index == 0)? this->x : this->y; } -
branches/gui/src/story_entities/simple_game_menu.cc
r7873 r7876 66 66 pb->show(); 67 67 pb->setAbsCoor2D(50, 50); 68 69 OrxGui::GLGuiCursor* cursor = new OrxGui::GLGuiCursor(); 70 cursor->show(); 68 71 69 72 if (root != NULL)
Note: See TracChangeset
for help on using the changeset viewer.