Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
WindowManager Class Reference

#include <window.h>

Public Member Functions

void draw ()
 
void shutDown (void)
 

Protected Member Functions

void openWindow (Window *w)
 
void closeWindow (Window *w, bool deleteWindow=true)
 

Protected Attributes

std::vector< Window * > m_windows
 

Friends

class Window
 

Detailed Description

Definition at line 161 of file window.h.

Member Function Documentation

void WindowManager::closeWindow ( Window w,
bool  deleteWindow = true 
)
protected

Definition at line 233 of file window.cpp.

References EventManager::addToDeleteQueue(), globalEventManager(), m_windows, and EventManager::removeResponder().

Referenced by Window::processCommand().

236 {
237  vector< Window* >::iterator iter;
238  for (iter = m_windows.begin(); iter != m_windows.end(); iter++)
239  if ( (*iter) == w ) {
240  m_windows.erase( iter );
241  globalEventManager().removeResponder( w ); //Have to do this now.
242  if (deleteWindow)
244  break;
245  }
246 }
void WindowManager::draw ( void  )

Definition at line 173 of file window.cpp.

References BILINEAR, ConditionalCursorDraw(), CULLFACE, DEPTHTEST, DEPTHWRITE, VSSprite::Draw(), VSSprite::GetPosition(), VSSprite::GetSize(), GFXBlendMode(), GFXClear(), GFXColorf(), GFXDisable(), GFXEnable(), GFXHudMode(), GFXTRUE, globalEventManager(), GUI_OPAQUE_WHITE(), i, INVSRCALPHA, LIGHTING, m_windows, Texture::MakeActive(), EventManager::mouseLoc(), NEAREST, VSSprite::SetPosition(), SRCALPHA, TEXTURE0, TEXTURE1, TEXTURE2D, TEXTURE_2D, Point::x, and Point::y.

Referenced by gamemenu_draw(), nav_main_loop(), and RefreshGUI().

174 {
175  GFXHudMode( true ); //Load identity matrices.
177 
180  GFXDisable( LIGHTING );
181  GFXDisable( CULLFACE );
182  GFXClear( GFXTRUE );
185  GFXDisable( TEXTURE1 );
186  GFXEnable( TEXTURE0 );
187  //Just loop through all the windows, and remember if anything gets drawn.
188  //Since the first window in the list is drawn first, z-order is
189  //maintained. First entry is the bottom window, last is the top window.
190  //FIXME mbyron -- I think the event manager needs to get involved with window z-order.
191  //(Mouse events should go to windows in zorder, shouldn't they?)
192  for (size_t i = 0; i < m_windows.size(); i++) {
193  if ( m_windows[i]->controller() )
194  m_windows[i]->controller()->draw();
195  if ( i < m_windows.size() ) m_windows[i]->draw();
196  }
197  //Emulate EndGUIFrame.
198  static VSSprite MouseVSSprite( "mouse.spr", BILINEAR, GFXTRUE );
199  static Texture dummy( "white.bmp", 0, NEAREST, TEXTURE2D, TEXTURE_2D, GFXTRUE );
200  GFXDisable( CULLFACE );
201  ConditionalCursorDraw( true );
202  //Figure position of cursor sprite.
203  float sizex = 0.0, sizey = 0.0;
204  const Point loc = globalEventManager().mouseLoc();
205  MouseVSSprite.GetSize( sizex, sizey );
206  float tempx = 0.0, tempy = 0.0;
207  MouseVSSprite.GetPosition( tempx, tempy );
208  MouseVSSprite.SetPosition( tempx+loc.x+sizex/2, tempy+loc.y+sizey/2 );
209 
210  dummy.MakeActive();
213 
214  //Draw the cursor sprite.
215  GFXEnable( TEXTURE0 );
217  GFXDisable( TEXTURE1 );
218  MouseVSSprite.Draw();
219 
220  GFXHudMode( false );
221  GFXEnable( CULLFACE );
222  MouseVSSprite.SetPosition( tempx, tempy );
223 }
void WindowManager::openWindow ( Window w)
protected

Definition at line 226 of file window.cpp.

References globalEventManager(), m_windows, and EventManager::pushResponder().

Referenced by Window::open().

227 {
228  m_windows.push_back( w );
230 }
void WindowManager::shutDown ( void  )

Definition at line 249 of file window.cpp.

References m_windows.

Referenced by BaseComputer::actionConfirmedLoadGame(), BaseComputer::draw(), NetActionConfirm::finalizeJoinGame(), UniverseUtil::loadGame(), and GameMenu::processSinglePlayerButton().

250 {
251  while (m_windows.size() > 0)
252  m_windows.back()->close();
253  //m_windows.erase(m_windows.begin());
254 }

Friends And Related Function Documentation

friend class Window
friend

Definition at line 164 of file window.h.

Member Data Documentation

std::vector< Window* > WindowManager::m_windows
protected

Definition at line 179 of file window.h.

Referenced by closeWindow(), draw(), openWindow(), and shutDown().


The documentation for this class was generated from the following files: