Roguelike
 All Classes Namespaces Functions Variables Typedefs Friends Pages
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
GUI Class Reference
Inheritance diagram for GUI:
VirtualEvent

Public Member Functions

 GUI ()
 
int OnExecute ()
 
void OnRender ()
 
void OnLoop ()
 
void OnCleanup ()
 
bool OnInit ()
 
void OnEvent (SDL_Event *Event)
 
void OnKeyDown (SDLKey sym, SDLMod mod, Uint16 unicode)
 
void OnExit ()
 
void perform_action_press (SDLKey)
 
void perform_action_cont ()
 
void add_key_input (SDLKey key, Uint16 unicode)
 
- Public Member Functions inherited from VirtualEvent
 VirtualEvent ()
 
virtual void OnInputFocus ()
 
virtual void OnInputBlur ()
 
virtual void OnKeyUp (SDLKey sym, SDLMod mod, Uint16 unicode)
 
virtual void OnMouseFocus ()
 
virtual void OnMouseBlur ()
 
virtual void OnMouseMove (int mX, int mY, int relX, int relY, bool Left, bool Right, bool Middle)
 
virtual void OnMouseWheel (bool Up, bool Down)
 
virtual void OnLButtonDown (int mX, int mY)
 
virtual void OnLButtonUp (int mX, int mY)
 
virtual void OnRButtonDown (int mX, int mY)
 
virtual void OnRButtonUp (int mX, int mY)
 
virtual void OnMButtonDown (int mX, int mY)
 
virtual void OnMButtonUp (int mX, int mY)
 
virtual void OnJoyAxis (Uint8 which, Uint8 axis, Sint16 value)
 
virtual void OnJoyButtonDown (Uint8 which, Uint8 button)
 
virtual void OnJoyButtonUp (Uint8 which, Uint8 button)
 
virtual void OnJoyHat (Uint8 which, Uint8 hat, Uint8 value)
 
virtual void OnJoyBall (Uint8 which, Uint8 ball, Sint16 xrel, Sint16 yrel)
 
virtual void OnMinimize ()
 
virtual void OnRestore ()
 
virtual void OnResize (int w, int h)
 
virtual void OnExpose ()
 
virtual void OnUser (Uint8 type, int code, void *data1, void *data2)
 

Private Types

typedef std::vector
< std::vector< Tile * > > 
TilePointerMatrix
 
typedef std::vector
< std::vector< Tile > > 
TileMatrix
 

Private Member Functions

void load_font (string)
 
int handle_framerate ()
 
void clear_screen ()
 
void render_canvas ()
 
void render_enemies ()
 
void render_character ()
 
void render_interface ()
 
void render_menu (Menu *menu)
 
void render_debug ()
 
void render_target ()
 
void render_animations ()
 
void clear_area (IntPoint start, IntPoint size)
 
int render_stats (Character *chara, int height)
 

Private Attributes

pt::ptime game_clock
 
bool running
 
std::vector< std::string > messages
 
std::string input
 
DebugConsole debug
 
KeyState keyset
 
Screen current_screen
 
Screen last_screen
 
WorldMapGUI world_map_gui
 
Menumenu
 
Game game
 
SDL_Event event
 
SDL_Surface * screen
 
SDL_Surface * asciiBase
 
SDL_Surface * ascii
 

Static Private Attributes

static const long STD_MS_PER_FRAME = 70
 

Constructor & Destructor Documentation

GUI::GUI ( )

GUI.CPP

This file is part of ROGUELIKETHING.

ROGUELIKETHING is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

ROGUELIKETHING is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROGUELIKETHING. If not, see http://www.gnu.org/licenses/.

Member Function Documentation

void GUI::add_key_input ( SDLKey  key,
Uint16  unicode 
)

The function for handling keyboard input for typing text. This function handles text input, as opposed to the player hitting keys to play the game.

Parameters
unicodeThe key pressed.
void GUI::OnCleanup ( )

GUI_CLEANUP.CPP

This file is part of ROGUELIKETHING.

ROGUELIKETHING is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

ROGUELIKETHING is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROGUELIKETHING. If not, see http://www.gnu.org/licenses/.

void GUI::OnEvent ( SDL_Event *  Event)
virtual
Todo:

find a better way to do key input; currently we're using polling, which feels really weird if you press a key in-between frames.

Clean this up so it's actually readable code.

Reimplemented from VirtualEvent.

bool GUI::OnInit ( )

GUI_INIT.CPP

This file is part of ROGUELIKETHING.

ROGUELIKETHING is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

ROGUELIKETHING is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROGUELIKETHING. If not, see http://www.gnu.org/licenses/.

void GUI::OnLoop ( )

GUI_LOOP.CPP

This file is part of ROGUELIKETHING.

ROGUELIKETHING is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

ROGUELIKETHING is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROGUELIKETHING. If not, see http://www.gnu.org/licenses/.

void GUI::OnRender ( )

GUI_RENDER.CPP

This file is part of ROGUELIKETHING.

ROGUELIKETHING is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

ROGUELIKETHING is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with ROGUELIKETHING. If not, see http://www.gnu.org/licenses/.

void GUI::perform_action_press ( SDLKey  key)

There is possibly a better place for these functions, but they used to be in MainCharacter, and it seems weird for the main character to know about SDL. I'm moving more to a top-down structure, where the GUI classes control the canvas and key handling, which in turn control the main character.

On the flip side, it seems weird for the GUI to know about the main character, but I would err on the side of top-down instead of bottom-up control. Perhaps in the future there will be an intermediate class. Actually, there really should be.

-SAY 12/21/2013 The problem that I'm finding with this model is that we don't have any functionality in the character...all of the processing has been handed to the GUI classes. What I'm thinking should happen is the GUI calls functions in the character with the appropriate values being passed. That way, the gui isn't doing processing that should really belong to the character. But, then the problem with that is character doesn't know anything about the chunk...which leads me to think that the GUI should pass functions to the canvas, which will handle the processing by calling appropriate functions in the classes. -MJY 12/22/2013...holy balls, Christmas is 3 days away...


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