refactoring paths and includes

master
Eduardo Bart 13 years ago
parent 792d661dad
commit 1f78f93096

@ -35,7 +35,8 @@ INCLUDE_DIRECTORIES(
${YAMLCPP_INCLUDE_DIRS}
${PHYSFS_INCLUDE_DIRS}
${GMP_INCLUDE_DIR}
${PNG_INCLUDE_DIRS})
${PNG_INCLUDE_DIRS}
"${CMAKE_CURRENT_SOURCE_DIR}/src/framework")
LINK_DIRECTORIES(
${Boost_LIBRARY_DIRS}
@ -55,30 +56,34 @@ SET(SOURCES
# game sources
src/main.cpp
src/menustate.cpp
src/mainmenu.cpp
src/teststate.cpp
# game net
src/net/protocoltibia87.cpp
# framework sources
src/framework/image.cpp
src/framework/borderedimage.cpp
src/framework/dispatcher.cpp
src/framework/framebuffer.cpp
src/framework/font.cpp
src/framework/fonts.cpp
src/framework/textureloader.cpp
src/framework/texture.cpp
src/framework/textures.cpp
src/framework/configs.cpp
src/framework/resources.cpp
src/framework/engine.cpp
src/framework/graphics.cpp
src/framework/logger.cpp
src/framework/util.cpp
# ui
# framework core
src/framework/core/dispatcher.cpp
src/framework/core/configs.cpp
src/framework/core/resources.cpp
src/framework/core/engine.cpp
# framework utilities
src/framework/util/util.cpp
src/framework/util/logger.cpp
src/framework/util/rsa.cpp
# framework graphics
src/framework/graphics/image.cpp
src/framework/graphics/borderedimage.cpp
src/framework/graphics/framebuffer.cpp
src/framework/graphics/font.cpp
src/framework/graphics/fonts.cpp
src/framework/graphics/textureloader.cpp
src/framework/graphics/texture.cpp
src/framework/graphics/textures.cpp
src/framework/graphics/graphics.cpp
# framework ui
src/framework/ui/anchorlayout.cpp
src/framework/ui/uielement.cpp
src/framework/ui/uielementskin.cpp
@ -93,21 +98,19 @@ SET(SOURCES
src/framework/ui/uitextedit.cpp
src/framework/ui/uitexteditskin.cpp
# network
# framework net
src/framework/net/connection.cpp
src/framework/net/connections.cpp
src/framework/net/protocol.cpp
src/framework/net/networkmessage.cpp
# util
src/framework/util/rsa.cpp)
)
IF(WIN32)
SET(SOURCES ${SOURCES} src/framework/win32platform.cpp)
SET(SOURCES ${SOURCES} src/framework/platform/win32platform.cpp)
SET(ADDITIONAL_LIBRARIES ws2_32)
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501)
ELSE(WIN32)
SET(SOURCES ${SOURCES} src/framework/x11platform.cpp)
SET(SOURCES ${SOURCES} src/framework/platform/x11platform.cpp)
SET(ADDITIONAL_LIBRARIES pthread GLU)
ENDIF(WIN32)

@ -50,9 +50,13 @@ class Dispatcher
public:
Dispatcher() { }
/// Execute scheduled events
void poll(int ticks);
/// Add an event
void addTask(const Callback& callback);
/// Schedula an event
void scheduleTask(const Callback& callback, int delay);
private:

@ -23,12 +23,10 @@
#include "engine.h"
#include "fonts.h"
#include "graphics/fonts.h"
#include "platform.h"
#include "graphics.h"
#include "input.h"
#include "graphics/graphics.h"
#include "configs.h"
#include "gamestate.h"
#include "dispatcher.h"
#include "net/connections.h"
#include "ui/uicontainer.h"

@ -26,11 +26,7 @@
#define ENGINE_H
#include "prerequisites.h"
#include "size.h"
struct InputEvent;
class GameState;
#include "gamestate.h"
class Engine
{

@ -25,8 +25,8 @@
#ifndef GAMESTATE_H
#define GAMESTATE_H
#include "prerequisites.h"
#include "input.h"
#include "size.h"
struct InputEvent;

@ -190,7 +190,9 @@ enum EEvent {
EV_MOUSE_MOVE
};
struct KeyEvent {
struct InputEvent {
EEvent type;
Point mousePos;
char keychar;
uchar keycode;
bool ctrl;
@ -198,16 +200,4 @@ struct KeyEvent {
bool alt;
};
struct MouseEvent {
int x, y;
};
struct InputEvent {
EEvent type;
union {
KeyEvent key;
MouseEvent mouse;
};
};
#endif // INPUT_H

@ -27,7 +27,6 @@
#include "prerequisites.h"
#include "image.h"
#include "rect.h"
#include "texture.h"
class BorderedImage : public Image

@ -23,7 +23,7 @@
#include "font.h"
#include "resources.h"
#include "core/resources.h"
#include "textures.h"
#include "graphics.h"

@ -26,9 +26,7 @@
#define FONT_H
#include "prerequisites.h"
#include "color.h"
#include "texture.h"
#include "rect.h"
enum EAlign {
ALIGN_TOP = 1 << 0,

@ -24,7 +24,7 @@
#include "fonts.h"
#include "font.h"
#include "resources.h"
#include "core/resources.h"
Fonts g_fonts;
Font *g_defaultFont = NULL;

@ -22,7 +22,7 @@
*/
#include "framebuffer.h"
#include "platform.h"
#include "core/platform.h"
#include "graphics.h"
#include <GL/gl.h>

@ -23,7 +23,6 @@
#include "graphics.h"
#include "logger.h"
#include "texture.h"
#include <GL/gl.h>

@ -26,9 +26,6 @@
#define GRAPHICS_H
#include "prerequisites.h"
#include "rect.h"
#include "size.h"
#include "color.h"
class Texture;

@ -27,7 +27,6 @@
#include "prerequisites.h"
#include "texture.h"
#include "rect.h"
class Image
{

@ -26,7 +26,6 @@
#define TEXTURE_H
#include "prerequisites.h"
#include "size.h"
class Textures;
@ -40,10 +39,14 @@ public:
/// Enable texture bilinear filter (smooth scaled textures)
void enableBilinearFilter();
const Size& getSize() const { return m_size; }
/// Get OpenGL texture id
uint getTextureId() const { return m_textureId; }
/// Copy pixels from OpenGL texture
uchar *getPixels();
const Size& getSize() const { return m_size; }
private:
uint m_textureId;
Size m_size;

@ -23,7 +23,7 @@
#include "textures.h"
#include "resources.h"
#include "core/resources.h"
#include "textureloader.h"
Textures g_textures;

@ -39,7 +39,7 @@ public:
TexturePtr get(const std::string& textureFile);
private:
typedef std::map<std::string, TextureWeakPtr > TexturesMap;
typedef std::map<std::string, TextureWeakPtr> TexturesMap;
TexturesMap m_texturesMap;
};

@ -24,7 +24,7 @@
#ifndef CONNECTION_H
#define CONNECTION_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include <boost/asio.hpp>

@ -24,7 +24,7 @@
#ifndef CONNECTIONS_H
#define CONNECTIONS_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "connection.h"

@ -24,7 +24,7 @@
#ifndef NETWORKMESSAGE_H
#define NETWORKMESSAGE_H
#include "../prerequisites.h"
#include "prerequisites.h"
class Rsa;

@ -24,7 +24,7 @@
#ifndef PROTOCOL_H
#define PROTOCOL_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "connection.h"
class Protocol

@ -23,7 +23,6 @@
#include "platform.h"
#include "engine.h"
#include "size.h"
#include <dir.h>
#include <physfs.h>

@ -22,11 +22,8 @@
*/
#include "platform.h"
#include "engine.h"
#include "input.h"
#include "logger.h"
#include "size.h"
#include "core/platform.h"
#include "core/engine.h"
#include <sys/time.h>
#include <sys/stat.h>
@ -327,12 +324,12 @@ void Platform::poll()
char buf[32];
int len;
inputEvent.key.ctrl = (event.xkey.state & ControlMask);
inputEvent.key.shift = (event.xkey.state & ShiftMask);
inputEvent.key.alt = (event.xkey.state & Mod1Mask);
inputEvent.ctrl = (event.xkey.state & ControlMask);
inputEvent.shift = (event.xkey.state & ShiftMask);
inputEvent.alt = (event.xkey.state & Mod1Mask);
// fire enter text event
if(event.type == KeyPress && !inputEvent.key.ctrl && !inputEvent.key.alt) {
if(event.type == KeyPress && !inputEvent.ctrl && !inputEvent.alt) {
if(x11.xic) { // with xim we can get latin1 input correctly
Status status;
len = XmbLookupString(x11.xic, &event.xkey, buf, sizeof(buf), &keysym, &status);
@ -349,8 +346,8 @@ void Platform::poll()
) {
//logDebug("char: %c code: %d", buf[0], (uchar)buf[0]);
inputEvent.type = EV_TEXT_ENTER;
inputEvent.key.keychar = buf[0];
inputEvent.key.keycode = KC_UNKNOWN;
inputEvent.keychar = buf[0];
inputEvent.keycode = KC_UNKNOWN;
g_engine.onInputEvent(inputEvent);
}
}
@ -361,9 +358,9 @@ void Platform::poll()
// fire key up/down event
if(x11.keyMap.find(keysym) != x11.keyMap.end()) {
inputEvent.key.keycode = x11.keyMap[keysym];
inputEvent.keycode = x11.keyMap[keysym];
inputEvent.type = (event.type == KeyPress) ? EV_KEY_DOWN : EV_KEY_UP;
inputEvent.key.keychar = (len > 0) ? buf[0] : 0;
inputEvent.keychar = (len > 0) ? buf[0] : 0;
g_engine.onInputEvent(inputEvent);
}
break;
@ -392,8 +389,7 @@ void Platform::poll()
case MotionNotify:
inputEvent.type = EV_MOUSE_MOVE;
inputEvent.mouse.x = event.xbutton.x;
inputEvent.mouse.y = event.xbutton.y;
inputEvent.mousePos = Point(event.xbutton.x, event.xbutton.y);
g_engine.onInputEvent(inputEvent);
break;

@ -69,10 +69,12 @@ typedef int8_t int8;
// yaml
#include <yaml-cpp/yaml.h>
// internal logger
#include "logger.h"
// additional utilities
#include "util.h"
// common utilities
#include "util/util.h"
#include "util/logger.h"
#include "util/color.h"
#include "util/point.h"
#include "util/size.h"
#include "util/rect.h"
#endif // PREREQUISITES_H

@ -25,8 +25,7 @@
#ifndef ANCHORLAYOUT_H
#define ANCHORLAYOUT_H
#include "../prerequisites.h"
#include "../rect.h"
#include "prerequisites.h"
#include "uiconstants.h"
enum EAnchorType {

@ -25,7 +25,7 @@
#ifndef UI_H
#define UI_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uiconstants.h"
#include "uielement.h"

@ -23,8 +23,8 @@
#include "uibutton.h"
#include "../fonts.h"
#include "../font.h"
#include "graphics/fonts.h"
#include "graphics/font.h"
void UIButton::load(const YAML::Node& node)
{
@ -42,11 +42,11 @@ void UIButton::render()
bool UIButton::onInputEvent(const InputEvent& event)
{
if(event.type == EV_MOUSE_LDOWN &&
getRect().contains(Point(event.mouse.x, event.mouse.y))) {
getRect().contains(event.mousePos)) {
m_state = UI::ButtonDown;
} else if(m_state == UI::ButtonDown && event.type == EV_MOUSE_LUP) {
m_state = UI::ButtonUp;
if(getRect().contains(Point(event.mouse.x, event.mouse.y))) {
if(getRect().contains(event.mousePos)) {
if(m_buttonClickCallback)
m_buttonClickCallback();
}

@ -25,9 +25,9 @@
#ifndef UIBUTTON_H
#define UIBUTTON_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uielement.h"
#include "../borderedimage.h"
#include "graphics/borderedimage.h"
typedef std::function<void()> Callback;

@ -25,7 +25,7 @@
#ifndef UIBUTTONSKIN_H
#define UIBUTTONSKIN_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uiconstants.h"
#include "uielementskin.h"

@ -23,7 +23,7 @@
#include "uicontainer.h"
#include "../resources.h"
#include "core/resources.h"
#include "uibutton.h"
#include "uipanel.h"
#include "uilabel.h"

@ -25,11 +25,8 @@
#ifndef UICONTAINER_H
#define UICONTAINER_H
//TODO: make includes paths, so this will be cleaner
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uielement.h"
#include "../point.h"
#include "../rect.h"
class UIContainer : public UIElement
{

@ -25,9 +25,8 @@
#ifndef UIELEMENT_H
#define UIELEMENT_H
#include "../prerequisites.h"
#include "../input.h"
#include "../rect.h"
#include "prerequisites.h"
#include "core/input.h"
#include "uiconstants.h"
#include "anchorlayout.h"

@ -24,8 +24,8 @@
#include "uielementskin.h"
#include "uielement.h"
#include "../borderedimage.h"
#include "../textures.h"
#include "graphics/borderedimage.h"
#include "graphics/textures.h"
#include "uiskins.h"
void UIElementSkin::draw(UIElement *element)

@ -25,10 +25,9 @@
#ifndef UIELEMENTSKIN_H
#define UIELEMENTSKIN_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uiconstants.h"
#include "../image.h"
#include "../rect.h"
#include "graphics/image.h"
class UIElement;

@ -23,7 +23,7 @@
#include "uilabel.h"
#include "../fonts.h"
#include "graphics/fonts.h"
UILabel::UILabel(const std::string& text, Font* font) :
UIElement(UI::Label),

@ -25,7 +25,7 @@
#ifndef UILABEL_H
#define UILABEL_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uielement.h"
class Font;

@ -25,9 +25,9 @@
#ifndef UIPANEL_H
#define UIPANEL_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uicontainer.h"
#include "../borderedimage.h"
#include "graphics/borderedimage.h"
class UIPanel : public UIContainer
{

@ -23,8 +23,8 @@
#include "uiskins.h"
#include "../resources.h"
#include "../textures.h"
#include "core/resources.h"
#include "graphics/textures.h"
#include "uielementskin.h"
#include "uibuttonskin.h"
#include "uiwindowskin.h"

@ -25,9 +25,9 @@
#ifndef UISKIN_H
#define UISKIN_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uicontainer.h"
#include "../texture.h"
#include "graphics/texture.h"
class UIElementSkin;

@ -23,7 +23,7 @@
#include "uitextedit.h"
#include "../fonts.h"
#include "graphics/fonts.h"
UITextEdit::UITextEdit(Font* font) :
UIElement(UI::TextEdit),

@ -25,7 +25,7 @@
#ifndef UITEXTEDIT_H
#define UITEXTEDIT_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uielement.h"
class Font;

@ -25,7 +25,7 @@
#ifndef UITEXTEDITSKIN_H
#define UITEXTEDITSKIN_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uiconstants.h"
#include "uielementskin.h"

@ -25,7 +25,7 @@
#ifndef UIWINDOW_H
#define UIWINDOW_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uicontainer.h"
class UIWindow : public UIContainer

@ -23,7 +23,7 @@
#include "uiwindowskin.h"
#include "uiwindow.h"
#include "../fonts.h"
#include "graphics/fonts.h"
void UIWindowSkin::draw(UIElement* element)
{

@ -24,10 +24,10 @@
#ifndef UIWINDOWSKIN_H
#define UIWINDOWSKIN_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include "uiconstants.h"
#include "uielementskin.h"
#include "../font.h"
#include "graphics/font.h"
class UIWindowSkin : public UIElementSkin
{

@ -26,8 +26,6 @@
#define RECT_H
#include "prerequisites.h"
#include "point.h"
#include "size.h"
template <class T>
class TPoint;

@ -24,7 +24,7 @@
#ifndef RSA_H
#define RSA_H
#include "../prerequisites.h"
#include "prerequisites.h"
#include <gmp.h>

@ -22,14 +22,14 @@
*/
#include "framework/engine.h"
#include "framework/configs.h"
#include "framework/resources.h"
#include "framework/platform.h"
#include "core/engine.h"
#include "core/configs.h"
#include "core/resources.h"
#include "core/platform.h"
#include "core/dispatcher.h"
#include "menustate.h"
#include "teststate.h"
#include "framework/dispatcher.h"
#include "framework/ui/uiskins.h"
#include "ui/uiskins.h"
/// Catches signals so we can exit nicely
void signal_handler(int sig)

@ -23,18 +23,15 @@
#include "menustate.h"
#include "framework/framebuffer.h"
#include "framework/graphics.h"
#include "framework/textures.h"
#include "framework/logger.h"
#include "framework/engine.h"
#include "framework/rect.h"
#include "framework/fonts.h"
#include "framework/input.h"
#include "framework/dispatcher.h"
#include "framework/ui/ui.h"
#include "framework/net/connections.h"
#include "framework/borderedimage.h"
#include "graphics/framebuffer.h"
#include "graphics/graphics.h"
#include "graphics/textures.h"
#include "core/engine.h"
#include "graphics/fonts.h"
#include "core/dispatcher.h"
#include "ui/ui.h"
#include "net/connections.h"
#include "graphics/borderedimage.h"
void MenuState::onEnter()

@ -25,10 +25,10 @@
#ifndef MENUSTATE_H
#define MENUSTATE_H
#include "framework/gamestate.h"
#include "framework/texture.h"
#include "framework/net/connection.h"
#include "framework/ui/uipanel.h"
#include "core/gamestate.h"
#include "graphics/texture.h"
#include "net/connection.h"
#include "ui/uipanel.h"
class MenuState : public GameState
{

@ -22,7 +22,7 @@
*/
#include "protocoltibia87.h"
#include "../framework/util/rsa.h"
#include "util/rsa.h"
const char* ProtocolTibia87::rsa = "4673033022358411862216018001503683214873298680851934467521055526294025873980576"
"6860224610646919605860206328024326703361630109888417839241959507572247284807035"

@ -24,8 +24,8 @@
#ifndef PROTOCOLTIBIA87_H
#define PROTOCOLTIBIA87_H
#include "../framework/prerequisites.h"
#include "../framework/net/protocol.h"
#include "prerequisites.h"
#include "net/protocol.h"
class ProtocolTibia87 : public Protocol
{

@ -23,13 +23,9 @@
#include "teststate.h"
#include "framework/graphics.h"
#include "framework/logger.h"
#include "framework/engine.h"
#include "framework/input.h"
#include "framework/net/connections.h"
#include "graphics/graphics.h"
#include "core/engine.h"
#include "net/connections.h"
#include "net/protocoltibia87.h"
void TestState::onEnter()

@ -25,7 +25,7 @@
#ifndef TESTSTATE_H
#define TESTSTATE_H
#include "framework/gamestate.h"
#include "core/gamestate.h"
#include "net/protocoltibia87.h"
class TestState : public GameState

Loading…
Cancel
Save