This commit is contained in:
Eduardo Bart 2011-04-17 17:09:37 -03:00
parent 9b22a6e0a6
commit f2c187c810
8 changed files with 1773 additions and 42 deletions

1716
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

View File

@ -61,6 +61,7 @@ public:
/// Enable FPS counter on screen /// Enable FPS counter on screen
void enableFpsCounter(bool enable = true) { m_calculateFps = enable; }; void enableFpsCounter(bool enable = true) { m_calculateFps = enable; };
/// Return the current ticks on this frame
int getCurrentFrameTicks() const { return m_lastFrameTicks; } int getCurrentFrameTicks() const { return m_lastFrameTicks; }
private: private:

View File

@ -36,13 +36,19 @@ public:
GameState() { } GameState() { }
virtual ~GameState() { } virtual ~GameState() { }
/// Fired when enter the state
virtual void onEnter() = 0; virtual void onEnter() = 0;
/// Fired when leaves the state
virtual void onLeave() = 0; virtual void onLeave() = 0;
/// Fired when user tryes to close the window
virtual void onClose() = 0; virtual void onClose() = 0;
/// Fired for every user input event, this is called before processing UI input and if it returns false the input is not passed to the UI
virtual bool onInputEvent(const InputEvent& event) = 0; virtual bool onInputEvent(const InputEvent& event) = 0;
/// Fired when main window is resized
virtual void onResize(const Size& size) = 0; virtual void onResize(const Size& size) = 0;
/// Fired before redering the UI
virtual void render() = 0; virtual void render() = 0;
}; };

View File

@ -27,52 +27,53 @@
#include <prerequisites.h> #include <prerequisites.h>
namespace Platform class Platform
{ {
void init(const char *appName); public:
void terminate(); static void init(const char *appName);
static void terminate();
/// Poll platform input/window events /// Poll platform input/window events
void poll(); static void poll();
/// Get current time in milliseconds since init /// Get current time in milliseconds since init
int getTicks(); static int getTicks();
/// Sleep in current thread /// Sleep in current thread
void sleep(ulong miliseconds); static void sleep(ulong miliseconds);
bool createWindow(int x, int y, int width, int height, int minWidth, int minHeight, bool maximized); static bool createWindow(int x, int y, int width, int height, int minWidth, int minHeight, bool maximized);
void destroyWindow(); static void destroyWindow();
void showWindow(); static void showWindow();
void setWindowTitle(const char *title); static void setWindowTitle(const char *title);
bool isWindowFocused(); static bool isWindowFocused();
bool isWindowVisible(); static bool isWindowVisible();
int getWindowX(); static int getWindowX();
int getWindowY(); static int getWindowY();
int getWindowWidth(); static int getWindowWidth();
int getWindowHeight(); static int getWindowHeight();
bool isWindowMaximized(); static bool isWindowMaximized();
int getDisplayHeight(); static int getDisplayHeight();
int getDisplayWidth(); static int getDisplayWidth();
/// Get GL extension function address /// Get GL extension function address
void *getExtensionProcAddress(const char *ext); static void *getExtensionProcAddress(const char *ext);
/// Check if GL extension is supported /// Check if GL extension is supported
bool isExtensionSupported(const char *ext); static bool isExtensionSupported(const char *ext);
const char *getClipboardText(); static const char *getClipboardText();
void setClipboardText(const char *text); static void setClipboardText(const char *text);
void hideMouseCursor(); static void hideMouseCursor();
void showMouseCursor(); static void showMouseCursor();
/// Enable/disable vertical synchronization /// Enable/disable vertical synchronization
void setVsync(bool enable = true); static void setVsync(bool enable = true);
/// Swap GL buffers /// Swap GL buffers
void swapBuffers(); static void swapBuffers();
/// Get the app user directory, the place to save files configurations files /// Get the app user directory, the place to save files configurations files
std::string getAppUserDir(); static std::string getAppUserDir();
} };
#endif // PLATFORM_H #endif // PLATFORM_H

View File

@ -29,10 +29,11 @@
class Texture; class Texture;
namespace TextureLoader class TextureLoader
{ {
public:
/// Load a png textures using libpng /// Load a png textures using libpng
Texture *loadPNG(uchar *fileData); static Texture *loadPNG(uchar *fileData);
} };
#endif // TEXTURELOADER_H #endif // TEXTURELOADER_H

View File

@ -26,8 +26,9 @@
#define UICHECKBOXSKIN_H #define UICHECKBOXSKIN_H
#include <prerequisites.h> #include <prerequisites.h>
#include <ui/uielementskin.h>
class UICheckBoxSkin class UICheckBoxSkin : public UIElementSkin
{ {
}; };

View File

@ -39,8 +39,11 @@ public:
m_elementType(elementType) { } m_elementType(elementType) { }
virtual ~UIElementSkin() { } virtual ~UIElementSkin() { }
/// Load the skin from a YAML node
virtual void load(const YAML::Node& node); virtual void load(const YAML::Node& node);
/// Apply the skin to an element
virtual void apply(UIElement *element); virtual void apply(UIElement *element);
/// Draw the skinned element
virtual void draw(UIElement *element); virtual void draw(UIElement *element);
const std::string& getName() const { return m_name; } const std::string& getName() const { return m_name; }

View File

@ -29,25 +29,27 @@
#include <ui/uiconstants.h> #include <ui/uiconstants.h>
#include <ui/uicontainer.h> #include <ui/uicontainer.h>
namespace UILoader class UILoader
{ {
/// Detect element type and create it public:
UIElementPtr createElementFromId(const std::string& id);
/// Loads an UIElement and it's children from a YAML file /// Loads an UIElement and it's children from a YAML file
UIElementPtr loadFile(const std::string& file, const UIContainerPtr& parent = UIContainer::getRootContainer()); static UIElementPtr loadFile(const std::string& file, const UIContainerPtr& parent = UIContainer::getRootContainer());
private:
/// Detect element type and create it
static UIElementPtr createElementFromId(const std::string& id);
/// Populate container children from a YAML node /// Populate container children from a YAML node
void populateContainer(const UIContainerPtr& parent, const YAML::Node& node); static void populateContainer(const UIContainerPtr& parent, const YAML::Node& node);
/// Load element and its children from a YAML node /// Load element and its children from a YAML node
void loadElements(const UIElementPtr& parent, const YAML::Node& node); static void loadElements(const UIElementPtr& parent, const YAML::Node& node);
/// Load element proprieties from a YAML node /// Load element proprieties from a YAML node
void loadElement(const UIElementPtr& element, const YAML::Node& node); static void loadElement(const UIElementPtr& element, const YAML::Node& node);
/// Load anchor from a YAML node /// Load anchor from a YAML node
void loadElementAnchor(const UIElementPtr& element, EAnchorType type, const YAML::Node& node); static void loadElementAnchor(const UIElementPtr& element, EAnchorType type, const YAML::Node& node);
}; };
#endif // UILOADER_H #endif // UILOADER_H