- Timestamp:
- May 28, 2006, 3:48:13 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 47 edited
- 7 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/defs/class_id.h
r7836 r7919 325 325 CL_GLGUI_CHECKBUTTON = 0x00000b04, 326 326 CL_GLGUI_RADIOBUTTON = 0x00000b05, 327 CL_GLGUI_SLIDER = 0x00000b06, 328 CL_GLGUI_PROGRESSBAR = 0x00000b07, 327 329 CL_GLGUI_CONTAINER = 0x00b04000, 328 CL_GLGUI_BOX = 0x00000b 07,329 CL_GLGUI_FRAME = 0x00000b 08,330 CL_GLGUI_WINDOW = 0x00000b 09,330 CL_GLGUI_BOX = 0x00000b17, 331 CL_GLGUI_FRAME = 0x00000b18, 332 CL_GLGUI_WINDOW = 0x00000b19, 331 333 CL_GLMENU_IMAGE_SCREEN = 0x00000b20, 332 334 CL_GLGUI_BAR = 0x00000b30, 335 CL_GLGUI_CURSOR = 0x00000b50, 336 CL_GLGUI_INPUTLINE = 0x00000b60, 337 CL_GLGUI_TEXTFIELD = 0x00000b61, 333 338 334 339 // QT_GUI -
trunk/src/lib/Makefile.am
r7819 r7919 28 28 util/file.cc \ 29 29 util/directory.cc \ 30 util/timer.cc \ 30 31 \ 31 32 data/data_tank.cc … … 49 50 util/file.h \ 50 51 util/directory.h \ 52 util/timer.h \ 51 53 \ 52 54 util/loading/resource_manager.h \ -
trunk/src/lib/event/event_def.h
r7868 r7919 28 28 EV_JOY_BUTTON, 29 29 30 EV_WINDOW_FOCUS, 30 31 EV_VIDEO_RESIZE, 31 32 33 EV_LEAVE_STATE, 32 34 EV_MAIN_QUIT, 33 35 -
trunk/src/lib/event/event_handler.cc
r7868 r7919 29 29 30 30 /** 31 * standard constructor32 */31 * @brief standard constructor 32 */ 33 33 EventHandler::EventHandler () 34 34 { … … 42 42 43 43 /* now initialize them all to zero */ 44 this->withUNICODE(false); 44 for (unsigned int i = 0; i < ES_NUMBER; i++) 45 this->bUNICODE[i] = false; 45 46 this->grabEvents(false); 46 47 … … 51 52 52 53 /** 53 * the singleton reference to this class54 * @brief the singleton reference to this class 54 55 */ 55 56 EventHandler* EventHandler::singletonRef = NULL; … … 57 58 58 59 /** 59 * standard deconstructor 60 61 */ 60 * @brief standard deconstructor 61 */ 62 62 EventHandler::~EventHandler () 63 63 { … … 79 79 80 80 /** 81 * initializes the event handler81 * @brief initializes the event handler 82 82 * 83 83 * this has to be called before the use of the event handler … … 89 89 90 90 /** 91 * pushes the current State in the State-stack, and selects state 91 * @param state: to which the event handler shall change 92 */ 93 void EventHandler::setState(elState state) 94 { 95 if (state == this->state) 96 return; 97 98 /// When Changing the State, all the keys will be released. 99 /// This is done by sending each eventListener, that still 100 /// has an Event subscribed, a Release Event. 101 int keyCount; 102 Uint8 * pressedKeys = SDL_GetKeyState(&keyCount); 103 for (unsigned int i = 0; i < SDLK_LAST; i++) 104 { 105 if (pressedKeys[i]) 106 { 107 Event ev; 108 ev.bPressed = false; 109 ev.type = i; 110 if (unlikely(this->bUNICODE[this->state])) 111 ev.x = i; 112 this->dispachEvent(this->state, ev ); 113 } 114 } 115 116 // switching to the new State. 117 elState oldState = this->state; 118 this->state = state; 119 120 // in the End the Corresponding handler will be notified. 121 Event stateSwitchEvent; 122 stateSwitchEvent.type = EV_LEAVE_STATE; 123 this->dispachEvent(oldState, stateSwitchEvent); 124 125 SDL_EnableUNICODE(this->bUNICODE[state]); 126 }; 127 128 129 /** 130 * @brief pushes the current State in the State-stack, and selects state 92 131 * @param state the new State to set 93 132 */ … … 106 145 107 146 /** 108 * this removes the topmost stack-entry and select the underlying one147 * @brief this removes the topmost stack-entry and select the underlying one 109 148 * @returns the next stack-entry 110 149 */ … … 144 183 { 145 184 for(unsigned int i = 0; i < ES_NUMBER; i++) 146 { 147 if( !likely(this->listeners[i][eventType].empty())) 185 if (!this->findListener( NULL, (elState)i, eventType, el)) 186 this->listeners[i][eventType].push_back(el); 187 else 148 188 { 149 PRINTF(2)(" '%s' of class '%s' tried to subscribe to event %i @ state %i but this event has already been subscribed\n", el->getName(), el->getClassName(), eventType, state);189 PRINTF(2)("%s::%s was already subscribed to state %d event %d\n", el->getClassName(), el->getName(), i, eventType); 150 190 } 151 this->listeners[i][eventType].push_back(el); 152 } 153 } 154 else 155 { 156 if( likely(!this->listeners[state][eventType].empty())) 157 { 158 PRINTF(2)("%s of class %s tried to subscribe to event %i @ state %i but this event has already been subscribed\n", el->getName(), el->getClassName(), eventType, state); 159 } 160 this->listeners[state][eventType].push_back(el); 191 } 192 else 193 { 194 if (!this->findListener( NULL, state, eventType, el)) 195 this->listeners[state][eventType].push_back(el); 196 else 197 { 198 PRINTF(2)("%s::%s was already subscribed to state %d event %d\n", el->getClassName(), el->getName(), state, eventType); 199 } 161 200 } 162 201 } … … 167 206 * @param state: the stat in which it has been subscribed 168 207 * @param eventType: the event, that shall be unsubscribed 169 170 171 172 */208 * 209 * if you want to unsubscribe an event listener from all subscribed events, just use the 210 * unsubscribe(EventListener* el, elState state) function 211 */ 173 212 void EventHandler::unsubscribe(EventListener* el, elState state, int eventType) 174 213 { … … 177 216 for (unsigned int i = 0; i < ES_NUMBER; i++) 178 217 { 179 std::vector<EventListener*>::iterator listener = 180 std::find(this->listeners[i][eventType].begin(), 181 this->listeners[i][eventType].end(), 182 el); 183 if (listener != this->listeners[i][eventType].end()) 218 std::vector<EventListener*>::iterator listener; 219 if (this->findListener(&listener, (elState)i, eventType, el)) 184 220 this->listeners[i][eventType].erase(listener); 185 221 } 186 222 else 187 223 { 188 std::vector<EventListener*>::iterator listener = 189 std::find(this->listeners[state][eventType].begin(), 190 this->listeners[state][eventType].end(), 191 el); 192 if (listener != this->listeners[state][eventType].end()) 224 std::vector<EventListener*>::iterator listener; 225 if (this->findListener(&listener, state, eventType, el)) 193 226 this->listeners[state][eventType].erase(listener); 194 227 } … … 203 236 void EventHandler::unsubscribe(EventListener* el, elState state) 204 237 { 205 if( el == NULL || state >= ES_NUMBER) 206 return; 238 assert( el != NULL && state < ES_NUMBER); 207 239 if( state == ES_ALL) 208 240 { … … 228 260 } 229 261 262 /** 263 * @brief returns true if at state and eventType there is something subscribed. 264 * @param state the state to check in. 265 * @param eventType the eventtype to check. 266 * @returns true if a event is subscibed. 267 */ 230 268 bool EventHandler::isSubscribed(elState state, int eventType) 231 269 { … … 236 274 237 275 /** 238 * flush all registered events276 * @brief flush all registered events 239 277 * @param state: a specific state 240 278 */ … … 261 299 262 300 263 void EventHandler::withUNICODE(bool enableUNICODE) 264 { 265 SDL_EnableUNICODE(enableUNICODE); 266 this->bUNICODE = enableUNICODE; 267 } 268 301 bool EventHandler::findListener(std::vector<EventListener*>::iterator* it, elState state, int eventType, EventListener* listener) 302 { 303 std::vector<EventListener*>::iterator findIterator = 304 std::find(this->listeners[state][eventType].begin(), this->listeners[state][eventType].end(), listener); 305 if (it != NULL) 306 *it = findIterator; 307 return ( findIterator != this->listeners[state][eventType].end()); 308 309 } 310 311 312 313 /** 314 * @brief if the unicode characters should be recorded. 315 * @param state the State in whitch to set the new Value. 316 * @param enableUNICODE: enabled, or disabled. 317 */ 318 void EventHandler::withUNICODE(elState state, bool enableUNICODE) 319 { 320 this->bUNICODE[state] = enableUNICODE; 321 if (this->state == state) 322 SDL_EnableUNICODE(enableUNICODE); 323 } 324 325 /** 326 * @brief grabs InputEvents. 327 * @param grabEvents if the Events should be grabbed(true) or released(false) 328 */ 269 329 void EventHandler::grabEvents(bool grabEvents) 270 330 { … … 282 342 } 283 343 284 /** 285 * core function of event handler: receives all events from SDL 286 287 The event from the SDL framework are collected here and distributed to all listeners. 288 */ 289 void EventHandler::process() 344 345 346 /** 347 * @brief core function of event handler: receives all events from SDL 348 * 349 * The event from the SDL framework are collected here and distributed to all listeners. 350 */ 351 void EventHandler::process() const 290 352 { 291 353 SDL_Event event; … … 299 361 ev.bPressed = true; 300 362 ev.type = event.key.keysym.sym; 301 if (unlikely(this->bUNICODE ))363 if (unlikely(this->bUNICODE[this->state])) 302 364 ev.x = event.key.keysym.unicode; 303 365 break; … … 305 367 ev.bPressed = false; 306 368 ev.type = event.key.keysym.sym; 307 if (unlikely(this->bUNICODE ))369 if (unlikely(this->bUNICODE[this->state])) 308 370 ev.x = event.key.keysym.unicode; 309 371 break; … … 344 406 ev.type = EV_JOY_BUTTON; 345 407 break; 408 case SDL_ACTIVEEVENT: 409 ev.type = EV_WINDOW_FOCUS; 410 ev.bPressed = (event.active.gain != 0); 411 break; 346 412 case SDL_VIDEORESIZE: 347 413 ev.resize = event.resize; … … 355 421 break; 356 422 } 357 358 /* small debug routine: shows all events dispatched by the event handler */ 359 PRINT(4)("\n==========================| EventHandler::process () |===\n"); 360 PRINT(4)("= Got Event nr %i, for state %i", ev.type, this->state); 361 362 363 for (unsigned int i = 0; i < this->listeners[this->state][ev.type].size(); i++) 364 { 365 PRINT(4)("= Event dispatcher msg: This event has been consumed\n"); 366 PRINT(4)("=======================================================\n"); 367 listeners[this->state][ev.type][i]->process(ev); 368 } 369 /* else 370 { 371 PRINT(4)("= Event dispatcher msg: This event has NOT been consumed\n"); 372 PRINT(4)("=======================================================\n"); 373 }*/ 374 } 375 } 376 377 423 this->dispachEvent(this->state, ev); 424 } 425 } 426 427 428 /** 429 * @brief dispaches an Event. 430 * @param event the Event to dispach. 431 */ 432 void EventHandler::dispachEvent(elState state, const Event& event) const 433 { 434 /* small debug routine: shows all events dispatched by the event handler */ 435 PRINT(4)("\n==========================| EventHandler::process () |===\n"); 436 PRINT(4)("= Got Event nr %i, for state %i\n", event.type, state); 437 438 /// setting a temporary state in case of an EventListener's process changes the state. 439 for (unsigned int i = 0; i < this->listeners[state][event.type].size(); i++) 440 { 441 PRINT(4)("= Event dispatcher msg: This event has been consumed\n"); 442 PRINT(4)("= Got Event nr %i, for state %i (%d registered) to %s::%s(%p)\n", event.type, i, state, this->listeners[state][event.type][i]->getClassName(), this->listeners[state][event.type][i]->getName(), this->listeners[state][event.type][i]); 443 PRINT(4)("=======================================================\n"); 444 this->listeners[state][event.type][i]->process(event); 445 } 446 /* else 447 { 448 PRINT(4)("= Event dispatcher msg: This event has NOT been consumed\n"); 449 PRINT(4)("=======================================================\n"); 450 }*/ 451 } 452 453 454 455 /** 456 * @brief An eventFilter. 457 * @param event the Event to be filtered. 458 * @returns 0 on filtered Event. 1 Otherwise. 459 */ 378 460 int EventHandler::eventFilter(const SDL_Event *event) 379 461 { … … 400 482 401 483 /** 402 * outputs some nice information about the EventHandler484 * @brief outputs some nice information about the EventHandler 403 485 */ 404 486 void EventHandler::debug() const … … 408 490 PRINT(0)("===============================\n"); 409 491 for(int i = 0; i < ES_NUMBER; ++i) 492 { 410 493 for(int j = 0; j < EV_NUMBER; ++j) 411 494 for (unsigned int evl = 0; evl < this->listeners[i][j].size(); evl++) 412 495 PRINT(0)("Event %d of State %d subscribed to %s (%p)\n", j, i, this->listeners[i][j][evl]->getName(), this->listeners[i][j][evl]); 496 } 413 497 PRINT(0)("============================EH=\n"); 414 498 } -
trunk/src/lib/event/event_handler.h
r7868 r7919 11 11 #include "key_mapper.h" 12 12 #include "event_def.h" 13 #include "event.h" 13 14 #include <stack> 14 15 #include <vector> … … 26 27 void init(); 27 28 28 /** @param state: to which the event handler shall change */ 29 inline void setState(elState state) { this->state = state; }; 29 void setState(elState state); 30 30 /** @returns the current state */ 31 31 inline elState getState() const { return this->state; }; … … 42 42 43 43 44 void withUNICODE( bool enableUNICODE);44 void withUNICODE(elState state, bool enableUNICODE); 45 45 void grabEvents(bool grabEvents); 46 46 bool grabbedEvents() const { return this->eventsGrabbed; }; 47 47 48 void process(); 48 void process() const; 49 void dispachEvent(elState state, const Event& event) const; 49 50 50 51 static int eventFilter(const SDL_Event *event); … … 53 54 private: 54 55 EventHandler(); 56 57 bool findListener(std::vector<EventListener*>::iterator* it, elState state, int eventType, EventListener* listener); 55 58 56 59 private: … … 62 65 KeyMapper keyMapper; //!< reference to the key mapper. 63 66 64 bool bUNICODE ;//!< If unicode should be enabled.67 bool bUNICODE[ES_NUMBER]; //!< If unicode should be enabled. 65 68 bool eventsGrabbed; //!< If the events should be grabbed 66 69 }; -
trunk/src/lib/graphics/graphics_engine.cc
r7871 r7919 286 286 SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 16); //Use at least 16 bits for the depth buffer 287 287 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); //Enable double buffering 288 289 glEnable(GL_CULL_FACE); 290 glCullFace(GL_FRONT); 288 291 } 289 292 … … 576 579 void GraphicsEngine::drawBackgroundElements() const 577 580 { 581 GraphicsEngine::storeMatrices(); 582 578 583 Render2D::getInstance()->draw(E2D_LAYER_BELOW_ALL, E2D_LAYER_BELOW_ALL); 579 584 } -
trunk/src/lib/graphics/importer/material.cc
r7848 r7919 108 108 return true; 109 109 110 111 // setting diffuse color 110 if (likely(Material::selectedMaterial != NULL)) 111 { 112 for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i) 113 { 114 glActiveTexture(Material::glTextureArbs[i]); 115 //glBindTexture(GL_TEXTURE_2D, 0); 116 glDisable(GL_TEXTURE_2D); 117 } 118 } 119 120 // setting diffuse color 112 121 glColor4f (diffuse[0], diffuse[1], diffuse[2], this->transparency); 113 122 // setting ambient color … … 118 127 glMaterialf(GL_FRONT, GL_SHININESS, this->shininess); 119 128 120 121 129 // setting the transparency 122 130 if (this->transparency < 1.0 || /* This allows alpha blending of 2D textures with the scene */ … … 138 146 glShadeModel(GL_SMOOTH); 139 147 140 if (likely(Material::selectedMaterial != NULL))141 {142 for(unsigned int i = 0; i < Material::selectedMaterial->textures.size(); ++i)143 {144 glActiveTexture(Material::glTextureArbs[i]);145 glBindTexture(GL_TEXTURE_2D, 0);146 glDisable(GL_TEXTURE_2D);147 }148 }149 148 150 149 for(unsigned int i = 0; i < this->textures.size(); ++i) … … 159 158 } 160 159 Material::selectedMaterial = this; 161 162 /* if (this->diffuseTexture != NULL)163 {164 glEnable(GL_TEXTURE_2D);165 glBindTexture(GL_TEXTURE_2D, this->diffuseTexture->getTexture());166 }167 else168 {169 glDisable(GL_TEXTURE_2D);170 glBindTexture(GL_TEXTURE_2D, 0);171 }*/172 160 } 173 161 -
trunk/src/lib/graphics/importer/material.h
r7788 r7919 16 16 17 17 #include <vector> 18 #include "SDL_image.h"19 20 18 #include "texture.h" 21 19 … … 51 49 void setTransparency (char* trans); 52 50 51 void getDiffuseColor(float& r, float& g, float& b) const { r = diffuse[0], g = diffuse[1], b = diffuse[2]; } 53 52 54 53 // MAPPING // -
trunk/src/lib/graphics/render2D/element_2d.cc
r7871 r7919 62 62 this->toCoordinate = NULL; 63 63 this->toDirection = NULL; 64 65 this->size = Vector2D(0,0); 64 66 this->toSize = NULL; 65 this->setSize2D(1, 1);66 67 67 68 … … 448 449 this->relCoordinate += shift; 449 450 this->bRelCoorChanged = true; 450 451 451 } 452 452 … … 847 847 if (unlikely(this->toSize != NULL)) 848 848 { 849 Vector2D shiftSize = (*this->toSize - Vector2D(this->sizeX, this->sizeY)) *fabsf(dt)*bias;849 Vector2D shiftSize = (*this->toSize - this->size) *fabsf(dt)*bias; 850 850 if (likely((shiftSize).len() >= .001))//PNODE_ITERATION_DELTA)) 851 851 { 852 this->sizeX += shiftSize.x; 853 this->sizeY += shiftSize.y; 852 this->size += shiftSize; 854 853 } 855 854 else … … 1109 1108 if (level == 0) 1110 1109 glPopAttrib(); 1111 1112 1110 } 1113 1111 -
trunk/src/lib/graphics/render2D/element_2d.h
r7843 r7919 125 125 inline const PNode* getBindNode() const { return this->bindNode; }; 126 126 127 inline void setSize2D(float x, float y) { this->sizeX = x, this->sizeY = y; }; 127 inline void setSize2D(float x, float y) { this->size = Vector2D(x, y); }; 128 inline void setSize2D(const Vector2D& size) { this->size = size; }; 129 inline const Vector2D& getSize2D() const { return this->size; }; 128 130 void setSizeSoft2D(float x, float y, float bias = 1.0); 129 inline void setSizeX2D(float x) { this->size X= x; };130 inline void setSizeY2D(float y) { this->size Y= y; };131 inline float getSizeX2D() const { return this->size X; };132 inline float getSizeY2D() const { return this->size Y; };131 inline void setSizeX2D(float x) { this->size.x = x; }; 132 inline void setSizeY2D(float y) { this->size.y = y; }; 133 inline float getSizeX2D() const { return this->size.x; }; 134 inline float getSizeY2D() const { return this->size.y; }; 133 135 134 136 public: … … 238 240 private: 239 241 const PNode* bindNode; //!< a node over which to display this 2D-element 240 float sizeX; //!< The size of the rendered item in x-direction 241 float sizeY; //!< The size of the rendered Item in y-direction 242 Vector2D size; //!< The size of the rendered item 242 243 Vector2D* toSize; //!< The Size to iterate to. 243 244 -
trunk/src/lib/graphics/text_engine/multi_line_text.cc
r7758 r7919 64 64 return; 65 65 glPushMatrix(); 66 glPushAttrib(GL_ENABLE_BIT); 66 67 // transform for alignment. 67 68 // TODO make the Stuff with the alignment … … 117 118 } 118 119 glEnd(); 120 glPopAttrib(); 119 121 glPopMatrix(); 120 122 } -
trunk/src/lib/graphics/text_engine/text.cc
r7753 r7919 36 36 this->font = NULL; 37 37 this->size = textSize; 38 this->setSizeY2D(size); 38 39 this->blending = TEXT_DEFAULT_BLENDING; 39 40 this->color = TEXT_DEFAULT_COLOR; … … 127 128 128 129 /** 130 * @brief appends one Character to the String. 131 */ 132 void Text::appendCharacter(char character) 133 { 134 this->text += character; 135 this->setupTextWidth(); 136 } 137 138 139 /** 129 140 * @brief append some text to the already existing Text. 130 141 * @param appendText The text to append to this Text. … … 135 146 return this->text; 136 147 } 148 149 /** 150 * @brief removes char characters from the Text. 151 * 152 * @note this function checks, if the count can be removed, and if so does it. 153 * Otherwise the maximum count of characters will be removed. 154 */ 155 void Text::removeCharacters(unsigned int chars) 156 { 157 if (text.size() > chars) 158 this->text.resize(this->text.size()-chars); 159 else if (!text.empty()) 160 text.clear(); 161 this->setupTextWidth(); 162 } 163 137 164 138 165 /** … … 188 215 return; 189 216 glPushMatrix(); 217 glPushAttrib(GL_ENABLE_BIT); 190 218 // transform for alignment. 191 219 if (this->getAlignment() == TEXT_ALIGN_RIGHT) … … 229 257 } 230 258 glEnd(); 259 glPopAttrib(); 231 260 glPopMatrix(); 232 261 } … … 242 271 if(this->font->getGlyphArray()[this->text[i]] != NULL) 243 272 width += this->font->getGlyphArray()[this->text[i]]->advance; 244 this->setSizeX2D(width * this->getSize());273 this->setSizeX2D(width * this->getSize()); 245 274 } 246 275 -
trunk/src/lib/graphics/text_engine/text.h
r7753 r7919 37 37 void setText(const std::string& text); 38 38 void append(const std::string& appendText); 39 void appendCharacter(char character); 39 40 const std::string& operator<<(const std::string& appendText); 41 void removeCharacters(unsigned int chars); 40 42 41 43 /// SETUP -
trunk/src/lib/gui/gl_gui/Makefile.am
r7855 r7919 9 9 10 10 11 libORXglgui_a_SOURCES = glmenu/glmenu_imagescreen.cc \ 12 glgui_handler.cc \ 13 signal_connector.cc \ 14 glgui_mainwidget.cc \ 15 glgui_widget.cc \ 16 glgui_button.cc \ 17 glgui_pushbutton.cc \ 18 glgui_container.cc \ 19 glgui_bar.cc \ 20 glgui_box.cc \ 21 glgui_frame.cc \ 22 glgui_window.cc 11 libORXglgui_a_SOURCES = \ 12 glmenu/glmenu_imagescreen.cc \ 13 glgui_handler.cc \ 14 signal_connector.cc \ 15 glgui_mainwidget.cc \ 16 glgui_widget.cc \ 17 glgui_button.cc \ 18 glgui_pushbutton.cc \ 19 glgui_checkbutton.cc \ 20 glgui_slider.cc \ 21 glgui_container.cc \ 22 glgui_bar.cc \ 23 glgui_box.cc \ 24 glgui_frame.cc \ 25 glgui_inputline.cc \ 26 glgui_textfield.cc \ 27 glgui_window.cc \ 28 glgui_cursor.cc 23 29 24 30 25 noinst_HEADERS= glmenu/glmenu_imagescreen.h \ 31 noinst_HEADERS= \ 32 glmenu/glmenu_imagescreen.h \ 26 33 signal_connector.h \ 27 34 glgui.h \ 35 glgui_defs.h \ 28 36 glgui_handler.h \ 29 37 glgui_mainwidget.h \ … … 31 39 glgui_button.h \ 32 40 glgui_pushbutton.h \ 41 glgui_checkbutton.h \ 42 glgui_slider.h \ 33 43 glgui_container.h \ 34 44 glgui_bar.h \ 35 45 glgui_box.h \ 36 46 glgui_frame.h \ 37 glgui_window.h 47 glgui_inputline.h \ 48 glgui_textfield.h \ 49 glgui_window.h \ 50 glgui_cursor.h 38 51 39 52 -
trunk/src/lib/gui/gl_gui/glgui.h
r7855 r7919 6 6 #ifndef _GLGUI_H 7 7 #define _GLGUI_H 8 9 #include "glgui_handler.h" 10 8 11 #include "glgui_widget.h" 9 12 … … 12 15 #include "glgui_button.h" 13 16 #include "glgui_checkbutton.h" 14 #include "glgui_colorselector.h" 15 16 namespace OrxGui 17 { 17 //#include "glgui_colorselector.h" 18 #include "glgui_pushbutton.h" 19 #include "glgui_cursor.h" 20 #include "glgui_inputline.h" 21 #include "glgui_textfield.h" 18 22 19 23 20 }; 21 22 23 24 25 26 #endif _GLGUI_H 24 #endif /* _GLGUI_H */ -
trunk/src/lib/gui/gl_gui/glgui_bar.cc
r7779 r7919 46 46 this->setClassID(CL_GLGUI_BAR, "GLGuiBar"); 47 47 48 this->frontMat .setDiffuse(1,1,1);48 this->frontMaterial().setDiffuse(1,1,1); 49 49 50 50 this->setSize2D(50, 10); … … 64 64 GLGuiWidget::draw(); 65 65 66 this->frontMat .select();66 this->frontMaterial().select(); 67 67 glBegin(GL_QUADS); 68 68 -
trunk/src/lib/gui/gl_gui/glgui_button.cc
r7779 r7919 26 26 * standard constructor 27 27 */ 28 GLGuiButton::GLGuiButton ( )28 GLGuiButton::GLGuiButton (const std::string& label) 29 29 { 30 30 this->init(); 31 31 32 this->label.setText( label ); 32 33 } 33 34 … … 45 46 46 47 /** 47 * initializes the GUI-element48 * @brief initializes the GUI-element 48 49 */ 49 50 void GLGuiButton::init() 50 51 { 51 52 this->setClassID(CL_GLGUI_BUTTON, "GLGuiButton"); 53 this->setFocusable(true); 54 this->setClickable(true); 52 55 53 this->label = new Text(); 54 this->label->setParent2D(this); 56 this->label.setFont("fonts/final_frontier.ttf", 20); 57 this->frontMaterial().setDiffuse(1, 0, 0); 58 59 this->label.setParent2D(this); 55 60 } 61 56 62 57 63 void GLGuiButton::setLabel(const std::string& label) 58 64 { 59 this->label->setText(label); 60 this->label->setRelCoor2D(5, 5); 61 this->setSize2D(this->label->getSizeX2D()+10, this->label->getSizeY2D()+10); 65 this->label.setText(label); 66 this->resize(); 62 67 } 63 68 64 65 69 /** 66 * draws the GLGuiButton70 * @brief draws the GLGuiButton 67 71 */ 68 72 void GLGuiButton::draw() const -
trunk/src/lib/gui/gl_gui/glgui_button.h
r7779 r7919 10 10 #include "glgui_widget.h" 11 11 12 class Text; 12 #include "text.h" 13 13 14 14 namespace OrxGui … … 27 27 //! This is part of the openglGUI class 28 28 /** 29 * 29 * The Button is an Abstract class, that can be pushed to Toggle its state. 30 30 */ 31 31 class GLGuiButton : public GLGuiWidget … … 33 33 34 34 public: 35 GLGuiButton( );35 GLGuiButton(const std::string& label); 36 36 virtual ~GLGuiButton(); 37 37 38 void init();38 const std::string& getLabel() const { return this->label.getText(); }; 39 39 void setLabel(const std::string& label); 40 41 virtual void resize() = 0; 40 42 41 43 virtual void draw() const; 42 44 45 private: 46 void init(); 47 48 43 49 protected: 44 Text* label; 50 51 Text label; 45 52 46 53 private: -
trunk/src/lib/gui/gl_gui/glgui_checkbutton.cc
r7779 r7919 27 27 * standard constructor 28 28 */ 29 GLGuiCheckButton::GLGuiCheckButton () 29 GLGuiCheckButton::GLGuiCheckButton (const std::string& label, bool active) 30 : GLGuiButton(label) 30 31 { 31 32 this->init(); 33 this->bActive = active; 32 34 35 this->resize(); 33 36 } 34 37 … … 44 47 * initializes the GUI-element 45 48 */ 46 GLGuiCheckButton::init()49 void GLGuiCheckButton::init() 47 50 { 48 51 this->setClassID(CL_GLGUI_CHECKBUTTON, "GLGuiCheckButton"); 52 } 49 53 54 55 void GLGuiCheckButton::toggleActiveState() 56 { 57 this->bActive = !this->bActive; 58 } 59 60 void GLGuiCheckButton::resize() 61 { 62 this->label.setRelCoor2D(25, 5); 63 this->setSize2D(this->label.getSizeX2D() + 30, this->label.getSizeY2D() + 10); 64 } 65 66 67 void GLGuiCheckButton::released() 68 { 69 printf("%s released\n", this->getLabel().c_str()); 70 GLGuiWidget::released(); 71 this->toggleActiveState(); 50 72 } 51 73 52 74 /** 53 * draws the GLGuiCheckButton75 * @brief draws the GLGuiPushButton 54 76 */ 55 77 void GLGuiCheckButton::draw() const 56 78 { 79 this->startDraw(); 80 GLGuiButton::draw(); 81 82 this->frontMaterial().select(); 83 glBegin(GL_QUADS); 84 85 glTexCoord2i(0,0); glVertex2d(1, 1); 86 glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1); 87 glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1); 88 glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1); 89 90 if (this->bActive) 91 { 92 glColor3f( 1, 1 ,1); 93 glTexCoord2i(0,0); glVertex2d(8, 8); 94 glTexCoord2i(0,1); glVertex2d(8, this->getSizeY2D()-8); 95 glTexCoord2i(1,1); glVertex2d(this->getSizeY2D()-8, this->getSizeY2D()-8); 96 glTexCoord2i(1,0); glVertex2d(this->getSizeY2D()-8, 8); 97 glEnd(); 98 99 100 // DRAW a cross :) 101 glColor3f(0,0,0); 102 glLineWidth(3.0); 103 glBegin(GL_LINE_LOOP); 104 glVertex2d(8,8); 105 glVertex2d(this->getSizeY2D()/2, this->getSizeY2D()/2 - 1); 106 107 glVertex2d(this->getSizeY2D() -8, 8); 108 glVertex2d(this->getSizeY2D()/2 +1, this->getSizeY2D()/2); 109 110 glVertex2d(this->getSizeY2D() -8, this->getSizeY2D() - 8); 111 glVertex2d(this->getSizeY2D()/2, this->getSizeY2D()/2+1); 112 113 glVertex2d(8, this->getSizeY2D() - 8); 114 glVertex2d(this->getSizeY2D()/2 -1, this->getSizeY2D()/2); 115 glEnd(); 116 } 117 else 118 { 119 glColor3f(0, 0, 0); 120 glTexCoord2i(0,0); glVertex2d(8, 8); 121 glTexCoord2i(0,1); glVertex2d(8, this->getSizeY2D()-8); 122 glTexCoord2i(1,1); glVertex2d(this->getSizeY2D()-8, this->getSizeY2D()-8); 123 glTexCoord2i(1,0); glVertex2d(this->getSizeY2D()-8, 8); 124 glEnd(); 125 } 126 127 128 this->endDraw(); 129 // this->label->draw(); 130 // printf("test"); 57 131 } 58 132 } -
trunk/src/lib/gui/gl_gui/glgui_checkbutton.h
r7779 r7919 6 6 7 7 #ifndef _GLGUI_CHECKBUTTON_H 8 #define _GLGUI_ _H8 #define _GLGUI_CHECKBUTTON_H 9 9 10 10 #include "glgui_button.h" … … 23 23 24 24 public: 25 GLGuiCheckButton( );25 GLGuiCheckButton(const std::string& label = "", bool active = false); 26 26 virtual ~GLGuiCheckButton(); 27 27 28 void init(); 28 virtual void resize(); 29 virtual void released(); 29 30 30 31 bool isActive() { return this->bActive; }; 31 32 void setActivity(bool bActive); 33 void toggleActiveState(); 32 34 33 35 virtual void draw() const; 34 36 virtual void update() {}; 37 38 private: 39 void init(); 40 35 41 36 42 private: -
trunk/src/lib/gui/gl_gui/glgui_colorselector.h
r7779 r7919 5 5 */ 6 6 7 #ifndef _GLGUI_ _H8 #define _GLGUI_ _H7 #ifndef _GLGUI_COLORSELECTOR_H 8 #define _GLGUI_COLORSELECTOR_H 9 9 10 #include " base_object.h"10 #include "glgui_widget.h" 11 11 12 12 namespace OrxGui -
trunk/src/lib/gui/gl_gui/glgui_cursor.cc
r7779 r7919 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI 17 17 18 #include "glgui_.h" 18 #include "glgui_cursor.h" 19 20 #include "glgui_handler.h" 21 #include "color.h" 22 19 23 20 24 namespace OrxGui … … 24 28 * standard constructor 25 29 */ 26 GLGui ::GLGui()30 GLGuiCursor::GLGuiCursor () 27 31 { 28 32 this->init(); 33 34 this->subscribeEvent(ES_MENU, EV_MOUSE_MOTION); 35 this->subscribeEvent(ES_MENU, EV_WINDOW_FOCUS); 36 29 37 30 38 } … … 32 40 33 41 /** 34 * standard deconstructor35 */36 GLGui ::~GLGui()42 * @brief standard deconstructor 43 */ 44 GLGuiCursor::~GLGuiCursor() 37 45 { 46 GLGuiHandler::getInstance()->deactivateCursor(false); 47 } 48 49 float GLGuiCursor::_mouseSensitivity = 1.0; 50 51 52 /** 53 * @brief initializes the GUI-element 54 */ 55 void GLGuiCursor::init() 56 { 57 this->setClassID(CL_GLGUI_CURSOR, "GLGuiCursor"); 58 59 this->backMaterial().setDiffuse(1.0,0.0,0.0); 60 this->backMaterial().setDiffuseMap("cursor.png"); 61 this->setSize2D(10, 20); 62 this->setAbsCoor2D(100, 100); 63 this->setLayer(E2D_LAYER_ABOVE_ALL); 64 this->color = 0.0f; 65 66 } 67 68 void GLGuiCursor::tick(float dt) 69 { 70 this->color += dt*10.0; 71 if (this->color > 360.0) 72 this->color -= 360.0; 73 Vector color = Color::HSVtoRGB(Vector(this->color, 1.0, 1.0)); 74 this->backMaterial().setDiffuse(color.x, color.y, color.z); 75 76 if (this->movement != Vector2D()) 77 { 78 newPos += movement; 79 // reposition the cursor. 80 if (newPos.x < 0.0f ) 81 newPos.x = 0.0f; 82 if (newPos.x > this->_maxBorders.x) 83 newPos.x = this->_maxBorders.x; 84 if (newPos.y < 0.0f ) 85 newPos.y = 0.0f; 86 if (newPos.y > this->_maxBorders.y) 87 newPos.y = this->_maxBorders.y; 88 89 90 this->setAbsCoorSoft2D(newPos, 10); 91 movement = Vector2D(); 92 } 38 93 } 39 94 40 95 /** 41 * initializes the GUI-element96 * @brief draws the GLGuiCursor 42 97 */ 43 GLGui::init()98 void GLGuiCursor::draw() const 44 99 { 45 this->setClassID(CL_GLGUI_, "GLGui"); 46 100 this->startDraw(); 101 GLGuiWidget::draw(); 102 this->endDraw(); 47 103 } 48 104 49 /** 50 * draws the GLGui 51 */ 52 void GLGui::draw() 105 void GLGuiCursor::process(const Event& event) 53 106 { 107 switch (event.type) 108 { 109 case EV_WINDOW_FOCUS: 110 if (event.bPressed) 111 { 112 int mouseX, mouseY; 113 SDL_GetMouseState(&mouseX, &mouseY); 114 newPos = Vector2D(mouseX, mouseY); 115 } 116 break; 117 case EV_MOUSE_MOTION: 118 movement += Vector2D((float)event.xRel * _mouseSensitivity, (float)event.yRel * _mouseSensitivity); 119 break; 120 121 } 54 122 } 55 123 } -
trunk/src/lib/gui/gl_gui/glgui_cursor.h
r7779 r7919 1 1 /*! 2 * @file glgui_ .h3 * The gl_ widget of th openglGUI2 * @file glgui_cursor.h 3 * The gl_cursor widget of th openglGUI 4 4 * 5 5 */ 6 6 7 #ifndef _GLGUI_ _H8 #define _GLGUI_ _H7 #ifndef _GLGUI_CURSOR_H 8 #define _GLGUI_CURSOR_H 9 9 10 #include "base_object.h" 10 #include "glgui_widget.h" 11 #include "event_listener.h" 12 #include "vector2D.h" 11 13 12 14 namespace OrxGui … … 18 20 * 19 21 */ 20 class GLGui : public GLGui22 class GLGuiCursor : public GLGuiWidget, public EventListener 21 23 { 22 24 23 25 public: 24 GLGui(); 25 virtual ~GLGui(); 26 GLGuiCursor(); 27 virtual ~GLGuiCursor(); 28 29 static void setMouseSensitivity(float mouseSensitivity); 30 static float mouseSensitivity() { return GLGuiCursor::_mouseSensitivity; }; 31 32 void setMaxBorders(const Vector2D& maxBorders) { this->_maxBorders = maxBorders; }; 26 33 27 34 void init(); 35 const Vector2D& position() const { return Element2D::getAbsCoor2D(); } 28 36 29 virtual void draw();30 37 38 virtual void tick(float dt); 39 virtual void draw() const; 40 virtual void process(const Event& event); 31 41 private: 42 43 Vector2D _maxBorders; 44 45 Vector2D newPos; 46 Vector2D movement; 47 48 float color; // so f****ing temporary... ... .... 49 50 static float _mouseSensitivity; 32 51 33 52 }; 34 53 } 35 #endif /* _GLGUI_ _H */54 #endif /* _GLGUI_CURSOR_H */ -
trunk/src/lib/gui/gl_gui/glgui_handler.cc
r7868 r7919 20 20 21 21 #include "glgui_mainwidget.h" 22 #include "glgui_cursor.h" 23 24 #include "class_list.h" 25 26 27 /// TAKE THIS OUT OF HERE. 28 #include "graphics_engine.h" 22 29 23 30 namespace OrxGui … … 32 39 this->setName("GLGuiHandler"); 33 40 34 //this->subscribeEvent()35 41 42 EventHandler::getInstance()->withUNICODE(ES_MENU, true ); 43 44 this->cursor = NULL; 45 for (unsigned int i = 0; i < EV_NUMBER; i++) 46 { 47 this->subscribeEvent(ES_MENU, i); 48 } 36 49 } 37 50 … … 49 62 } 50 63 64 void GLGuiHandler::activateCursor() 65 { 66 if (this->cursor == NULL) 67 this->cursor = new GLGuiCursor(); 68 this->cursor->show(); 69 this->cursor->setMaxBorders(Vector2D(GraphicsEngine::getInstance()->getResolutionX(), GraphicsEngine::getInstance()->getResolutionY())); 70 } 71 72 void GLGuiHandler::deactivateCursor(bool deleteCursor) 73 { 74 if (this->cursor) 75 { 76 if (deleteCursor) 77 delete this->cursor; 78 this->cursor = NULL; 79 } 80 } 81 82 51 83 void GLGuiHandler::activate() 52 84 { 53 85 EventHandler::getInstance()->pushState(ES_MENU); 86 87 54 88 55 89 } … … 59 93 EventHandler::getInstance()->popState(); 60 94 95 61 96 } 62 97 … … 64 99 void GLGuiHandler::process(const Event &event) 65 100 { 101 switch (event.type) 102 { 103 case EV_MOUSE_BUTTON_LEFT: 104 if (GLGuiWidget::focused() != NULL) 105 { 106 if (event.bPressed) 107 { 108 if (GLGuiWidget::focused()->clickable()) 109 GLGuiWidget::focused()->click(); 110 } 111 else 112 { 113 if (GLGuiWidget::focused()->clickable()) 114 GLGuiWidget::focused()->release(); 115 } 116 } 117 break; 118 case EV_LEAVE_STATE: 119 if (GLGuiWidget::focused() != NULL) 120 GLGuiWidget::focused()->breakFocus(); 121 break; 122 123 case EV_VIDEO_RESIZE: 124 if (this->cursor != NULL) 125 this->cursor->setMaxBorders(Vector2D(event.resize.w, event.resize.h)); 126 break; 127 } 128 129 130 131 if (GLGuiWidget::focused()) 132 { 133 GLGuiWidget::focused()->processEvent(event); 134 } 135 66 136 67 137 … … 70 140 void GLGuiHandler::draw() 71 141 { 72 // GLGuiMainWidget::getInstance()->draw2D(E2D_LAYER_TOP);142 // GLGuiMainWidget::getInstance()->draw2D(E2D_LAYER_TOP); 73 143 } 74 144 … … 76 146 void GLGuiHandler::tick(float dt) 77 147 { 148 149 // CHECK THE COLLISIONS. 150 const std::list<BaseObject*>* objects = ClassList::getList(CL_GLGUI_WIDGET); 151 152 if (objects != NULL && this->cursor != NULL) 153 { 154 for (std::list<BaseObject*>::const_iterator it = objects->begin(); it != objects->end(); it++) 155 { 156 GLGuiWidget* widget = dynamic_cast<GLGuiWidget*>(*it); 157 158 if (widget->isVisible() && 159 widget->focusable() && 160 widget->focusOverWidget(this->cursor)) 161 { 162 // receiving Focus 163 if (GLGuiWidget::focused() != widget) 164 { 165 widget->giveFocus(); 166 } 167 return ; 168 } 169 } 170 if (GLGuiWidget::focused() != NULL) 171 GLGuiWidget::focused()->breakFocus(); 172 } 78 173 } 79 174 } -
trunk/src/lib/gui/gl_gui/glgui_handler.h
r7779 r7919 8 8 9 9 #include "event_listener.h" 10 #include "glgui_widget.h" 10 11 11 12 namespace OrxGui 12 13 { 14 15 class GLGuiCursor; 16 13 17 // FORWARD DECLARATION 14 18 … … 21 25 /** @returns a Pointer to the only object of this Class */ 22 26 inline static GLGuiHandler* getInstance(void) { if (!GLGuiHandler::singletonRef) GLGuiHandler::singletonRef = new GLGuiHandler(); return GLGuiHandler::singletonRef; }; 27 28 void activateCursor(); 29 void deactivateCursor(/** ignore param */ bool deleteCursor = true); 30 GLGuiCursor* getCursor() const { return this->cursor; } 23 31 24 32 void activate(); … … 36 44 37 45 bool isActive; 46 GLGuiCursor* cursor; 47 38 48 }; 39 49 } -
trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc
r7779 r7919 25 25 26 26 /** 27 * standard constructor 28 */ 29 GLGuiPushButton::GLGuiPushButton () 27 * @brief standard constructor 28 */ 29 GLGuiPushButton::GLGuiPushButton (const std::string& label) 30 : GLGuiButton(label) 30 31 { 31 32 this->init(); 33 34 this->resize(); 32 35 } 33 36 34 37 35 38 /** 36 * standard deconstructor39 * @brief standard deconstructor 37 40 */ 38 41 GLGuiPushButton::~GLGuiPushButton() 39 42 { 43 } 44 45 void GLGuiPushButton::resize() 46 { 47 this->label.setRelCoor2D(5, 5); 48 this->setSize2D(this->label.getSizeX2D() + 10, this->label.getSizeY2D() + 10); 40 49 } 41 50 … … 46 55 { 47 56 this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton"); 48 this->frontMat.setDiffuse(1,0,0);49 // this->label->setRelCoor2D(10, 10);50 57 } 51 58 59 void GLGuiPushButton::receivedFocus() 60 { 61 printf("%s received focus\n", this->getLabel().c_str()); 62 GLGuiWidget::receivedFocus(); 63 } 64 65 void GLGuiPushButton::removedFocus() 66 { 67 printf("%s removed focus\n", this->getLabel().c_str()); 68 GLGuiWidget::removedFocus(); 69 70 } 71 72 void GLGuiPushButton::clicked() 73 { 74 printf("%s clicked\n", this->getLabel().c_str()); 75 GLGuiWidget::clicked(); 76 } 77 78 79 void GLGuiPushButton::released() 80 { 81 printf("%s released\n", this->getLabel().c_str()); 82 GLGuiWidget::released(); 83 } 84 85 86 52 87 /** 53 * draws the GLGuiPushButton88 * @brief draws the GLGuiPushButton 54 89 */ 55 90 void GLGuiPushButton::draw() const 56 91 { 57 92 this->startDraw(); 93 GLGuiButton::draw(); 58 94 59 // GLGuiButton::draw(); 60 61 this->frontMat.select(); 95 this->frontMaterial().select(); 62 96 glBegin(GL_QUADS); 63 97 64 gl Vertex2d(0,0);65 gl Vertex2d(0, this->getSizeY2D());66 gl Vertex2d(this->getSizeX2D(), this->getSizeY2D());67 gl Vertex2d(this->getSizeX2D(),0);98 glTexCoord2i(0,0); glVertex2d(1, 1); 99 glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1); 100 glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1); 101 glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1); 68 102 69 103 glEnd(); 70 71 104 this->endDraw(); 72 105 // this->label->draw(); -
trunk/src/lib/gui/gl_gui/glgui_pushbutton.h
r7779 r7919 23 23 24 24 public: 25 GLGuiPushButton( );25 GLGuiPushButton(const std::string& label = ""); 26 26 virtual ~GLGuiPushButton(); 27 27 28 void init(); 28 29 virtual void resize(); 30 31 virtual void receivedFocus(); 32 virtual void removedFocus(); 33 virtual void clicked(); 34 virtual void released(); 35 29 36 30 37 virtual void draw() const; 31 38 virtual void update(); 32 39 private: 40 void init(); 33 41 34 42 }; -
trunk/src/lib/gui/gl_gui/glgui_slider.cc
r7779 r7919 50 50 * draws the GLGuiSlider 51 51 */ 52 void GLGuiSlider::draw() 52 void GLGuiSlider::draw() const 53 53 { 54 54 } -
trunk/src/lib/gui/gl_gui/glgui_slider.h
r7779 r7919 8 8 #define _GLGUI_SLIDER_H 9 9 10 #include " base_object.h"11 10 #include "glgui_widget.h" 11 #include "glgui_defs.h" 12 12 13 13 namespace OrxGui … … 19 19 * 20 20 */ 21 class GLGuiSlider : public GLGui Slider21 class GLGuiSlider : public GLGuiWidget 22 22 { 23 23 … … 28 28 void init(); 29 29 30 virtual void draw() ;30 virtual void draw() const; 31 31 32 32 private: 33 Orientation orientation; 34 35 float _maxValue; 36 float _minValue; 37 38 float _value; 33 39 34 40 }; -
trunk/src/lib/gui/gl_gui/glgui_textfield.cc
r7779 r7919 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI 17 17 18 #include "glgui_textfield _.h"18 #include "glgui_textfield.h" 19 19 namespace OrxGui 20 20 { … … 42 42 void GLGuiTextfield::init() 43 43 { 44 this->setClassID(CL_GLGUI_, "GLGuiTextfield"); 44 this->setClassID(CL_GLGUI_TEXTFIELD, "GLGuiTextfield"); 45 45 46 46 47 } … … 49 50 * draws the GLGuiTextfield 50 51 */ 51 void GLGuiTextfield::draw() 52 void GLGuiTextfield::draw() const 52 53 { 53 54 } -
trunk/src/lib/gui/gl_gui/glgui_textfield.h
r7779 r7919 9 9 10 10 #include "glgui_widget.h" 11 12 #include "text.h" 13 #include <vector> 11 14 12 15 // FORWARD DECLARATION … … 28 31 void init(); 29 32 30 virtual void draw(); 33 void process(const Event& event); 34 35 virtual void draw() const; 31 36 32 37 private: 33 std:: list<Text*>textLines;38 std::vector<Text> textLines; 34 39 35 40 }; -
trunk/src/lib/gui/gl_gui/glgui_widget.cc
r7855 r7919 18 18 #include "glgui_widget.h" 19 19 20 #include "glgui_cursor.h" 21 20 22 #include "material.h" 21 23 … … 39 41 GLGuiWidget::~GLGuiWidget() 40 42 { 41 } 43 if (this == GLGuiWidget::_focused) 44 GLGuiWidget::_focused = NULL; 45 } 46 47 GLGuiWidget* GLGuiWidget::_focused = NULL; 48 GLGuiWidget* GLGuiWidget::_inputGrabber = NULL; 49 42 50 43 51 … … 49 57 this->setClassID(CL_GLGUI_WIDGET, "GLGuiWidget"); 50 58 51 this->focusable = true; 52 this->clickable = true; 59 this->_focusable = false; 60 this->_clickable = false; 61 this->_pushed = false; 62 53 63 this->setVisibility(GLGUI_WIDGET_DEFAULT_VISIBLE); 54 // this->setParent2D((Element2D*)NULL);55 64 56 65 this->backMat.setDiffuse(1.0, 1.0, 1.0); 57 58 this->frontModel = 0; 66 this->frontMat.setDiffuse(1.0, 0.0, 0.0); 59 67 60 68 this->widgetSignals.resize(SignalCount, SignalConnector()); … … 62 70 63 71 64 bool GLGuiWidget::focusOverWidget(float x, float y) 65 { 66 if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x + this->getSizeX2D() > x && 67 this->getAbsCoor2D().y < y && this->getAbsCoor2D().y + this->getSizeY2D() > y) 68 return true; 69 else 70 return false; 71 } 72 /** @brief gives focus to this widget */ 73 void GLGuiWidget::giveFocus() 74 { 75 if (GLGuiWidget::focused() != NULL) 76 GLGuiWidget::focused()->breakFocus(); 77 GLGuiWidget::_focused = this; 78 this->receivedFocus(); 79 }; 80 81 void GLGuiWidget::breakFocus() 82 { 83 if (GLGuiWidget::_focused == this) 84 { 85 GLGuiWidget::_focused = NULL; 86 this->_pushed = false; 87 this->removedFocus(); 88 } 89 }; 90 91 92 bool GLGuiWidget::focusOverWidget(const Vector2D& position) const 93 { 94 return (this->getAbsCoor2D().x < position.x && this->getAbsCoor2D().x + this->getSizeX2D() > position.x && 95 this->getAbsCoor2D().y < position.y && this->getAbsCoor2D().y + this->getSizeY2D() > position.y); 96 } 97 98 bool GLGuiWidget::focusOverWidget(const GLGuiCursor* const cursor) const 99 { 100 return this->focusOverWidget(cursor->getAbsCoor2D()); 101 } 102 103 void GLGuiWidget::click() 104 { 105 assert (!this->_pushed); 106 this->widgetSignals[Signal_click]("none"); 107 this->_pushed = true; 108 109 this->clicked(); 110 } 111 112 void GLGuiWidget::release() 113 { 114 if (this->_pushed) 115 { 116 this->widgetSignals[Signal_release]("none"); 117 118 this->released(); 119 this->_pushed = false; 120 } 121 } 122 123 124 void GLGuiWidget::clicked() 125 { 126 this->frontMaterial().setDiffuse(0, 0, 1); 127 128 } 129 130 void GLGuiWidget::released() 131 { 132 this->frontMat.setDiffuse(0,1,0); 133 134 } 135 136 void GLGuiWidget::receivedFocus() 137 { 138 this->frontMaterial().setDiffuse(0, 1, 0); 139 } 140 141 void GLGuiWidget::removedFocus() 142 { 143 this->frontMaterial().setDiffuse(1, 0, 0); 144 145 } 146 147 void GLGuiWidget::destroyed() 148 { 149 }; 150 151 152 72 153 73 154 /** … … 116 197 117 198 glBegin(GL_QUADS); 118 glTexCoord2i(0, 1); glVertex2d(0, 0);119 glTexCoord2i(0, 0); glVertex2d(0, this->getSizeY2D());120 glTexCoord2i(1, 0); glVertex2d(this->getSizeX2D(), this->getSizeY2D());121 glTexCoord2i(1, 1); glVertex2d(this->getSizeX2D(), 0);199 glTexCoord2i(0,0); glVertex2d(0, 0); 200 glTexCoord2i(0,1); glVertex2d(0, this->getSizeY2D()); 201 glTexCoord2i(1,1); glVertex2d(this->getSizeX2D(), this->getSizeY2D()); 202 glTexCoord2i(1,0); glVertex2d(this->getSizeX2D(), 0); 122 203 glEnd(); 123 204 } -
trunk/src/lib/gui/gl_gui/glgui_widget.h
r7868 r7919 8 8 9 9 #include "element_2d.h" 10 #include "event.h" 10 #include "rect2D.h" 11 11 12 #include "material.h" 12 13 14 #include "event.h" 15 #include "signal_connector.h" 16 13 17 #include "glincl.h" 14 #include "signal_connector.h" 18 19 #include <vector> 15 20 16 21 // FORWARD DECLARATION … … 19 24 namespace OrxGui 20 25 { 21 22 26 typedef enum 23 27 { … … 34 38 35 39 40 class GLGuiCursor; 41 36 42 //! if the Element should be visible by default. 37 43 #define GLGUI_WIDGET_DEFAULT_VISIBLE false … … 43 49 class GLGuiWidget : public Element2D 44 50 { 51 45 52 private: 46 53 … … 52 59 void hide(); 53 60 61 /// INTERCONNECTIVITY 54 62 void connectSignal(SignalType signalType, BaseObject* obj, const Executor* signal); 55 63 void disconnectSignal(SignalType signalType); 56 bool focusOverWidget(float x, float y);57 64 65 66 /// FOCUS 67 /** @brief gives focus to this widget */ 68 void giveFocus(); 69 void breakFocus(); 70 /** @returns true if the widget is focusable */ 71 bool focusable() const { return this->_focusable; }; 72 /** @param focusable sets if the Widget should be focusable */ 73 void setFocusable(bool focusable = true) { this->_focusable = focusable; }; 74 /** @returns true if the position is inside of the Widget. @param position the position to check */ 75 bool focusOverWidget(const Vector2D& position) const; 76 /** @brief overloaded function, that returns true if the cursor is on top of the Widget */ 77 bool focusOverWidget(const OrxGui::GLGuiCursor* const cursor) const; 78 79 /** @returns the currently focused Widget (NULL if none is selected) */ 80 static GLGuiWidget* focused() { return GLGuiWidget::_focused; }; 81 82 83 /// CLICK 84 void click(); 85 void release(); 86 bool clickable() const { return this->_clickable; }; 87 void setClickable(bool clickable = true) { this->_clickable = clickable; }; 58 88 59 89 virtual void update() {}; 60 90 virtual void draw() const; 61 91 92 93 /// MATERIAL (looks) 62 94 Material& backMaterial() { return this->backMat; }; 63 95 const Material& backMaterial() const { return this->backMat; }; … … 66 98 const Material& frontMaterial() const { return this->frontMat; }; 67 99 100 /** @param the Event to process. @returns true if the Event has been consumed*/ 101 virtual bool processEvent(const Event& event) { }; 102 103 104 DeclareSignal(testSignal, ()); 105 68 106 protected: 69 107 // if something was clickt on the GUI-widget. 70 virtual void clicked(const Event& event) {}; 71 virtual void released(const Event& event) {}; 108 virtual void clicked(); 109 virtual void released(); 110 virtual void receivedFocus(); 111 virtual void removedFocus(); 72 112 73 virtual void receivedFocus() {}; 74 virtual void removedFocus() {}; 75 76 virtual void destroyed() {}; 113 virtual void destroyed(); 77 114 78 115 … … 84 121 85 122 123 private: 124 /// LOOKS 125 Material backMat; 126 Rect2D backRect; 127 128 Material frontMat; 129 Rect2D frontRect; 86 130 87 131 88 protected: 89 Material backMat; 90 GLuint backModel; 132 /// SIGNALS 133 std::vector<SignalConnector> widgetSignals; 91 134 92 Material frontMat; 93 GLuint frontModel; 135 /// EVENTS 136 bool _focusable; //!< If this widget can receive focus. 137 bool _clickable; //!< if this widget can be clicked upon. 94 138 95 private: 96 std::vector<SignalConnector> widgetSignals; 139 bool _pushed; 97 140 98 bool focusable; //!< If this widget can receive focus.99 bool clickable; //!< if this widget can be clicked upon.141 static GLGuiWidget* _focused; 142 static GLGuiWidget* _inputGrabber; 100 143 }; 101 144 } -
trunk/src/lib/gui/gl_gui/glmenu/glmenu_imagescreen.cc
r7221 r7919 240 240 glEnd(); 241 241 242 glDisable(GL_TEXTURE_2D);243 242 /* draw white border */ 244 243 glBegin(GL_LINE_LOOP); -
trunk/src/lib/gui/gl_gui/signal_connector.h
r7855 r7919 11 11 namespace OrxGui 12 12 { 13 14 #define DeclareSignal(name, params) \ 15 public: \ 16 void signal_ ##connect ##name(const SignalConnector& connector) { \ 17 name ## connected.push_back(connector); \ 18 }\ 19 private: \ 20 void signal_ ## name params { \ 21 for (unsigned int i = 0; i < name ## connected . size(); i++) \ 22 name ## connected[i] ("TEST"); \ 23 }\ 24 std::vector<SignalConnector> name ## connected 25 13 26 //! A class for Conncting Signals to Objects, inside of the GUI 14 27 class SignalConnector -
trunk/src/lib/math/Makefile.am
r7033 r7919 13 13 plane.cc \ 14 14 line.cc \ 15 rect2D.cc \ 15 16 rotation_OBSOLETE.cc 16 17 … … 23 24 plane.h \ 24 25 line.h \ 26 rect2D.h \ 25 27 rotation_OBSOLETE.h -
trunk/src/lib/math/vector2D.h
r6616 r7919 24 24 #define __VECTOR2D_H_ 25 25 26 #include < math.h>26 #include <cmath> 27 27 #include "compiler.h" 28 28 … … 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; } … … 77 79 /** @param v: the other vector \return the dot product of the vectors */ 78 80 float dot (const Vector2D& v) const { return x*v.x+y*v.y; }; 81 /** @param v multipy each entry with each other @returns this reference */ 82 const Vector2D& internalMultipy(const Vector2D& v) { this->x *= v.x; this->y *= y; }; 79 83 /** scales the this vector with v* @param v the vector to scale this with */ 80 84 void scale(const Vector2D& v) { x *= v.x; y *= v.y; }; … … 85 89 Vector2D getNormalized() const; 86 90 Vector2D abs(); 91 92 /** @param v the Vector to slerp to @param val 0 = stay 1 = at v */ 93 void slerp(const Vector2D& v, float val) { *this += (*this - v) * val; } 87 94 88 95 void debug() const; -
trunk/src/lib/shell/shell.cc
r7868 r7919 70 70 this->subscribeEvent(ES_SHELL, SDLK_PAGEDOWN); 71 71 this->subscribeEvent(ES_SHELL, EV_VIDEO_RESIZE); 72 EventHandler::getInstance()->withUNICODE(ES_SHELL, true); 72 73 73 74 // BUFFER … … 83 84 this->textSize = 15; 84 85 this->lineSpacing = 0; 85 this->bActive = true;86 this->bActive = false; 86 87 this->fontFile = SHELL_DEFAULT_FONT; 87 88 … … 121 122 122 123 EventHandler::getInstance()->pushState(ES_SHELL); 123 EventHandler::getInstance()->withUNICODE(true);124 124 125 125 this->setRelCoorSoft2D(0, 0, 5); … … 138 138 (*text)->setText(""); 139 139 } 140 this->shellInput.setVisibility(true); 140 141 this->updateResolution( GraphicsEngine::getInstance()->getResolutionX()); 141 142 this->repositionText(); … … 152 153 this->deactivate2D(); 153 154 154 EventHandler::getInstance()->withUNICODE(false);155 155 EventHandler::getInstance()->popState(); 156 156 … … 159 159 for (std::list<MultiLineText*>::iterator text = this->bufferText.begin(); text != this->bufferText.end(); ++text) 160 160 (*text)->setVisibility(false); 161 this->shellInput.setVisibility(false); 162 161 163 // Go to the End again. 162 164 this->bufferIterator = this->shellBuffer->getBuffer().begin(); -
trunk/src/lib/shell/shell_input.cc
r7868 r7919 305 305 this->historyMoveUp(); 306 306 this->pressedKey = event.type; 307 this->pressedEvent = event.type; 307 308 } 308 309 else if (event.type == SDLK_DOWN) … … 310 311 this->historyMoveDown(); 311 312 this->pressedKey = event.type; 313 this->pressedEvent = event.type; 312 314 } 313 315 else if (event.type == SDLK_TAB) … … 320 322 this->delayed = this->repeatDelay; 321 323 this->pressedKey = SDLK_BACKSPACE; 324 this->pressedEvent = SDLK_BACKSPACE; 322 325 this->removeCharacters(1); 323 326 } … … 326 329 this->executeCommand(); 327 330 this->pressedKey = event.type; 331 this->pressedEvent = event.type; 328 332 } 329 333 // any other keyboard key -
trunk/src/lib/util/color.cc
r7195 r7919 113 113 } 114 114 else { 115 if(h == 360.)116 h = 0.0;115 if(h >= 360.) 116 h = h - (float)((int)(ceilf(h) / 360.0)); 117 117 h /= 60.; 118 118 i = (int) h; -
trunk/src/story_entities/game_world.cc
r7871 r7919 25 25 26 26 #include "util/loading/game_loader.h" 27 #include "util/timer.h" 27 28 28 29 #include "player.h" … … 259 260 this->cycle = 0; 260 261 for (unsigned int i = 0; i < TICK_SMOOTH_VALUE; i++) 261 this->frameTimes[i] = 100;262 this->frameTimes[i] = 0.01f; 262 263 this->dtS = 0.0f; 263 this->lastFrame = SDL_GetTicks();264 this->lastFrame = Timer::getNow(); 264 265 265 266 if (this->dataTank->music != NULL) … … 356 357 void GameWorld::tick () 357 358 { 358 Uint32 currentFrame = SDL_GetTicks();359 360 359 if( !this->bPaused) 361 360 { 362 361 // CALCULATE FRAMERATE 363 362 Uint32 frameTimesIndex; 364 Uint32 getTicks;365 363 Uint32 i; 364 double currentFrame = Timer::getNow(); 366 365 367 366 frameTimesIndex = this->cycle % TICK_SMOOTH_VALUE; 368 getTicks = SDL_GetTicks(); 369 this->frameTimes[frameTimesIndex] = getTicks - this->lastFrame; 370 this->lastFrame = getTicks; 367 this->frameTimes[frameTimesIndex] = currentFrame - this->lastFrame; 368 this->lastFrame = currentFrame; 371 369 ++this->cycle; 372 this->dtS = 0 ;370 this->dtS = 0.0; 373 371 for (i = 0; i < TICK_SMOOTH_VALUE; i++) 374 372 this->dtS += this->frameTimes[i]; 375 this->dtS = this->dtS / TICK_SMOOTH_VALUE / 1000.0f* speed;373 this->dtS = this->dtS / TICK_SMOOTH_VALUE * speed; 376 374 377 375 // TICK everything … … 390 388 this->dataTank->gameRule->tick(this->dtS); 391 389 } 392 this->lastFrame = currentFrame;393 390 } 394 391 … … 526 523 GraphicsEngine* engine = GraphicsEngine::getInstance(); 527 524 525 528 526 AtmosphericEngine::getInstance()->draw(); 527 528 //glEnable(GL_DEPTH_TEST); 529 //glEnable(GL_LIGHTING); 529 530 530 531 // set camera -
trunk/src/story_entities/game_world.h
r7785 r7919 93 93 94 94 /* world timing */ 95 Uint32lastFrame; //!< last time of frame (in MiliSeconds)95 double lastFrame; //!< last time of frame (in MiliSeconds) 96 96 Uint32 cycle; //!< The cycle we are in (starts with 0 and rises with every frame) 97 97 float dtS; //!< The time needed for caluculations in seconds 98 98 float speed; //!< how fast the game flows 99 99 double gameTime; //!< this is where the game time is saved 100 Uint32frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames.100 double frameTimes[TICK_SMOOTH_VALUE];//!< The time used for the last TICK_SMOOTH_VALUE's frames. 101 101 102 102 GameRules* gameRules; //!< Pointer to the data structure containig the game rules -
trunk/src/story_entities/movie_loader.cc
r7868 r7919 115 115 GraphicsEngine::enter2DMode(); 116 116 117 glPushAttrib(GL_ENABLE_BIT); 117 118 glEnable(GL_TEXTURE_2D); 118 119 glBindTexture(GL_TEXTURE_2D, movie_player->getTexture()); … … 127 128 glEnd(); 128 129 130 glPopAttrib(); 129 131 GraphicsEngine::leave2DMode(); 130 132 -
trunk/src/story_entities/simple_game_menu.cc
r7868 r7919 28 28 #include "util/loading/factory.h" 29 29 30 #include "p_node.h"31 30 #include "world_entity.h" 32 31 #include "elements/image_entity.h" … … 41 40 #include "cd_engine.h" 42 41 43 44 using namespace std; 45 42 #include "glgui.h" 46 43 47 44 //! This creates a Factory to fabricate a SimpleGameMenu … … 51 48 52 49 SimpleGameMenu::SimpleGameMenu(const TiXmlElement* root) 53 : GameWorld()50 : GameWorld() 54 51 { 55 52 this->setClassID(CL_SIMPLE_GAME_MENU, "SimpleGameMenu"); … … 66 63 this->selectorSource = NULL; 67 64 65 66 /// GUI 67 ///(this is as modular as it is possible). 68 OrxGui::GLGuiPushButton* pb = new OrxGui::GLGuiPushButton("PUSH ME"); 69 pb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::enterGui)); 70 pb->show(); 71 pb->setAbsCoor2D(50, 50); 72 73 OrxGui::GLGuiHandler::getInstance()->activateCursor(); 74 OrxGui::GLGuiHandler::getInstance()->activate(); 75 ///// 76 68 77 if (root != NULL) 69 78 this->loadParams(root); … … 72 81 } 73 82 74 75 /** 76 * @brief remove the SimpleGameMenu from memory 77 * 78 * delete everything explicitly, that isn't contained in the parenting tree! 79 * things contained in the tree are deleted automaticaly 80 */ 83 /// HACK only for testing. 84 void SimpleGameMenu::enterGui() 85 { 86 /// 87 OrxGui::GLGuiButton* dnpb = new OrxGui::GLGuiCheckButton("Push the button"); 88 dnpb->show(); 89 dnpb->setAbsCoor2D(350, 50); 90 dnpb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::execURL)); 91 92 OrxGui::GLGuiPushButton* rdnpb = new OrxGui::GLGuiPushButton("Quit ORXONOX!!"); 93 rdnpb->show(); 94 rdnpb->setAbsCoor2D(200, 180); 95 rdnpb->connectSignal(OrxGui::Signal_release, this, createExecutor<SimpleGameMenu>(&SimpleGameMenu::quitMenu)); 96 97 OrxGui::GLGuiInputLine* input = new OrxGui::GLGuiInputLine(); 98 input->setText("input some text here"); 99 input->show(); 100 input->setAbsCoor2D(200, 230); 101 102 103 ///// 104 } 105 106 107 #include "threading.h" 108 void SimpleGameMenu::execURL() const 109 { 110 std::string URL = "http://www.orxonox.net"; 111 SDL_CreateThread(startURL, (void*)&URL); 112 } 113 114 #ifdef __OSX__ 115 #include <ApplicationServices/ApplicationServices.h> 116 #elif defined __WIN32__ 117 #include <shellapi.h> 118 #endif 119 120 int SimpleGameMenu::startURL(void* url) 121 { 122 std::string URL = *(std::string*)url; 123 #ifdef __linux__ 124 system ((std::string("firefox ") + URL).c_str()); 125 #elif defined __OSX__ 126 CFURLRef url_handle = CFURLCreateWithBytes (NULL, (UInt8 *)URL.c_str(), URL.size(), 127 kCFStringEncodingASCII, NULL); 128 LSOpenCFURLRef (url_handle, NULL); 129 CFRelease (url_handle); 130 #elif defined __WIN32__ 131 ShellExecute(GetActiveWindow(), 132 "open", URL.c_str(), NULL, NULL, SW_SHOWNORMAL); 133 } 134 #endif 135 PRINTF(3)("loaded external webpage %s\n", URL.c_str()); 136 } 137 138 /** 139 * @brief remove the SimpleGameMenu from memory 140 * 141 * delete everything explicitly, that isn't contained in the parenting tree! 142 * things contained in the tree are deleted automaticaly 143 */ 81 144 SimpleGameMenu::~SimpleGameMenu () 82 145 { … … 85 148 if( this->dataTank) 86 149 delete this->dataTank; 87 } 88 89 90 /** 91 * @brief loads the parameters of a SimpleGameMenu from an XML-element 92 * @param root the XML-element to load from 93 */ 150 delete OrxGui::GLGuiHandler::getInstance( ); 151 } 152 153 154 /** 155 * @brief loads the parameters of a SimpleGameMenu from an XML-element 156 * @param root the XML-element to load from 157 */ 94 158 void SimpleGameMenu::loadParams(const TiXmlElement* root) 95 159 { … … 103 167 104 168 /** 105 106 107 108 109 169 * @brief this is executed just before load 170 * 171 * since the load function sometimes needs data, that has been initialized 172 * before the load and after the proceeding storyentity has finished 173 */ 110 174 ErrorMessage SimpleGameMenu::init() 111 175 { … … 129 193 130 194 /** 131 132 195 * @brief load the data 196 */ 133 197 ErrorMessage SimpleGameMenu::loadData() 134 198 { … … 149 213 { 150 214 element = element->FirstChildElement(); 151 // load Players/Objects/Whatever215 // load Players/Objects/Whatever 152 216 PRINTF(4)("Loading Elements\n"); 153 217 while( element != NULL) … … 196 260 this->menuStartMultiplayerGame->setBindNode((const PNode*)NULL); 197 261 this->menuStartMultiplayerGame->setRelCoor2D(State::getResX() / 2.0f, 198 262 State::getResY() / 2.0f + ((this->menuLayers[0].menuList.size() -1 ) * 60.0f)); 199 263 this->menuLayers[0].menuList.push_back(dynamic_cast<TextElement*>(*entity)); 200 264 } … … 244 308 245 309 /** 246 247 248 310 * @brief set the Sound to play when switching menu entry. 311 * @param selectorSound the sound to load. 312 */ 249 313 void SimpleGameMenu::setSelectorSound(const std::string& selectorSound) 250 314 { … … 280 344 281 345 /** 282 283 346 * @brief start the menu 347 */ 284 348 bool SimpleGameMenu::start() 285 349 { … … 293 357 294 358 /** 295 296 359 * stop the menu 360 */ 297 361 bool SimpleGameMenu::stop() 298 362 { … … 305 369 306 370 /** 307 308 371 * override the standard tick for more functionality 372 */ 309 373 void SimpleGameMenu::tick() 310 374 { 311 375 GameWorld::tick(); 312 376 377 // Make the GLGui tick. 378 OrxGui::GLGuiHandler::getInstance()->tick(this->dtS); 379 313 380 this->animateScene(this->dtS); 314 381 } … … 316 383 317 384 /** 318 319 385 * @brief no collision detection in the menu 386 */ 320 387 void SimpleGameMenu::collide() 321 388 { 322 // this->dataTank->localCamera->323 } 324 325 326 /** 327 328 389 // this->dataTank->localCamera-> 390 } 391 392 393 /** 394 * @brief animate the scene 395 */ 329 396 void SimpleGameMenu::animateScene(float dt) 330 397 { … … 335 402 } 336 403 337 338 /** 339 * @brief event dispatcher funciton 340 * @param event the incoming event 341 */ 404 void SimpleGameMenu::quitMenu() 405 { 406 this->setNextStoryID(WORLD_ID_GAMEEND); 407 this->stop(); 408 } 409 410 411 /** 412 * @brief event dispatcher funciton 413 * @param event the incoming event 414 */ 342 415 void SimpleGameMenu::process(const Event &event) 343 416 { … … 422 495 423 496 /** 424 425 426 427 497 * @brief switches to from one meny layer to an other 498 * @param layer1 from layer 499 * @param layer2 to layer 500 */ 428 501 void SimpleGameMenu::switchMenuLayer(int layer1, int layer2) 429 502 { … … 485 558 486 559 /********************************************************************************************** 487 488 489 490 491 /** 492 493 560 SimpleGameMenuData 561 **********************************************************************************************/ 562 563 564 /** 565 * SimpleGameMenuData constructor 566 */ 494 567 SimpleGameMenuData::SimpleGameMenuData() 495 568 {} 496 569 497 570 /** 498 499 571 * SimpleGameMenuData decontructor 572 */ 500 573 SimpleGameMenuData::~SimpleGameMenuData() 501 574 {} … … 503 576 504 577 /** 505 506 578 * initialize the GameWorldDataData 579 */ 507 580 ErrorMessage SimpleGameMenuData::init() 508 581 { … … 513 586 514 587 /** 515 516 517 588 * loads the GUI data 589 * @param root reference to the xml root element 590 */ 518 591 ErrorMessage SimpleGameMenuData::loadGUI(const TiXmlElement* root) 519 592 { … … 524 597 525 598 /** 526 527 599 * unloads the GUI data 600 */ 528 601 ErrorMessage SimpleGameMenuData::unloadGUI() 529 602 { … … 534 607 535 608 /** 536 537 538 609 * overloads the GameWorld::loadWorldEntities(...) class since the menu WorldEntity loading is different (less loading stuff) 610 * @param root reference to the xml root parameter 611 */ 539 612 ErrorMessage SimpleGameMenuData::loadWorldEntities(const TiXmlElement* root) 540 613 { … … 545 618 if( element != NULL) 546 619 { 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 620 element = element->FirstChildElement(); 621 PRINTF(4)("Loading WorldEntities\n"); 622 while(element != NULL) 623 { 624 BaseObject* created = Factory::fabricate(element); 625 if( created != NULL ) 626 printf("Created a %s: %s\n", created->getClassName(), created->getName()); 627 628 if( element->Value() == "SkyBox") 629 this->sky = dynamic_cast<WorldEntity*>(created); 630 if( element->Value() == "Terrain") 631 this->terrain = dynamic_cast<Terrain*>(created); 632 element = element->NextSiblingElement(); 633 } 634 635 PRINTF(4)("Done loading WorldEntities\n"); 563 636 } 564 637 … … 570 643 571 644 /** 572 573 645 * unloads the world entities from the xml file 646 */ 574 647 ErrorMessage SimpleGameMenuData::unloadWorldEntities() 575 648 { … … 580 653 581 654 /** 582 583 584 655 * loads the scene data 656 * @param root reference to the xml root element 657 */ 585 658 ErrorMessage SimpleGameMenuData::loadScene(const TiXmlElement* root) 586 659 { … … 591 664 592 665 /** 593 594 666 * unloads the scene data 667 */ 595 668 ErrorMessage SimpleGameMenuData::unloadScene() 596 669 { -
trunk/src/story_entities/simple_game_menu.h
r7460 r7919 49 49 virtual ~SimpleGameMenu(); 50 50 51 /// TODO TAKE THIS OUT 52 void enterGui(); 53 void execURL() const; 54 static int startURL(void* data); 55 /// 51 56 virtual void loadParams(const TiXmlElement* root); 52 57 … … 60 65 virtual void process(const Event &event); 61 66 67 68 void startLevel(int level); 69 void quitMenu(); 70 71 void TEST() { printf("TEST\n"); } 62 72 63 73 protected: -
trunk/src/world_entities/planet.cc
r7221 r7919 109 109 void Planet::draw() const 110 110 { 111 glMatrixMode(GL_MODELVIEW);112 glPushMatrix();113 114 glShadeModel(GL_SMOOTH);115 116 /* translate */117 glTranslatef (this->getAbsCoor ().x,118 this->getAbsCoor ().y,119 this->getAbsCoor ().z);120 Vector tmpRot = this->getAbsDir().getSpacialAxis();121 glRotatef (this->getAbsDir().getSpacialAxisAngle(), tmpRot.x, tmpRot.y, tmpRot.z );122 123 111 this->material.select(); 124 112 125 // /WorldEntity::draw(); 126 this->getModel(0)->draw(); 127 // static_cast<VertexArrayModel*>(this->getModel(0))->debug(); 128 129 glPopMatrix(); 113 WorldEntity::draw(); 130 114 } 131 115 -
trunk/src/world_entities/skybox.cc
r7840 r7919 227 227 glDisable(GL_LIGHTING); 228 228 229 glPushAttrib(GL_ENABLE_BIT);230 229 glDisable(GL_FOG); 231 230 232 231 WorldEntity::draw(); 233 232 234 glPopAttrib();235 233 glPopAttrib(); 236 234
Note: See TracChangeset
for help on using the changeset viewer.