Skip to content

Commit

Permalink
More public API cleanup and new features
Browse files Browse the repository at this point in the history
A few doxygen doc modifications.
Adjusted platformer demo logic a little more.
Most if not all object type id's are now constructed on first call.
Tilemap scene layer can now store properties.
  • Loading branch information
gamaral committed Mar 25, 2012
1 parent c0d6eb3 commit 450fdfd
Show file tree
Hide file tree
Showing 67 changed files with 693 additions and 633 deletions.
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ WARN_LOGFILE =
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.

INPUT = src/
INPUT = include/

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
Expand Down
2 changes: 1 addition & 1 deletion demos/platformer/assets/platformer.tmx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
</layer>
<layer name="clouds" width="80" height="20" opacity="0.75">
<properties>
<property name="scale" value="2"/>
<property name="scale" value="2" />
</properties>
<data encoding="base64" compression="zlib">
eJztV0kSwzAI43tt+oEu+f83wiUXz5CIWNjQVjPcXLFIuM4iIg/5DTw1XhpvjY/G2sF107gTuHaeRWJ1GJUHxa5FC2+dXk2vzoHpHQ+i5+GFxc/yF8qDnpulmxesOlGe7HPJdl9VQ6S+M7TJ7gdPfb3aWLmOasi+7xH1WfOwckXpUhWjPYPmY8yZ/c6ohLM5Iz1XfWe0vUXUE93zTE+2vVXEKE9+492BwNM3482C5GOdYf7OgsefDC8jHKwzV/P/URveHYm4O3s5M/3vnu1IxE71cmb8vtoAMlBm9A==
Expand Down
20 changes: 11 additions & 9 deletions demos/platformer/inputcomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ InputComponent::update(float d)
}
else m_movement->acceleration()[0] = 0;

/* only jump if on platform */
if (m_jump && m_boost_fuel > 0) {
m_boost_fuel -= d;
m_movement->velocity()[1] += JUMP_MAX * (d / BOOST_MAX);
}
else if (m_jump && m_collider->onPlatform()) {
m_movement->velocity()[1] = JUMP_MAX;
m_boost_fuel = BOOST_MAX;
/* jumping */
if (m_jump) {
if (m_boost_fuel > 0) {
m_boost_fuel -= d;
m_movement->velocity()[1] += JUMP_MAX * (d / BOOST_MAX);
}
else if (m_collider->onPlatform() && m_movement->velocity()[1] < 1) {
m_movement->velocity()[1] = JUMP_MAX;
m_boost_fuel = BOOST_MAX;
}
}
}
}
Expand All @@ -179,7 +181,7 @@ InputComponent::handleEvent(const Event::IEvent &e)
else m_direction_stack.remove(ICDRight);
}
else if (l_kevent.key() == Event::KEY_SPACE) {
m_jump = (l_kevent.action() == Event::KeyPressed && m_collider->onPlatform() ? true : false);
m_jump = (l_kevent.action() == Event::KeyPressed ? true : false);
}
else if (l_kevent.key() == Event::KEY_SHIFT_L) {
m_max_speed += l_kevent.action() == Event::KeyPressed ? 200 : -200;
Expand Down
8 changes: 4 additions & 4 deletions demos/platformer/playerentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,16 @@ PlayerEntity::update(float d)
m_animation_component->pushFrame("stand-left", 107, 4);
m_animation_component->pushFrame("walk-left", 108, 1);
m_animation_component->pushFrame("walk-left", 109, 1);
m_animation_component->rate("walk-left", 16);
m_animation_component->setFrameRate("walk-left", 16);
m_animation_component->pushFrame("jump-left", 108, 1);
m_animation_component->rate("jump-left", 1);
m_animation_component->setFrameRate("jump-left", 1);
m_animation_component->pushFrame("stand-right", 102, 12);
m_animation_component->pushFrame("stand-right", 103, 4);
m_animation_component->pushFrame("walk-right", 104, 1);
m_animation_component->pushFrame("walk-right", 105, 1);
m_animation_component->rate("walk-right", 16);
m_animation_component->setFrameRate("walk-right", 16);
m_animation_component->pushFrame("jump-right", 105, 1);
m_animation_component->rate("jump-right", 1);
m_animation_component->setFrameRate("jump-right", 1);
pushComponent(m_animation_component.staticCast<Game::IComponent>());

/* movement component */
Expand Down
8 changes: 4 additions & 4 deletions demos/tilemap/playerentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,22 +75,22 @@ PlayerEntity::update(float d)
m_animation_component->pushFrame("stand-down", 73, 4);
m_animation_component->pushFrame("walk-down", 74, 4);
m_animation_component->pushFrame("walk-down", 75, 4);
m_animation_component->rate("walk-down", 16);
m_animation_component->setFrameRate("walk-down", 16);
m_animation_component->pushFrame("stand-left", 76, 12);
m_animation_component->pushFrame("stand-left", 77, 4);
m_animation_component->pushFrame("walk-left", 78, 4);
m_animation_component->pushFrame("walk-left", 79, 4);
m_animation_component->rate("walk-left", 16);
m_animation_component->setFrameRate("walk-left", 16);
m_animation_component->pushFrame("stand-right", 72, 12);
m_animation_component->pushFrame("stand-right", 73, 4);
m_animation_component->pushFrame("walk-right", 74, 4);
m_animation_component->pushFrame("walk-right", 75, 4);
m_animation_component->rate("walk-right", 16);
m_animation_component->setFrameRate("walk-right", 16);
m_animation_component->pushFrame("stand-up", 76, 12);
m_animation_component->pushFrame("stand-up", 77, 4);
m_animation_component->pushFrame("walk-up", 80, 4);
m_animation_component->pushFrame("walk-up", 81, 4);
m_animation_component->rate("walk-up", 16);
m_animation_component->setFrameRate("walk-up", 16);
pushComponent(m_animation_component.staticCast<Game::IComponent>());

/* input component */
Expand Down
3 changes: 2 additions & 1 deletion include/core/base64.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,10 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Core
{
/*! @brief Core Base64 Interface */
namespace Base64
{
/*! @brief Base64 decoder
/*! @brief Core Base64 decoder
* @param in In buffer
* @param in_size In buffer size
* @param out Out buffer pointer
Expand Down
2 changes: 1 addition & 1 deletion include/core/bufferio.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Core
template <class T> class Shared;
template <class T> class Weak;

/*! @brief Buffer IO Interface */
/*! @brief Core Buffer IO Interface */
class MARSHMALLOW_CORE_EXPORT
BufferIO : public IDataIO
{
Expand Down
2 changes: 1 addition & 1 deletion include/core/fileio.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace Core
template <class T> class Shared;
template <class T> class Weak;

/*! @brief File IO Interface */
/*! @brief Core File IO Interface */
class MARSHMALLOW_CORE_EXPORT
FileIO : public IDataIO
{
Expand Down
4 changes: 2 additions & 2 deletions include/core/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@
#ifndef MARSHMALLOW_CORE_GLOBAL_H
#define MARSHMALLOW_CORE_GLOBAL_H 1

#define MARSHMALLOW_VERSION 0x00010002
#define MARSHMALLOW_VERSION 0x00010003
#define MARSHMALLOW_VERSION_MAJOR 0x00
#define MARSHMALLOW_VERSION_MINOR 0x01
#define MARSHMALLOW_VERSION_BUILD 0x00
#define MARSHMALLOW_VERSION_REVISION 0x02
#define MARSHMALLOW_VERSION_REVISION 0x03

#define VIRTUAL
#define NO_ASSIGN_COPY(x) NO_ASSIGN(x); NO_COPY(x)
Expand Down
2 changes: 1 addition & 1 deletion include/core/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Core
{
/*! @brief Hash Class */
/*! @brief Core Hash Class */
class MARSHMALLOW_CORE_EXPORT
Hash
{
Expand Down
2 changes: 1 addition & 1 deletion include/core/iasset.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace Core
template <class T> class Shared;
template <class T> class Weak;

/*! @brief Assets Asset Interface */
/*! @brief Core Assets Asset Interface */
struct IAsset
{
virtual ~IAsset(void) {};
Expand Down
2 changes: 1 addition & 1 deletion include/core/idataio.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace Core
DIOEnd
};

/*! @brief Data IO Interface */
/*! @brief Core Data IO Interface */
struct IDataIO
{
virtual ~IDataIO(void) {};
Expand Down
2 changes: 1 addition & 1 deletion include/core/irenderable.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace Core
template <class T> class Shared;
template <class T> class Weak;

/*! @brief Renderable Interface */
/*! @brief Core Renderable Interface */
struct IRenderable
{
virtual ~IRenderable(void) {};
Expand Down
2 changes: 1 addition & 1 deletion include/core/iserializable.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace Core
template <class T> class Shared;
template <class T> class Weak;

/*! @brief Serializable Interface */
/*! @brief Core Serializable Interface */
struct ISerializable
{
virtual ~ISerializable(void) {};
Expand Down
2 changes: 1 addition & 1 deletion include/core/iupdateable.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace Core
template <class T> class Shared;
template <class T> class Weak;

/*! @brief Updateable Interface */
/*! @brief Core Updateable Interface */
struct IUpdateable
{
virtual ~IUpdateable(void) {};
Expand Down
2 changes: 1 addition & 1 deletion include/core/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct TimeData;

namespace Core
{
/*! @brief Platform specific class */
/*! @brief Core Platform Interface */
namespace Platform
{
/*!
Expand Down
5 changes: 3 additions & 2 deletions include/core/shared.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,16 @@ namespace Core
{
template <class T> class Weak;

/*! @brief Shared Data Struct */
//! @cond
struct MARSHMALLOW_CORE_EXPORT
SharedData {
void *ptr;
int16_t refs;
int16_t wrefs;
};
//! @endcond

/*! @brief Shared Class */
/*! @brief Shared Pointer Class */
template <class T>
class Shared
{
Expand Down
2 changes: 1 addition & 1 deletion include/core/strhash.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Core
{
/*! @brief Event StrHash Class */
/*! @brief Core StrHash Class */
class MARSHMALLOW_CORE_EXPORT
StrHash : public Hash
{
Expand Down
2 changes: 1 addition & 1 deletion include/core/weak.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ namespace Core

struct SharedData;

/*! @brief Weak Class */
/*! @brief Weak Pointer Class */
template <class T>
class Weak
{
Expand Down
1 change: 1 addition & 0 deletions include/core/zlib.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Core
{
/*! @brief Core Zlib Interface */
namespace Zlib
{
/*! @brief Zlib inflate
Expand Down
2 changes: 1 addition & 1 deletion include/event/debugeventlistener.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Event
{
/*! @brief Debug Event Listener */
/*! @brief Event Debug Listener */
class MARSHMALLOW_EVENT_EXPORT
DebugEventListener : public IEventListener
{
Expand Down
1 change: 1 addition & 0 deletions include/event/eventbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Event
{
/*! @brief Event Priority */
enum EventPriority
{
LowestPriority = 0,
Expand Down
8 changes: 3 additions & 5 deletions include/event/keyboardevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,14 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Event
{
/*! @brief Keyboard Key Actions */
enum KBActions
{
KeyReleased = 0,
KeyPressed = 1
};

/*! @brief Keyboard Keys */
enum KBKeys
{
KEY_NONE = 0,
Expand Down Expand Up @@ -181,7 +183,7 @@ namespace Event
KEY_LAST
};

/*! @brief Keyboard Event Class */
/*! @brief Event Keyboard Class */
class MARSHMALLOW_EVENT_EXPORT
KeyboardEvent : public EventBase
{
Expand All @@ -206,10 +208,6 @@ namespace Event
public: /* static */

static const Core::Type & Type(void);

private: /* static */

static const Core::Type sType;
};
}

Expand Down
2 changes: 1 addition & 1 deletion include/event/proxyeventlistener.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Event
{
/*! @brief Proxy Event Listener Class */
/*! @brief Event Proxy Listener Class */
class MARSHMALLOW_EVENT_EXPORT
ProxyEventListener : public IEventListener
{
Expand Down
6 changes: 1 addition & 5 deletions include/event/quitevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Event
{
/*! @brief Quit Event Class */
/*! @brief Event Quit Class */
class MARSHMALLOW_EVENT_EXPORT
QuitEvent : public EventBase
{
Expand All @@ -66,10 +66,6 @@ namespace Event
public: /* static */

static const Core::Type & Type(void);

private: /* static */

static const Core::Type sType;
};
}

Expand Down
6 changes: 1 addition & 5 deletions include/event/renderevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Event
{
/*! @brief Render Event Class */
/*! @brief Event Render Class */
class MARSHMALLOW_EVENT_EXPORT
RenderEvent : public EventBase
{
Expand All @@ -61,10 +61,6 @@ namespace Event
public: /* static */

static const Core::Type & Type(void);

private: /* static */

static const Core::Type sType;
};
}

Expand Down
6 changes: 1 addition & 5 deletions include/event/updateevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ MARSHMALLOW_NAMESPACE_BEGIN

namespace Event
{
/*! @brief Update Event Class */
/*! @brief Event Update Class */
class MARSHMALLOW_EVENT_EXPORT
UpdateEvent : public EventBase
{
Expand All @@ -66,10 +66,6 @@ namespace Event
public: /* static */

static const Core::Type & Type(void);

private: /* static */

static const Core::Type sType;
};
}

Expand Down
9 changes: 1 addition & 8 deletions include/extra/tmxloader.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,10 @@ namespace Extra
TMXLoader(Game::IScene &scene);
virtual ~TMXLoader(void);

bool load(const char *file);
bool isLoaded(void) const;
bool load(const char *file);

const Game::SharedSceneLayerList & layers(void) const;

private:

bool processLayer(XMLElement &element);
bool processMap(XMLElement &element);
bool processObjectGroup(XMLElement &element);
bool processTileset(XMLElement &element);
};
typedef Core::Shared<TMXLoader> SharedTMXLoader;
typedef Core::Weak<TMXLoader> WeakTMXLoader;
Expand Down
Loading

0 comments on commit 450fdfd

Please sign in to comment.