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
void enableFpsCounter(bool enable = true) { m_calculateFps = enable; };
/// Return the current ticks on this frame
int getCurrentFrameTicks() const { return m_lastFrameTicks; }
private:

View File

@ -36,13 +36,19 @@ public:
GameState() { }
virtual ~GameState() { }
/// Fired when enter the state
virtual void onEnter() = 0;
/// Fired when leaves the state
virtual void onLeave() = 0;
/// Fired when user tryes to close the window
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;
/// Fired when main window is resized
virtual void onResize(const Size& size) = 0;
/// Fired before redering the UI
virtual void render() = 0;
};

View File

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

View File

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

View File

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

View File

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

View File

@ -29,25 +29,27 @@
#include <ui/uiconstants.h>
#include <ui/uicontainer.h>
namespace UILoader
class UILoader
{
/// Detect element type and create it
UIElementPtr createElementFromId(const std::string& id);
public:
/// 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
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
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
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
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