diff --git a/src/contexts/contentcache.cpp b/src/contexts/contentcache.cpp index 1e522db..8fc509b 100644 --- a/src/contexts/contentcache.cpp +++ b/src/contexts/contentcache.cpp @@ -19,20 +19,20 @@ ContentCache::ContentCache(ContentManager *contentManager) ContentCache::~ContentCache() { - m_contentManager->Free(m_uiSkin, TRUE); - m_contentManager->Free(m_uiSkinImage, TRUE); - m_contentManager->Free(m_standardFont, TRUE); - m_contentManager->Free(m_uiFont, TRUE); + m_contentManager->Free(m_uiSkin, true); + m_contentManager->Free(m_uiSkinImage, true); + m_contentManager->Free(m_standardFont, true); + m_contentManager->Free(m_uiFont, true); } void ContentCache::OnLoadGame() { m_uiSkinFilename = "assets://ui_skin.png"; - m_uiSkinImage = m_contentManager->Get(m_uiSkinFilename, TRUE); - m_uiSkin = m_contentManager->Get(m_uiSkinFilename, TRUE); - m_standardFont = m_contentManager->Get("assets://fonts/dlxfont.ttf", SpriteFontParam(8), TRUE); + m_uiSkinImage = m_contentManager->Get(m_uiSkinFilename, true); + m_uiSkin = m_contentManager->Get(m_uiSkinFilename, true); + m_standardFont = m_contentManager->Get("assets://fonts/dlxfont.ttf", SpriteFontParam(8), true); m_uiFontFilename = "assets://fonts/dlxfont.ttf"; m_uiFontSize = 8; - m_uiFont = m_contentManager->Get(m_uiFontFilename, SpriteFontParam(m_uiFontSize), TRUE); + m_uiFont = m_contentManager->Get(m_uiFontFilename, SpriteFontParam(m_uiFontSize), true); } diff --git a/src/effects/effect.h b/src/effects/effect.h index 0d0aa9b..575de42 100644 --- a/src/effects/effect.h +++ b/src/effects/effect.h @@ -28,16 +28,16 @@ public: virtual void OnResize() {}; virtual void OnUpdate(float delta) {}; - BOOL IsActive() const { return m_isActive; } + bool IsActive() const { return m_isActive; } void MarkInactive(); private: - BOOL m_isActive; + bool m_isActive; }; inline Effect::Effect() { - m_isActive = TRUE; + m_isActive = true; } inline Effect::~Effect() @@ -46,7 +46,7 @@ inline Effect::~Effect() inline void Effect::MarkInactive() { - m_isActive = FALSE; + m_isActive = false; } #endif diff --git a/src/effects/effectinfo.cpp b/src/effects/effectinfo.cpp index ee5af2a..72d1fe0 100644 --- a/src/effects/effectinfo.cpp +++ b/src/effects/effectinfo.cpp @@ -3,7 +3,7 @@ #include "effectinfo.h" #include "effect.h" -EffectInfo::EffectInfo(Effect *effect, BOOL isLocal) +EffectInfo::EffectInfo(Effect *effect, bool isLocal) { ASSERT(effect != NULL); m_effect = effect; diff --git a/src/effects/effectinfo.h b/src/effects/effectinfo.h index 0585d59..8ebc9fd 100644 --- a/src/effects/effectinfo.h +++ b/src/effects/effectinfo.h @@ -8,15 +8,15 @@ class Effect; class EffectInfo { public: - EffectInfo(Effect *effect, BOOL isLocal); + EffectInfo(Effect *effect, bool isLocal); virtual ~EffectInfo(); Effect* GetEffect() const { return m_effect; } - BOOL IsLocal() const { return m_isLocal; } + bool IsLocal() const { return m_isLocal; } private: Effect *m_effect; - BOOL m_isLocal; + bool m_isLocal; }; #endif diff --git a/src/effects/effectmanager.h b/src/effects/effectmanager.h index abff7fa..bbd74ef 100644 --- a/src/effects/effectmanager.h +++ b/src/effects/effectmanager.h @@ -21,7 +21,7 @@ public: virtual ~EffectManager(); template T* Get() const; - template T* Add(BOOL isLocalEffect = TRUE); + template T* Add(bool isLocalEffect = true); template void Remove(); void RemoveAll(); @@ -56,7 +56,7 @@ T* EffectManager::Get() const } template -T* EffectManager::Add(BOOL isLocalEffect) +T* EffectManager::Add(bool isLocalEffect) { if (Get() != NULL) return NULL; diff --git a/src/effects/fadeeffect.cpp b/src/effects/fadeeffect.cpp index 5d78a55..078c9cd 100644 --- a/src/effects/fadeeffect.cpp +++ b/src/effects/fadeeffect.cpp @@ -11,9 +11,9 @@ const Color DEFAULT_FADE_COLOR = COLOR_BLACK; FadeEffect::FadeEffect() { - m_doneFading = FALSE; + m_doneFading = false; m_fadeSpeed = DEFAULT_FADE_SPEED; - m_fadingOut = TRUE; + m_fadingOut = true; m_alpha = 0.0f; m_color = DEFAULT_FADE_COLOR; m_fadeToAlpha = 0.0f; @@ -48,7 +48,7 @@ void FadeEffect::OnUpdate(float delta) if (m_alpha >= m_fadeToAlpha) { m_alpha = m_fadeToAlpha; - m_doneFading = TRUE; + m_doneFading = true; } } else @@ -57,7 +57,7 @@ void FadeEffect::OnUpdate(float delta) if (m_alpha < m_fadeToAlpha) { m_alpha = m_fadeToAlpha; - m_doneFading = TRUE; + m_doneFading = true; } } } diff --git a/src/effects/fadeeffect.h b/src/effects/fadeeffect.h index 9632582..df3af5a 100644 --- a/src/effects/fadeeffect.h +++ b/src/effects/fadeeffect.h @@ -24,12 +24,12 @@ public: FadeEffect* SetFadeOut(float toAlpha = COLOR_ALPHA_OPAQUE); FadeEffect* SetFadeIn(float toAlpha = COLOR_ALPHA_TRANSPARENT); - BOOL IsDoneFading() const { return m_doneFading; } + bool IsDoneFading() const { return m_doneFading; } private: - BOOL m_doneFading; + bool m_doneFading; float m_fadeSpeed; - BOOL m_fadingOut; + bool m_fadingOut; float m_alpha; Color m_color; float m_fadeToAlpha; @@ -49,7 +49,7 @@ inline FadeEffect* FadeEffect::SetFadeSpeed(float speed) inline FadeEffect* FadeEffect::SetFadeOut(float toAlpha) { - m_fadingOut = TRUE; + m_fadingOut = true; m_alpha = COLOR_ALPHA_TRANSPARENT; m_fadeToAlpha = toAlpha; return this; @@ -57,7 +57,7 @@ inline FadeEffect* FadeEffect::SetFadeOut(float toAlpha) inline FadeEffect* FadeEffect::SetFadeIn(float toAlpha) { - m_fadingOut = FALSE; + m_fadingOut = false; m_alpha = COLOR_ALPHA_OPAQUE; m_fadeToAlpha = toAlpha; return this; diff --git a/src/effects/flasheffect.cpp b/src/effects/flasheffect.cpp index 2f1d2e9..60d2156 100644 --- a/src/effects/flasheffect.cpp +++ b/src/effects/flasheffect.cpp @@ -11,7 +11,7 @@ const float DEFAULT_MAX_INTENSITY = 1.0f; FlashEffect::FlashEffect() { - m_flashingIn = TRUE; + m_flashingIn = true; m_flashInSpeed = DEFAULT_FLASH_SPEED; m_flashOutSpeed = DEFAULT_FLASH_SPEED; m_maximumIntensity = DEFAULT_MAX_INTENSITY; @@ -45,7 +45,7 @@ void FlashEffect::OnUpdate(float delta) if (m_alpha >= m_maximumIntensity) { m_alpha = m_maximumIntensity; - m_flashingIn = FALSE; + m_flashingIn = false; } } else @@ -55,7 +55,7 @@ void FlashEffect::OnUpdate(float delta) m_alpha = 0.0f; } - if (m_alpha == 0.0f && m_flashingIn == FALSE) + if (m_alpha == 0.0f && m_flashingIn == false) MarkInactive(); } diff --git a/src/effects/flasheffect.h b/src/effects/flasheffect.h index b4ceb2d..6a3c418 100644 --- a/src/effects/flasheffect.h +++ b/src/effects/flasheffect.h @@ -25,7 +25,7 @@ public: FlashEffect* SetMaximumIntensity(float maxIntensity); private: - BOOL m_flashingIn; + bool m_flashingIn; float m_flashInSpeed; float m_flashOutSpeed; float m_maximumIntensity; diff --git a/src/entities/componentsystem.h b/src/entities/componentsystem.h index 5192dc2..891b142 100644 --- a/src/entities/componentsystem.h +++ b/src/entities/componentsystem.h @@ -25,7 +25,7 @@ public: virtual void OnResize() {} virtual void OnUpdate(float delta) {} - virtual BOOL Handle(const Event *event); + virtual bool Handle(const Event *event); protected: ComponentSystem(EntityManager *entityManager, EventManager *eventManager); @@ -46,9 +46,9 @@ inline ComponentSystem::~ComponentSystem() { } -inline BOOL ComponentSystem::Handle(const Event *event) +inline bool ComponentSystem::Handle(const Event *event) { - return FALSE; + return false; } #endif diff --git a/src/entities/entity.h b/src/entities/entity.h index 78fce60..6e03232 100644 --- a/src/entities/entity.h +++ b/src/entities/entity.h @@ -15,10 +15,10 @@ public: template T* Get() const; template T* Add(); template void Remove(); - template BOOL Has() const; + template bool Has() const; - template BOOL WasCreatedUsingPreset() const; - BOOL WasCreatedUsingPreset(ENTITYPRESET_TYPE type) const; + template bool WasCreatedUsingPreset() const; + bool WasCreatedUsingPreset(ENTITYPRESET_TYPE type) const; protected: EntityManager *m_entityManager; @@ -43,18 +43,18 @@ inline void Entity::Remove() } template -inline BOOL Entity::Has() const +inline bool Entity::Has() const { return m_entityManager->HasComponent(this); } template -inline BOOL Entity::WasCreatedUsingPreset() const +inline bool Entity::WasCreatedUsingPreset() const { return m_entityManager->WasCreatedUsingPreset(this); } -inline BOOL Entity::WasCreatedUsingPreset(ENTITYPRESET_TYPE type) const +inline bool Entity::WasCreatedUsingPreset(ENTITYPRESET_TYPE type) const { return m_entityManager->WasCreatedUsingPreset(this, type); } diff --git a/src/entities/entitymanager.cpp b/src/entities/entitymanager.cpp index bede27f..076e2ff 100644 --- a/src/entities/entitymanager.cpp +++ b/src/entities/entitymanager.cpp @@ -65,15 +65,15 @@ Entity* EntityManager::AddUsingPreset(ENTITYPRESET_TYPE preset, EntityPresetArgs return entity; } -BOOL EntityManager::WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const +bool EntityManager::WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const { ASSERT(entity != NULL); ASSERT(type != NULL); EntityPresetComponent *preset = entity->Get(); if (preset != NULL && preset->preset == type) - return TRUE; + return true; else - return FALSE; + return false; } void EntityManager::Remove(Entity *entity) @@ -118,17 +118,17 @@ void EntityManager::RemoveAllComponentsFrom(Entity *entity) } } -BOOL EntityManager::IsValid(const Entity *entity) const +bool EntityManager::IsValid(const Entity *entity) const { if (entity == NULL) - return FALSE; + return false; // HACK: lol, this cast is aboslutely terrible and I shouldn't be doing this EntitySet::const_iterator i = m_entities.find((Entity*)entity); if (i == m_entities.end()) - return FALSE; + return false; else - return TRUE; + return true; } void EntityManager::GetAllComponentsFor(const Entity *entity, ComponentList &list) const diff --git a/src/entities/entitymanager.h b/src/entities/entitymanager.h index 31e5f87..993f674 100644 --- a/src/entities/entitymanager.h +++ b/src/entities/entitymanager.h @@ -47,23 +47,23 @@ public: Entity* AddUsingPreset(ENTITYPRESET_TYPE type, EntityPresetArgs *args = NULL); template Entity* GetWith() const; template void GetAllWith(EntityList &matches) const; - template BOOL WasCreatedUsingPreset(Entity *entity) const; - BOOL WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const; + template bool WasCreatedUsingPreset(Entity *entity) const; + bool WasCreatedUsingPreset(const Entity *entity, ENTITYPRESET_TYPE type) const; void Remove(Entity *entity); void RemoveAll(); - BOOL IsValid(const Entity *entity) const; + bool IsValid(const Entity *entity) const; uint GetNumEntities() const { return m_entities.size(); } template T* AddComponent(Entity *entity); template T* GetComponent(const Entity *entity) const; template void RemoveComponent(Entity *entity); - template BOOL HasComponent(const Entity *entity) const; + template bool HasComponent(const Entity *entity) const; void GetAllComponentsFor(const Entity *entity, ComponentList &list) const; template T* AddGlobalComponent(); template T* GetGlobalComponent() const; template void RemoveGlobalComponent(); - template BOOL HasGlobalComponent() const; + template bool HasGlobalComponent() const; void RemoveAllGlobalComponents(); void OnLostContext(); @@ -201,18 +201,18 @@ void EntityManager::RemoveComponent(Entity *entity) } template -BOOL EntityManager::HasComponent(const Entity *entity) const +bool EntityManager::HasComponent(const Entity *entity) const { ComponentStore::const_iterator i = m_components.find(T::GetType()); if (i == m_components.end()) - return FALSE; + return false; const EntityComponentsMap &entitiesWithComponent = i->second; EntityComponentsMap::const_iterator j = entitiesWithComponent.find(entity); if (j == entitiesWithComponent.end()) - return FALSE; + return false; else - return TRUE; + return true; } template @@ -246,13 +246,13 @@ void EntityManager::RemoveGlobalComponent() } template -BOOL EntityManager::HasGlobalComponent() const +bool EntityManager::HasGlobalComponent() const { GlobalComponentStore::const_iterator i = m_globalComponents.find(T::GetType()); if (i == m_globalComponents.end()) - return FALSE; + return false; else - return TRUE; + return true; } template @@ -282,7 +282,7 @@ void EntityManager::GetAllWith(EntityList &matches) const } template -BOOL EntityManager::WasCreatedUsingPreset(Entity *entity) const +bool EntityManager::WasCreatedUsingPreset(Entity *entity) const { return WasCreatedUsingPreset(entity, T::GetType()); } diff --git a/src/events/eventlistener.h b/src/events/eventlistener.h index 365fb5c..afda3a6 100644 --- a/src/events/eventlistener.h +++ b/src/events/eventlistener.h @@ -8,7 +8,7 @@ struct Event; class EventListener { public: - virtual BOOL Handle(const Event *event) = 0; + virtual bool Handle(const Event *event) = 0; }; #endif diff --git a/src/events/eventlistenerex.h b/src/events/eventlistenerex.h index 2512bb2..9903da6 100644 --- a/src/events/eventlistenerex.h +++ b/src/events/eventlistenerex.h @@ -13,12 +13,12 @@ public: EventListenerEx(EventManager *eventManager); virtual ~EventListenerEx(); - template BOOL ListenFor(); - template BOOL StopListeningFor(); - BOOL ListenFor(EVENT_TYPE type); - BOOL StopListeningFor(EVENT_TYPE type); + template bool ListenFor(); + template bool StopListeningFor(); + bool ListenFor(EVENT_TYPE type); + bool StopListeningFor(EVENT_TYPE type); - virtual BOOL Handle(const Event *event) = 0; + virtual bool Handle(const Event *event) = 0; EventManager* GetEventManager() const { return m_eventManager; } @@ -36,23 +36,23 @@ inline EventListenerEx::~EventListenerEx() } template -inline BOOL EventListenerEx::ListenFor() +inline bool EventListenerEx::ListenFor() { return m_eventManager->AddListener(this); } template -inline BOOL EventListenerEx::StopListeningFor() +inline bool EventListenerEx::StopListeningFor() { return m_eventManager->RemoveListener(this); } -inline BOOL EventListenerEx::ListenFor(EVENT_TYPE type) +inline bool EventListenerEx::ListenFor(EVENT_TYPE type) { return m_eventManager->AddListener(this, type); } -inline BOOL EventListenerEx::StopListeningFor(EVENT_TYPE type) +inline bool EventListenerEx::StopListeningFor(EVENT_TYPE type) { return m_eventManager->RemoveListener(this, type); } diff --git a/src/events/eventlogger.cpp b/src/events/eventlogger.cpp index 0842e8b..5b2ccec 100644 --- a/src/events/eventlogger.cpp +++ b/src/events/eventlogger.cpp @@ -13,8 +13,8 @@ EventLogger::~EventLogger() { } -BOOL EventLogger::Handle(const Event *event) +bool EventLogger::Handle(const Event *event) { LOG_INFO("EVENTLOGGER", "Event \"%s\" occurred.\n", event->GetTypeOf()); - return FALSE; + return false; } diff --git a/src/events/eventlogger.h b/src/events/eventlogger.h index 35fd901..0e29ec1 100644 --- a/src/events/eventlogger.h +++ b/src/events/eventlogger.h @@ -13,7 +13,7 @@ public: EventLogger(EventManager *eventManager); virtual ~EventLogger(); - BOOL Handle(const Event *event); + bool Handle(const Event *event); }; #endif diff --git a/src/events/eventmanager.cpp b/src/events/eventmanager.cpp index e8ee8d1..f14eb20 100644 --- a/src/events/eventmanager.cpp +++ b/src/events/eventmanager.cpp @@ -13,7 +13,7 @@ EventManager::~EventManager() { } -BOOL EventManager::AddListener(EventListener *listener, EVENT_TYPE type) +bool EventManager::AddListener(EventListener *listener, EVENT_TYPE type) { // TODO: validate type @@ -22,7 +22,7 @@ BOOL EventManager::AddListener(EventListener *listener, EVENT_TYPE type) { // need to register this listener for the given type EventListenerMapIRes result = m_registry.insert(EventListenerMapEnt(type, EventListenerTable())); - ASSERT(result.second != FALSE); + ASSERT(result.second != false); ASSERT(result.first != m_registry.end()); listenerItor = result.first; @@ -40,19 +40,19 @@ BOOL EventManager::AddListener(EventListener *listener, EVENT_TYPE type) // also update the list of currently registered event types m_typeList.insert(type); - return TRUE; + return true; } -BOOL EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type) +bool EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type) { - BOOL result = FALSE; + bool result = false; // TODO: validate type // get the list of listeners for the given event type EventListenerMap::iterator itor = m_registry.find(type); if (itor == m_registry.end()) - return FALSE; + return false; // check this list for the specified listener EventListenerTable &table = itor->second; @@ -62,7 +62,7 @@ BOOL EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type) { // found the listener table.erase(j); - result = TRUE; + result = true; // if there are no more listeners for this type, remove the type from the list of registered event types if (table.size() == 0) @@ -76,7 +76,7 @@ BOOL EventManager::RemoveListener(EventListener *listener, EVENT_TYPE type) return result; } -BOOL EventManager::Trigger(const Event *event) const +bool EventManager::Trigger(const Event *event) const { // TODO: validate type @@ -95,9 +95,9 @@ BOOL EventManager::Trigger(const Event *event) const // find the listener list for the event type EventListenerMap::const_iterator itor = m_registry.find(event->GetTypeOf()); if (itor == m_registry.end()) - return FALSE; + return false; - BOOL result = FALSE; + bool result = false; // trigger the event in each listener const EventListenerTable &table = itor->second; @@ -106,15 +106,15 @@ BOOL EventManager::Trigger(const Event *event) const EventListener *listener = *i; if (listener->Handle(event)) { - // only return TRUE if a listener signals they handled the event - result = TRUE; + // only return true if a listener signals they handled the event + result = true; } } return result; } -BOOL EventManager::Queue(const Event *event) +bool EventManager::Queue(const Event *event) { ASSERT(m_activeQueue >= 0); ASSERT(m_activeQueue < NUM_EVENT_QUEUES); @@ -129,15 +129,15 @@ BOOL EventManager::Queue(const Event *event) if (wildcardItor == m_registry.end()) { // no wildcard listener either... useless event! - return FALSE; + return false; } } m_queues[m_activeQueue].push_back(event); - return TRUE; + return true; } -BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType) +bool EventManager::Abort(EVENT_TYPE type, bool allOfType) { ASSERT(m_activeQueue >= 0); ASSERT(m_activeQueue < NUM_EVENT_QUEUES); @@ -146,9 +146,9 @@ BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType) EventListenerMap::iterator itor = m_registry.find(type); if (itor == m_registry.end()) - return FALSE; // no listeners for this type + return false; // no listeners for this type - BOOL result = FALSE; + bool result = false; EventQueue &queue = m_queues[m_activeQueue]; for (EventQueue::iterator i = queue.begin(); i != queue.end(); ++i) @@ -158,7 +158,7 @@ BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType) { // found a match, remove it from the queue i = queue.erase(i); - result = TRUE; + result = true; if (!allOfType) break; @@ -170,7 +170,7 @@ BOOL EventManager::Abort(EVENT_TYPE type, BOOL allOfType) return result; } -BOOL EventManager::ProcessQueue() +bool EventManager::ProcessQueue() { EventListenerMap::const_iterator wildcardItor = m_registry.find(EVENT_TYPE_WILDCARD); @@ -227,10 +227,10 @@ BOOL EventManager::ProcessQueue() m_queues[m_activeQueue].push_front(event); } - return FALSE; + return false; } else - return TRUE; + return true; } EventListenerList EventManager::GetListenerList(EVENT_TYPE type) const diff --git a/src/events/eventmanager.h b/src/events/eventmanager.h index f0c701e..35cdf78 100644 --- a/src/events/eventmanager.h +++ b/src/events/eventmanager.h @@ -23,17 +23,17 @@ public: EventManager(); virtual ~EventManager(); - template BOOL AddListener(EventListener *listener); - template BOOL RemoveListener(EventListener *listener); - BOOL AddListener(EventListener *listener, EVENT_TYPE type); - BOOL RemoveListener(EventListener *listener, EVENT_TYPE type); + template bool AddListener(EventListener *listener); + template bool RemoveListener(EventListener *listener); + bool AddListener(EventListener *listener, EVENT_TYPE type); + bool RemoveListener(EventListener *listener, EVENT_TYPE type); - BOOL Trigger(const Event *event) const; - BOOL Queue(const Event *event); - template BOOL Abort(BOOL allOfType = FALSE); - BOOL Abort(EVENT_TYPE type, BOOL allOfType = FALSE); + bool Trigger(const Event *event) const; + bool Queue(const Event *event); + template bool Abort(bool allOfType = false); + bool Abort(EVENT_TYPE type, bool allOfType = false); - BOOL ProcessQueue(); + bool ProcessQueue(); template EventListenerList GetListenerList() const; EventListenerList GetListenerList(EVENT_TYPE type) const; @@ -41,11 +41,11 @@ public: private: typedef stl::set EventTypeSet; - typedef stl::pair EventTypeSetIRes; + typedef stl::pair EventTypeSetIRes; typedef stl::list EventListenerTable; typedef stl::map EventListenerMap; typedef stl::pair EventListenerMapEnt; - typedef stl::pair EventListenerMapIRes; + typedef stl::pair EventListenerMapIRes; typedef stl::list EventQueue; EventTypeSet m_typeList; @@ -55,19 +55,19 @@ private: }; template -BOOL EventManager::AddListener(EventListener *listener) +bool EventManager::AddListener(EventListener *listener) { return AddListener(listener, T::GetType()); } template -BOOL EventManager::RemoveListener(EventListener *listener) +bool EventManager::RemoveListener(EventListener *listener) { return RemoveListener(listener, T::GetType()); } template -BOOL EventManager::Abort(BOOL allOfType) +bool EventManager::Abort(bool allOfType) { return Abort(T::GetType(), allOfType); } diff --git a/src/framework/assets/animation/keyframemeshinstance.cpp b/src/framework/assets/animation/keyframemeshinstance.cpp index 2d049ac..e150e43 100644 --- a/src/framework/assets/animation/keyframemeshinstance.cpp +++ b/src/framework/assets/animation/keyframemeshinstance.cpp @@ -18,12 +18,12 @@ KeyframeMeshInstance::KeyframeMeshInstance(KeyframeMesh *mesh) m_currentSequenceStart = 0; m_currentSequenceEnd = 0; - m_currentSequenceLoop = FALSE; + m_currentSequenceLoop = false; m_thisFrame = 0; m_nextFrame = 0; m_interpolation = 0.0f; - m_isRunningTempSequence = FALSE; - m_oldSequenceLoop = FALSE; + m_isRunningTempSequence = false; + m_oldSequenceLoop = false; } KeyframeMeshInstance::~KeyframeMeshInstance() @@ -71,7 +71,7 @@ void KeyframeMeshInstance::OnUpdate(float delta) } } -void KeyframeMeshInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop) +void KeyframeMeshInstance::SetSequence(uint startFrame, uint endFrame, bool loop) { m_currentSequenceName.clear(); m_currentSequenceStart = startFrame; @@ -86,7 +86,7 @@ void KeyframeMeshInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop m_interpolation = 0.0f; } -void KeyframeMeshInstance::SetSequence(const stl::string &name, BOOL loop) +void KeyframeMeshInstance::SetSequence(const stl::string &name, bool loop) { if (m_currentSequenceName == name) return; @@ -105,14 +105,14 @@ void KeyframeMeshInstance::RunSequenceOnce(const stl::string &name) m_oldSequenceName = m_currentSequenceName; m_oldSequenceLoop = m_currentSequenceLoop; - m_isRunningTempSequence = TRUE; + m_isRunningTempSequence = true; - SetSequence(name, FALSE); + SetSequence(name, false); } void KeyframeMeshInstance::RecoverFromTempSequence() { - m_isRunningTempSequence = FALSE; + m_isRunningTempSequence = false; SetSequence(m_oldSequenceName, m_oldSequenceLoop); m_oldSequenceName.clear(); m_oldSequenceLoop = false; diff --git a/src/framework/assets/animation/keyframemeshinstance.h b/src/framework/assets/animation/keyframemeshinstance.h index 2dea075..4c9e032 100644 --- a/src/framework/assets/animation/keyframemeshinstance.h +++ b/src/framework/assets/animation/keyframemeshinstance.h @@ -33,18 +33,18 @@ public: * Sets the current animation sequence. * @param startFrame the first frame of the sequence * @param endFrame the last frame of the sequence - * @param loop TRUE to loop the sequence, FALSE to stop when done + * @param loop true to loop the sequence, false to stop when done * and leave the current frame as the end frame */ - void SetSequence(uint startFrame, uint endFrame, BOOL loop); + void SetSequence(uint startFrame, uint endFrame, bool loop); /** * Sets the current animation sequence. * @param name the name of the sequence from the mesh's list of sequences - * @param loop TRUE to loop the sequence, FALSE to stop when done + * @param loop true to loop the sequence, false to stop when done * and leave the current frame as the end frame */ - void SetSequence(const stl::string &name, BOOL loop); + void SetSequence(const stl::string &name, bool loop); /** * Temporarily override the current animation sequence to run the specified @@ -99,13 +99,13 @@ private: stl::string m_currentSequenceName; uint m_currentSequenceStart; uint m_currentSequenceEnd; - BOOL m_currentSequenceLoop; + bool m_currentSequenceLoop; uint m_thisFrame; uint m_nextFrame; float m_interpolation; - BOOL m_isRunningTempSequence; + bool m_isRunningTempSequence; stl::string m_oldSequenceName; - BOOL m_oldSequenceLoop; + bool m_oldSequenceLoop; }; #endif diff --git a/src/framework/assets/animation/keyframemeshrenderer.cpp b/src/framework/assets/animation/keyframemeshrenderer.cpp index 22abcb9..67c90f9 100644 --- a/src/framework/assets/animation/keyframemeshrenderer.cpp +++ b/src/framework/assets/animation/keyframemeshrenderer.cpp @@ -23,34 +23,34 @@ KeyframeMeshRenderer::~KeyframeMeshRenderer() void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, VertexLerpShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); instance->GetRenderState()->Apply(); Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader); } void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint frame, VertexLerpShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); instance->GetRenderState()->Apply(); Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), frame, shader); } void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); instance->GetRenderState()->Apply(); Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader); } void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, VertexLerpShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); Render(graphicsDevice, mesh, texture, 0, shader); } void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint frame, VertexLerpShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); SetFrameVertices(mesh, frame); if (texture != NULL) @@ -65,7 +65,7 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh * void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); SetFrameVertices(mesh, startFrame, endFrame); if (texture != NULL) diff --git a/src/framework/assets/animation/skeletalmesh.cpp b/src/framework/assets/animation/skeletalmesh.cpp index b3e0944..e815c60 100644 --- a/src/framework/assets/animation/skeletalmesh.cpp +++ b/src/framework/assets/animation/skeletalmesh.cpp @@ -113,13 +113,13 @@ void SkeletalMesh::FindAndSetRootJointIndex() } // ensure it has child joints - BOOL hasChildJoints = FALSE; + bool hasChildJoints = false; for (uint i = 0; i < m_numJoints; ++i) { int parentIndex = m_joints[i].parentIndex; if (parentIndex == parentlessJoint) { - hasChildJoints = TRUE; + hasChildJoints = true; break; } } diff --git a/src/framework/assets/animation/skeletalmeshanimationinstance.cpp b/src/framework/assets/animation/skeletalmeshanimationinstance.cpp index c49cd9c..c335e1d 100644 --- a/src/framework/assets/animation/skeletalmeshanimationinstance.cpp +++ b/src/framework/assets/animation/skeletalmeshanimationinstance.cpp @@ -12,12 +12,12 @@ SkeletalMeshAnimationInstance::SkeletalMeshAnimationInstance(SkeletalMesh *mesh) { m_currentSequenceStart = 0; m_currentSequenceEnd = 0; - m_currentSequenceLoop = FALSE; + m_currentSequenceLoop = false; m_thisFrame = 0; m_nextFrame = 0; m_interpolation = 0.0f; - m_isRunningTempSequence = FALSE; - m_oldSequenceLoop = FALSE; + m_isRunningTempSequence = false; + m_oldSequenceLoop = false; } SkeletalMeshAnimationInstance::~SkeletalMeshAnimationInstance() @@ -65,7 +65,7 @@ void SkeletalMeshAnimationInstance::OnUpdate(float delta) } } -void SkeletalMeshAnimationInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop) +void SkeletalMeshAnimationInstance::SetSequence(uint startFrame, uint endFrame, bool loop) { m_currentSequenceName.clear(); m_currentSequenceStart = startFrame; @@ -80,7 +80,7 @@ void SkeletalMeshAnimationInstance::SetSequence(uint startFrame, uint endFrame, m_interpolation = 0.0f; } -void SkeletalMeshAnimationInstance::SetSequence(const stl::string &name, BOOL loop) +void SkeletalMeshAnimationInstance::SetSequence(const stl::string &name, bool loop) { if (m_currentSequenceName == name) return; @@ -98,14 +98,14 @@ void SkeletalMeshAnimationInstance::RunSequenceOnce(const stl::string &name) m_oldSequenceName = m_currentSequenceName; m_oldSequenceLoop = m_currentSequenceLoop; - m_isRunningTempSequence = TRUE; + m_isRunningTempSequence = true; - SetSequence(name, FALSE); + SetSequence(name, false); } void SkeletalMeshAnimationInstance::RecoverFromTempSequence() { - m_isRunningTempSequence = FALSE; + m_isRunningTempSequence = false; SetSequence(m_oldSequenceName, m_oldSequenceLoop); m_oldSequenceName.clear(); m_oldSequenceLoop = false; diff --git a/src/framework/assets/animation/skeletalmeshanimationinstance.h b/src/framework/assets/animation/skeletalmeshanimationinstance.h index 381d4f8..24f4540 100644 --- a/src/framework/assets/animation/skeletalmeshanimationinstance.h +++ b/src/framework/assets/animation/skeletalmeshanimationinstance.h @@ -14,8 +14,8 @@ public: virtual ~SkeletalMeshAnimationInstance(); void OnUpdate(float delta); - void SetSequence(uint startFrame, uint endFrame, BOOL loop); - void SetSequence(const stl::string &name, BOOL loop); + void SetSequence(uint startFrame, uint endFrame, bool loop); + void SetSequence(const stl::string &name, bool loop); void RunSequenceOnce(const stl::string &name); uint GetCurrentFrame() const { return m_thisFrame; } @@ -28,13 +28,13 @@ private: stl::string m_currentSequenceName; uint m_currentSequenceStart; uint m_currentSequenceEnd; - BOOL m_currentSequenceLoop; + bool m_currentSequenceLoop; uint m_thisFrame; uint m_nextFrame; float m_interpolation; - BOOL m_isRunningTempSequence; + bool m_isRunningTempSequence; stl::string m_oldSequenceName; - BOOL m_oldSequenceLoop; + bool m_oldSequenceLoop; }; #endif diff --git a/src/framework/assets/animation/skeletalmeshfile.cpp b/src/framework/assets/animation/skeletalmeshfile.cpp index 3f339a9..935ba7a 100644 --- a/src/framework/assets/animation/skeletalmeshfile.cpp +++ b/src/framework/assets/animation/skeletalmeshfile.cpp @@ -43,8 +43,8 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() ASSERT(jointsDesc != NULL); ASSERT(jointsToVerticesDesc != NULL); - BOOL hasNormals = (normalsDesc != NULL ? TRUE : FALSE); - BOOL hasTexCoords = (texCoordsDesc != NULL ? TRUE : FALSE); + bool hasNormals = (normalsDesc != NULL ? true : false); + bool hasTexCoords = (texCoordsDesc != NULL ? true : false); File *file = GetFile(); SkeletalMesh *mesh = new SkeletalMesh(); @@ -116,12 +116,12 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() { stl::string name; stl::string texture; - BOOL alpha; + bool alpha; uint numTriangles; file->ReadString(name); file->ReadString(texture); - alpha = file->ReadChar() == 0 ? FALSE : TRUE; + alpha = file->ReadChar() == 0 ? false : true; numTriangles = file->ReadUnsignedInt(); mesh->m_subsets[i].Create(name, numTriangles, alpha); diff --git a/src/framework/assets/animation/skeletalmeshinstance.cpp b/src/framework/assets/animation/skeletalmeshinstance.cpp index 88ca2a7..d2751a3 100644 --- a/src/framework/assets/animation/skeletalmeshinstance.cpp +++ b/src/framework/assets/animation/skeletalmeshinstance.cpp @@ -19,25 +19,25 @@ SkeletalMeshInstance::SkeletalMeshInstance(SkeletalMesh *mesh) m_numSubsets = m_mesh->GetNumSubsets(); - m_enabledSubsets = new BOOL[m_numSubsets]; + m_enabledSubsets = new bool[m_numSubsets]; m_textures = new Texture*[m_numSubsets]; for (uint i = 0; i < m_numSubsets; ++i) { - m_enabledSubsets[i] = TRUE; + m_enabledSubsets[i] = true; m_textures[i] = NULL; } m_renderState = new RENDERSTATE_DEFAULT; m_blendState = new BLENDSTATE_DEFAULT; m_alphaBlendState = new BLENDSTATE_ALPHABLEND; - m_renderAllSubsetsAlphaBlended = FALSE; + m_renderAllSubsetsAlphaBlended = false; m_numJoints = mesh->GetNumJoints(); m_jointTransformations = new Matrix4x4[m_numJoints]; m_jointPositions = new Vector3[m_numJoints]; m_jointRotations = new Quaternion[m_numJoints]; - m_rootJointHasFixedTransform = FALSE; + m_rootJointHasFixedTransform = false; } SkeletalMeshInstance::~SkeletalMeshInstance() @@ -68,14 +68,14 @@ const Matrix4x4* SkeletalMeshInstance::GetJointTransformation(const stl::string void SkeletalMeshInstance::SetFixedRootJointTransformation(const Matrix4x4 &transform) { ASSERT(GetMesh()->GetRootJointIndex() != NO_JOINT); - m_rootJointHasFixedTransform = TRUE; + m_rootJointHasFixedTransform = true; m_jointTransformations[GetMesh()->GetRootJointIndex()] = transform; } void SkeletalMeshInstance::ClearFixedRootJointTransformation() { ASSERT(GetMesh()->GetRootJointIndex() != NO_JOINT); - m_rootJointHasFixedTransform = FALSE; + m_rootJointHasFixedTransform = false; } void SkeletalMeshInstance::CalculateJointTransformations(uint frame) @@ -163,7 +163,7 @@ void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint jointMatrixIn m_jointRotations[jointMatrixIndex] = Quaternion::CreateFromRotationMatrix(*jointMatrix); } -void SkeletalMeshInstance::EnableSubset(const stl::string &subset, BOOL enable) +void SkeletalMeshInstance::EnableSubset(const stl::string &subset, bool enable) { int index = m_mesh->GetIndexOfSubset(subset); ASSERT(index != -1); diff --git a/src/framework/assets/animation/skeletalmeshinstance.h b/src/framework/assets/animation/skeletalmeshinstance.h index 3cf0f28..edd7b2c 100644 --- a/src/framework/assets/animation/skeletalmeshinstance.h +++ b/src/framework/assets/animation/skeletalmeshinstance.h @@ -23,9 +23,9 @@ public: void CalculateJointTransformations(uint startFrame, uint endFrame, float interpolation); uint GetNumSubsets() const { return m_numSubsets; } - BOOL IsSubsetEnabled(uint index) const { return m_enabledSubsets[index]; } - void EnableSubset(const stl::string &subset, BOOL enable); - void EnableSubset(uint index, BOOL enable) { m_enabledSubsets[index] = enable; } + bool IsSubsetEnabled(uint index) const { return m_enabledSubsets[index]; } + void EnableSubset(const stl::string &subset, bool enable); + void EnableSubset(uint index, bool enable) { m_enabledSubsets[index] = enable; } Texture** GetTextures() const { return m_textures; } void SetTexture(uint index, Texture *texture); @@ -43,8 +43,8 @@ public: BlendState* GetBlendState() const { return m_blendState; } BlendState* GetAlphaBlendState() const { return m_alphaBlendState; } - BOOL GetRenderAllSubsetsAlphaBlended() const { return m_renderAllSubsetsAlphaBlended; } - void SetRenderAllSubsetsAlphaBlended(BOOL enable) { m_renderAllSubsetsAlphaBlended = enable; } + bool GetRenderAllSubsetsAlphaBlended() const { return m_renderAllSubsetsAlphaBlended; } + void SetRenderAllSubsetsAlphaBlended(bool enable) { m_renderAllSubsetsAlphaBlended = enable; } SkeletalMesh* GetMesh() const { return m_mesh; } @@ -53,18 +53,18 @@ private: SkeletalMesh *m_mesh; uint m_numSubsets; - BOOL *m_enabledSubsets; + bool *m_enabledSubsets; Texture **m_textures; RenderState *m_renderState; BlendState *m_blendState; BlendState *m_alphaBlendState; - BOOL m_renderAllSubsetsAlphaBlended; + bool m_renderAllSubsetsAlphaBlended; uint m_numJoints; Matrix4x4 *m_jointTransformations; Vector3 *m_jointPositions; Quaternion *m_jointRotations; - BOOL m_rootJointHasFixedTransform; + bool m_rootJointHasFixedTransform; }; #endif diff --git a/src/framework/assets/animation/skeletalmeshrenderer.cpp b/src/framework/assets/animation/skeletalmeshrenderer.cpp index f340f82..10befbb 100644 --- a/src/framework/assets/animation/skeletalmeshrenderer.cpp +++ b/src/framework/assets/animation/skeletalmeshrenderer.cpp @@ -22,13 +22,13 @@ SkeletalMeshRenderer::~SkeletalMeshRenderer() void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, VertexSkinningShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); Render(graphicsDevice, instance, 0, shader); } void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint frame, VertexSkinningShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); instance->CalculateJointTransformations(frame); shader->SetJointPositions(instance->GetJointPositions(), instance->GetNumJoints()); shader->SetJointRotations(instance->GetJointRotations(), instance->GetNumJoints()); @@ -37,7 +37,7 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexSkinningShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); instance->CalculateJointTransformations(startFrame, endFrame, interpolation); shader->SetJointPositions(instance->GetJointPositions(), instance->GetNumJoints()); shader->SetJointRotations(instance->GetJointRotations(), instance->GetNumJoints()); @@ -46,7 +46,7 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshAnimationInstance *instance, VertexSkinningShader *shader) { - ASSERT(shader->IsBound() == TRUE); + ASSERT(shader->IsBound() == true); Render(graphicsDevice, instance, instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader); } @@ -55,14 +55,14 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel instance->GetRenderState()->Apply(); graphicsDevice->BindVertexBuffer(instance->GetMesh()->GetVertexBuffer()); - BOOL hasAlphaSubsets = FALSE; + bool hasAlphaSubsets = false; if (instance->GetRenderAllSubsetsAlphaBlended()) { // this instance has been overridden to have all it's subsets rendered // with alpha blending enabled. don't bother with the first loop to find // non-alpha-enabled subsets... - hasAlphaSubsets = TRUE; + hasAlphaSubsets = true; } else { @@ -76,7 +76,7 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel const SkeletalMeshSubset *subset = &instance->GetMesh()->GetSubsets()[i]; if (subset->IsAlphaBlended()) // note we have an alpha subset, but don't render it quite yet - hasAlphaSubsets = TRUE; + hasAlphaSubsets = true; else RenderSubset(graphicsDevice, subset, instance->GetTextures()[i]); } diff --git a/src/framework/assets/animation/skeletalmeshsubset.cpp b/src/framework/assets/animation/skeletalmeshsubset.cpp index a4ed0ab..21a32ac 100644 --- a/src/framework/assets/animation/skeletalmeshsubset.cpp +++ b/src/framework/assets/animation/skeletalmeshsubset.cpp @@ -8,7 +8,7 @@ SkeletalMeshSubset::SkeletalMeshSubset() { m_indices = NULL; - m_alpha = FALSE; + m_alpha = false; } SkeletalMeshSubset::~SkeletalMeshSubset() @@ -16,7 +16,7 @@ SkeletalMeshSubset::~SkeletalMeshSubset() SAFE_DELETE(m_indices); } -void SkeletalMeshSubset::Create(const stl::string &name, uint numTriangles, BOOL alpha) +void SkeletalMeshSubset::Create(const stl::string &name, uint numTriangles, bool alpha) { ASSERT(m_indices == NULL); ASSERT(numTriangles > 0); diff --git a/src/framework/assets/animation/skeletalmeshsubset.h b/src/framework/assets/animation/skeletalmeshsubset.h index 3cb929d..3ec2877 100644 --- a/src/framework/assets/animation/skeletalmeshsubset.h +++ b/src/framework/assets/animation/skeletalmeshsubset.h @@ -12,16 +12,16 @@ public: SkeletalMeshSubset(); virtual ~SkeletalMeshSubset(); - void Create(const stl::string &name, uint numTriangles, BOOL alpha); + void Create(const stl::string &name, uint numTriangles, bool alpha); const stl::string& GetName() const { return m_name; } IndexBuffer* GetIndices() const { return m_indices; } - BOOL IsAlphaBlended() const { return m_alpha; } + bool IsAlphaBlended() const { return m_alpha; } private: stl::string m_name; IndexBuffer *m_indices; - BOOL m_alpha; + bool m_alpha; }; #endif diff --git a/src/framework/basegameapp.cpp b/src/framework/basegameapp.cpp index 7abfb21..aabcb52 100644 --- a/src/framework/basegameapp.cpp +++ b/src/framework/basegameapp.cpp @@ -18,8 +18,8 @@ const uint DEFAULT_MAX_FRAMESKIP = 10; BaseGameApp::BaseGameApp() { - m_stop = FALSE; - m_isPaused = FALSE; + m_stop = false; + m_isPaused = false; m_fps = 0; m_frameTime = 0.0f; m_numRenders = 0; @@ -29,8 +29,8 @@ BaseGameApp::BaseGameApp() m_renderTime = 0; m_updateTime = 0; m_nextUpdateAt = 0; - m_isRunningSlowly = FALSE; - m_isDirty = FALSE; + m_isRunningSlowly = false; + m_isDirty = false; m_system = NULL; m_window = NULL; m_graphics = NULL; @@ -50,7 +50,7 @@ BaseGameApp::~BaseGameApp() SAFE_DELETE(m_graphics); } -BOOL BaseGameApp::Start(OperatingSystem *system) +bool BaseGameApp::Start(OperatingSystem *system) { m_system = system; @@ -58,34 +58,34 @@ BOOL BaseGameApp::Start(OperatingSystem *system) if (!OnInit()) { LOG_ERROR(LOGCAT_GAMEAPP, "Initialization failed.\n"); - return FALSE; + return false; } LOG_INFO(LOGCAT_GAMEAPP, "Initialization succeeded.\n"); OnNewContext(); OnResize(); - return TRUE; + return true; } -BOOL BaseGameApp::Initialize(GameWindowParams *windowParams) +bool BaseGameApp::Initialize(GameWindowParams *windowParams) { LOG_INFO(LOGCAT_GAMEAPP, "Starting initialization.\n"); if (!m_system->CreateGameWindow(this, windowParams)) - return FALSE; + return false; LOG_INFO(LOGCAT_GAMEAPP, "Verifying shader support present.\n"); if (!m_system->HasShaderSupport()) { LOG_ERROR(LOGCAT_GAMEAPP, "No support for shaders detected. Graphics framework requires hardware shader support. Aborting.\n"); - return FALSE; + return false; } m_window = m_system->GetWindow(); if (m_window == NULL) { LOG_ERROR(LOGCAT_GAMEAPP, "Not able to get a GameWindow instance.\n"); - return FALSE; + return false; } m_graphics = new GraphicsDevice(); @@ -97,7 +97,7 @@ BOOL BaseGameApp::Initialize(GameWindowParams *windowParams) LOG_INFO(LOGCAT_GAMEAPP, "Initialization finished.\n"); - return TRUE; + return true; } void BaseGameApp::Loop() @@ -158,15 +158,15 @@ void BaseGameApp::Loop() // we're "running slowly" if we're more than one update behind if (currentTime > m_nextUpdateAt + m_ticksPerUpdate) - m_isRunningSlowly = TRUE; + m_isRunningSlowly = true; else - m_isRunningSlowly = FALSE; + m_isRunningSlowly = false; numUpdatesThisFrame = 0; while (GetTicks() >= m_nextUpdateAt && numUpdatesThisFrame < m_maxFrameSkip) { if (numUpdatesThisFrame > 0) - m_isRunningSlowly = TRUE; + m_isRunningSlowly = true; uint before = GetTicks(); OnUpdate(m_fixedUpdateInterval); @@ -178,7 +178,7 @@ void BaseGameApp::Loop() ++m_numUpdates; // just updated, so we need to render the new game state - m_isDirty = TRUE; + m_isDirty = true; } if (m_isDirty && m_window->IsActive() && m_window->HasGLContext()) @@ -191,7 +191,7 @@ void BaseGameApp::Loop() ++m_numRenders; // don't render again until we have something new to show - m_isDirty = FALSE; + m_isDirty = false; } ++numLoops; @@ -206,7 +206,7 @@ void BaseGameApp::Quit() LOG_INFO(LOGCAT_GAMEAPP, "Quit requested.\n"); if (!m_system->IsQuitting()) m_system->Quit(); - m_stop = TRUE; + m_stop = true; } void BaseGameApp::OnAppGainFocus() @@ -222,13 +222,13 @@ void BaseGameApp::OnAppLostFocus() void BaseGameApp::OnAppPause() { LOG_INFO(LOGCAT_GAMEAPP, "Paused.\n"); - m_isPaused = TRUE; + m_isPaused = true; } void BaseGameApp::OnAppResume() { LOG_INFO(LOGCAT_GAMEAPP, "Resumed.\n"); - m_isPaused = FALSE; + m_isPaused = false; // this makes it so that the main loop won't try to "catch up" thinking that // it's really far behind with updates since m_nextUpdateAt won't have been @@ -290,10 +290,10 @@ void BaseGameApp::SetUpdateFrequency(uint targetFrequency) m_fixedUpdateInterval = m_ticksPerUpdate / 1000.0f; } -BOOL BaseGameApp::IsAppFocused() const +bool BaseGameApp::IsAppFocused() const { if (m_window != NULL) return m_window->IsFocused(); else - return FALSE; // if there's no window, it can't be focused! + return false; // if there's no window, it can't be focused! } diff --git a/src/framework/basegameapp.h b/src/framework/basegameapp.h index bc2f62b..b988403 100644 --- a/src/framework/basegameapp.h +++ b/src/framework/basegameapp.h @@ -27,9 +27,9 @@ public: * Begins application initialization in preparation for running the * main loop. * @param system pre-initialized operating system class - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Start(OperatingSystem *system); + bool Start(OperatingSystem *system); /** * Runs the main game loop. @@ -98,10 +98,10 @@ public: uint GetUpdatesPerSecond() const { return m_updatesPerSecond; } /** - * @return TRUE if the main loop is running behind + * @return true if the main loop is running behind * (has to update game logic more then once per frame) */ - BOOL IsRunningSlowing() const { return m_isRunningSlowly; } + bool IsRunningSlowing() const { return m_isRunningSlowly; } /** * Sets the desired frames per second to run the main loop at. @@ -126,23 +126,23 @@ public: * will render even if a game logic update has not been run since the last render * was performed. */ - void Invalidate() { m_isDirty = TRUE; } + void Invalidate() { m_isDirty = true; } uint GetTicks() const { return m_system->GetTicks(); } /** - * @return TRUE if the app currently is active and has input focus + * @return true if the app currently is active and has input focus */ - BOOL IsAppFocused() const; + bool IsAppFocused() const; protected: /** * Initializes the game window and the graphics and content management * sub-systems. * @param windowParams window creation parameters specific to the platform being run on - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GameWindowParams *windowParams); + bool Initialize(GameWindowParams *windowParams); /** * Signals to the main loop that the application should quit as soon as possible. @@ -173,7 +173,7 @@ public: /** * Game-specific initialization (before content loading) callback. */ - virtual BOOL OnInit() = 0; + virtual bool OnInit() = 0; /** * Initial game load after initialization success callback. @@ -211,8 +211,8 @@ private: OperatingSystem *m_system; GameWindow *m_window; - BOOL m_stop; - BOOL m_isPaused; + bool m_stop; + bool m_isPaused; uint m_fps; float m_frameTime; @@ -228,9 +228,9 @@ private: uint m_maxFrameSkip; float m_fixedUpdateInterval; uint m_nextUpdateAt; - BOOL m_isRunningSlowly; + bool m_isRunningSlowly; - BOOL m_isDirty; + bool m_isDirty; GraphicsDevice *m_graphics; ContentManager *m_content; diff --git a/src/framework/common.h b/src/framework/common.h index 58db6a4..cf7725f 100644 --- a/src/framework/common.h +++ b/src/framework/common.h @@ -4,12 +4,6 @@ #include #include -#if !defined(TRUE) && !defined(FALSE) -typedef int32_t BOOL; -const BOOL TRUE = 1; -const BOOL FALSE = 0; -#endif - typedef unsigned long ulong; typedef unsigned int uint; typedef unsigned short ushort; @@ -55,10 +49,10 @@ inline T Max(T a, T b) * Determines if a bit is set in the given bitfield. * @param bit the bit to check * @param bitfield the bit field to check the bit in - * @return TRUE if set, FALSE if not + * @return true if set, false if not */ template -inline BOOL IsBitSet(T1 bit, T2 bitfield) +inline bool IsBitSet(T1 bit, T2 bitfield) { return (bitfield & bit) != 0; } diff --git a/src/framework/content/content.cpp b/src/framework/content/content.cpp index 33efcf0..3a61613 100644 --- a/src/framework/content/content.cpp +++ b/src/framework/content/content.cpp @@ -5,25 +5,25 @@ Content::Content() { m_referenceCount = 0; - m_isReferenceCounted = FALSE; - m_wasLoadedByContentLoader = FALSE; + m_isReferenceCounted = false; + m_wasLoadedByContentLoader = false; } Content::~Content() { - ASSERT(m_isReferenceCounted == FALSE || m_referenceCount == 0); + ASSERT(m_isReferenceCounted == false || m_referenceCount == 0); } void Content::Reference() { - m_isReferenceCounted = TRUE; + m_isReferenceCounted = true; ++m_referenceCount; } void Content::ReleaseReference() { - ASSERT(m_isReferenceCounted == TRUE); - ASSERT(IsReferenced() == TRUE); + ASSERT(m_isReferenceCounted == true); + ASSERT(IsReferenced() == true); if (m_referenceCount > 0) --m_referenceCount; } diff --git a/src/framework/content/content.h b/src/framework/content/content.h index e0bd10d..8a245e7 100644 --- a/src/framework/content/content.h +++ b/src/framework/content/content.h @@ -23,19 +23,19 @@ public: virtual ~Content(); /** - * @return TRUE if this content object was created by a ContentLoader + * @return true if this content object was created by a ContentLoader */ - BOOL WasLoadedByContentLoader() const { return m_wasLoadedByContentLoader; } + bool WasLoadedByContentLoader() const { return m_wasLoadedByContentLoader; } /** - * @return TRUE if something else is currently referencing this content + * @return true if something else is currently referencing this content */ - BOOL IsReferenced() const { return m_referenceCount > 0; } + bool IsReferenced() const { return m_referenceCount > 0; } /** - * @return TRUE if this content is currently being reference counted + * @return true if this content is currently being reference counted */ - BOOL IsReferenceCounted() const { return m_isReferenceCounted; } + bool IsReferenceCounted() const { return m_isReferenceCounted; } /** * @return the number of references currently being held for this content @@ -53,8 +53,8 @@ private: */ void ReleaseReference(); - BOOL m_wasLoadedByContentLoader; - BOOL m_isReferenceCounted; + bool m_wasLoadedByContentLoader; + bool m_isReferenceCounted; uint m_referenceCount; }; diff --git a/src/framework/content/contentcontainer.h b/src/framework/content/contentcontainer.h index 8006f65..db44ffd 100644 --- a/src/framework/content/contentcontainer.h +++ b/src/framework/content/contentcontainer.h @@ -7,7 +7,7 @@ template struct ContentContainer { T *content; - BOOL isPreLoaded; + bool isPreLoaded; ContentContainer(); }; @@ -16,7 +16,7 @@ template inline ContentContainer::ContentContainer() { content = NULL; - isPreLoaded = FALSE; + isPreLoaded = false; } #endif diff --git a/src/framework/content/contentloader.cpp b/src/framework/content/contentloader.cpp index 410f437..04cf417 100644 --- a/src/framework/content/contentloader.cpp +++ b/src/framework/content/contentloader.cpp @@ -7,7 +7,7 @@ void ContentLoaderBase::MarkLoadedByContentLoader(Content *content) { ASSERT(content != NULL); - content->m_wasLoadedByContentLoader = TRUE; + content->m_wasLoadedByContentLoader = true; } void ContentLoaderBase::Reference(Content *content) diff --git a/src/framework/content/contentloader.h b/src/framework/content/contentloader.h index eb30a37..cb5a3d5 100644 --- a/src/framework/content/contentloader.h +++ b/src/framework/content/contentloader.h @@ -81,21 +81,21 @@ public: * platform's backing storage. * @param name the path and filename of the content to retrieve * @param params content-type-specified parameters used during loading or NULL - * @param preload TRUE to mark the content as preloaded after loading it + * @param preload true to mark the content as preloaded after loading it * @param the type of content to load * @return the loaded content or NULL on failure */ - virtual T* Get(const stl::string &name, const ContentParam *params, BOOL preload = FALSE) = 0; + virtual T* Get(const stl::string &name, const ContentParam *params, bool preload = false) = 0; /** * Frees the specified content object. Content is only actually freed * when it has no more references to it. * @param content the content object to be freed - * @param preload TRUE to allow this content to be freed even if it has + * @param preload true to allow this content to be freed even if it has * been preloaded * @param the type of content to be freed */ - virtual void Free(T *content, BOOL preload = FALSE) = 0; + virtual void Free(T *content, bool preload = false) = 0; /** * Frees the specified content if the content pointed to by the given path @@ -104,11 +104,11 @@ public: * @param name the path and filename of the content to free * @param params content-type-specific parameters that further describe the * exact content object to be freed, or NULL - * @param preload TRUE to allow this content to be freed even if it has + * @param preload true to allow this content to be freed even if it has * been preloaded * @param the type of content to be freed */ - virtual void Free(const stl::string &name, const ContentParam *params, BOOL preload = FALSE) = 0; + virtual void Free(const stl::string &name, const ContentParam *params, bool preload = false) = 0; /** * Returns the path and filename that the given content object was diff --git a/src/framework/content/contentloadermapstorebase.h b/src/framework/content/contentloadermapstorebase.h index 657f164..c32091b 100644 --- a/src/framework/content/contentloadermapstorebase.h +++ b/src/framework/content/contentloadermapstorebase.h @@ -26,16 +26,16 @@ public: void SetDefaultPath(const stl::string &path); - T* Get(const stl::string &name, const ContentParam *params, BOOL preload = FALSE); - void Free(T *content, BOOL preload = FALSE); - void Free(const stl::string &name, const ContentParam *params, BOOL preload = FALSE); + T* Get(const stl::string &name, const ContentParam *params, bool preload = false); + void Free(T *content, bool preload = false); + void Free(const stl::string &name, const ContentParam *params, bool preload = false); void RemoveAllContent(); stl::string GetNameOf(T *content) const; protected: - void Free(ContentStoreItor &itor, BOOL force, BOOL preload); + void Free(ContentStoreItor &itor, bool force, bool preload); virtual ContentStoreItor FindContent(const stl::string &file, const ContentParam *params); virtual T* LoadContent(const stl::string &file, const ContentParam *params) = 0; @@ -70,7 +70,7 @@ ContentLoaderMapStoreBase::~ContentLoaderMapStoreBase() } template -T* ContentLoaderMapStoreBase::Get(const stl::string &name, const ContentParam *params, BOOL preload) +T* ContentLoaderMapStoreBase::Get(const stl::string &name, const ContentParam *params, bool preload) { ContentContainer content; @@ -106,7 +106,7 @@ T* ContentLoaderMapStoreBase::Get(const stl::string &name, const ContentParam } template -void ContentLoaderMapStoreBase::Free(T *content, BOOL preload) +void ContentLoaderMapStoreBase::Free(T *content, bool preload) { ASSERT(content != NULL); @@ -114,27 +114,27 @@ void ContentLoaderMapStoreBase::Free(T *content, BOOL preload) { if (itor->second.content == content) { - Free(itor, FALSE, preload); + Free(itor, false, preload); break; } } } template -void ContentLoaderMapStoreBase::Free(const stl::string &name, const ContentParam *params, BOOL preload) +void ContentLoaderMapStoreBase::Free(const stl::string &name, const ContentParam *params, bool preload) { stl::string filename = AddDefaultPathIfNeeded(name); filename = ProcessFilename(filename, params); ContentStoreItor itor = FindContent(filename, params); if (itor != m_content.end()) - Free(itor, FALSE, preload); + Free(itor, false, preload); } template -void ContentLoaderMapStoreBase::Free(ContentStoreItor &itor, BOOL force, BOOL preload) +void ContentLoaderMapStoreBase::Free(ContentStoreItor &itor, bool force, bool preload) { - ASSERT(itor->second.content->WasLoadedByContentLoader() == TRUE); + ASSERT(itor->second.content->WasLoadedByContentLoader() == true); if (!itor->second.isPreLoaded) ContentLoaderBase::ReleaseReference(itor->second.content); @@ -181,7 +181,7 @@ void ContentLoaderMapStoreBase::RemoveAllContent() itor->second.content->GetNumReferences(), (itor->second.isPreLoaded ? ", preloaded" : "") ); - Free(itor, TRUE, itor->second.isPreLoaded); + Free(itor, true, itor->second.isPreLoaded); } m_content.clear(); diff --git a/src/framework/content/contentmanager.h b/src/framework/content/contentmanager.h index 07f0998..263820d 100644 --- a/src/framework/content/contentmanager.h +++ b/src/framework/content/contentmanager.h @@ -53,22 +53,22 @@ public: * Retrieves the specified content either from a cache or from the * platform's backing storage. * @param name the path and filename of the content to retrieve - * @param preload TRUE to mark the content as preloaded after loading it + * @param preload true to mark the content as preloaded after loading it * @param the type of content to load * @return the loaded content or NULL on failure */ - template T* Get(const stl::string &name, BOOL preload = FALSE); + template T* Get(const stl::string &name, bool preload = false); /** * Retrieves the specified content either from a cache or from the * platform's backing storage. * @param name the path and filename of the content to retrieve * @param params content-type-specified parameters used during loading or NULL - * @param preload TRUE to mark the content as preloaded after loading it + * @param preload true to mark the content as preloaded after loading it * @param the type of content to load * @return the loaded content or NULL on failure */ - template T* Get(const stl::string &name, const ContentParam ¶ms, BOOL preload = FALSE); + template T* Get(const stl::string &name, const ContentParam ¶ms, bool preload = false); /** * Loads the content so that it is pre-loaded and subsequent calls to Get() @@ -98,11 +98,11 @@ public: * and filename has been loaded. Content is only actually freed when it has * no more references to it. * @param name the path and filename of the content to free - * @param preload TRUE to allow this content to be freed even if it has + * @param preload true to allow this content to be freed even if it has * been preloaded * @param the type of content to be freed */ - template void Free(const stl::string &name, BOOL preload = FALSE); + template void Free(const stl::string &name, bool preload = false); /** * Frees the specified content if the content pointed to by the given path @@ -111,21 +111,21 @@ public: * @param name the path and filename of the content to free * @param params content-type-specific parameters that further describe the * exact content object to be freed, or NULL - * @param preload TRUE to allow this content to be freed even if it has + * @param preload true to allow this content to be freed even if it has * been preloaded * @param the type of content to be freed */ - template void Free(const stl::string &name, const ContentParam ¶ms, BOOL preload = FALSE); + template void Free(const stl::string &name, const ContentParam ¶ms, bool preload = false); /** * Frees the specified content object. Content is only actually freed * when it has no more references to it. * @param content the content object to be freed - * @param preload TRUE to allow this content to be freed even if it has + * @param preload true to allow this content to be freed even if it has * been preloaded * @param the type of content to be freed */ - template void Free(T *content, BOOL preload = FALSE); + template void Free(T *content, bool preload = false); /** * Frees the specified pre-loaded content. This will free the content @@ -187,7 +187,7 @@ private: }; template -T* ContentManager::Get(const stl::string &name, BOOL preload) +T* ContentManager::Get(const stl::string &name, bool preload) { ContentLoader *loader = GetLoader(); T* content = loader->Get(name, NULL, preload); @@ -195,7 +195,7 @@ T* ContentManager::Get(const stl::string &name, BOOL preload) } template -T* ContentManager::Get(const stl::string &name, const ContentParam ¶ms, BOOL preload) +T* ContentManager::Get(const stl::string &name, const ContentParam ¶ms, bool preload) { ContentLoader *loader = GetLoader(); T* content = loader->Get(name, ¶ms, preload); @@ -205,31 +205,31 @@ T* ContentManager::Get(const stl::string &name, const ContentParam ¶ms, BOOL template T* ContentManager::Load(const stl::string &name) { - return Get(name, TRUE); + return Get(name, true); } template T* ContentManager::Load(const stl::string &name, const ContentParam ¶ms) { - return Get(name, params, TRUE); + return Get(name, params, true); } template -void ContentManager::Free(const stl::string &name, BOOL preload) +void ContentManager::Free(const stl::string &name, bool preload) { ContentLoader *loader = GetLoader(); loader->Free(name, NULL, preload); } template -void ContentManager::Free(const stl::string &name, const ContentParam ¶ms, BOOL preload) +void ContentManager::Free(const stl::string &name, const ContentParam ¶ms, bool preload) { ContentLoader *loader = GetLoader(); loader->Free(name, ¶ms, preload); } template -void ContentManager::Free(T *content, BOOL preload) +void ContentManager::Free(T *content, bool preload) { ContentLoader *loader = GetLoader(); loader->Free(content, preload); @@ -238,19 +238,19 @@ void ContentManager::Free(T *content, BOOL preload) template void ContentManager::Unload(const stl::string &name) { - Free(name, TRUE); + Free(name, true); } template void ContentManager::Unload(const stl::string &name, const ContentParam ¶ms) { - Free(name, params, TRUE); + Free(name, params, true); } template void ContentManager::Unload(T *content) { - Free(content, TRUE); + Free(content, true); } template diff --git a/src/framework/content/imageloader.cpp b/src/framework/content/imageloader.cpp index 9dba0c6..0b07d01 100644 --- a/src/framework/content/imageloader.cpp +++ b/src/framework/content/imageloader.cpp @@ -38,7 +38,7 @@ Image* ImageLoader::LoadContent(const stl::string &file, const ContentParam *par ASSERT(imageFile != NULL); Image *image = new Image(); - BOOL success = image->Create(imageFile); + bool success = image->Create(imageFile); SAFE_DELETE(imageFile); diff --git a/src/framework/content/spritefontloader.cpp b/src/framework/content/spritefontloader.cpp index d01e1e2..004be61 100644 --- a/src/framework/content/spritefontloader.cpp +++ b/src/framework/content/spritefontloader.cpp @@ -150,8 +150,8 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing) // general size of each glyph in this font. Uppercase 'W' seems to be a // pretty good glyph to represent this "maximum size". SpriteFontGlyphMetrics maxMetrics; - BOOL maxMetricResult = GetGlyphMetrics(&fontinfo, 'W', size, &maxMetrics); - ASSERT(maxMetricResult == TRUE); + bool maxMetricResult = GetGlyphMetrics(&fontinfo, 'W', size, &maxMetrics); + ASSERT(maxMetricResult == true); // if we can't even get this glyph's metrics then stop now if (!maxMetricResult) @@ -161,8 +161,8 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing) // that we're allowing as long as the font pixel size doesn't get too large // this bitmap is *only* going to contain alpha values (not any kind of rgb colour data) Image *bitmap = new Image(); - BOOL bitmapCreateSuccess = bitmap->Create(FONT_BITMAP_WIDTH, FONT_BITMAP_HEIGHT, IMAGE_FORMAT_ALPHA); - ASSERT(bitmapCreateSuccess == TRUE); + bool bitmapCreateSuccess = bitmap->Create(FONT_BITMAP_WIDTH, FONT_BITMAP_HEIGHT, IMAGE_FORMAT_ALPHA); + ASSERT(bitmapCreateSuccess == true); bitmap->Clear(); // the texture atlas to store the position/texcoords of each glyph @@ -186,8 +186,8 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing) // get metrics for the current glyph char c = (char)(i + LOW_GLYPH); SpriteFontGlyphMetrics glyphMetrics; - BOOL metricResult = GetGlyphMetrics(&fontinfo, c, size, &glyphMetrics); - ASSERT(metricResult == TRUE); + bool metricResult = GetGlyphMetrics(&fontinfo, c, size, &glyphMetrics); + ASSERT(metricResult == true); // adjust each glyph's rect so that it has it's own space that doesn't // collide with any of it's neighbour glyphs (neighbour as seen on the @@ -237,8 +237,8 @@ SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing) } Texture *fontTexture = new Texture(); - BOOL textureCreated = fontTexture->Create(GetContentManager()->GetGameApp()->GetGraphicsDevice(), bitmap); - ASSERT(textureCreated == TRUE); + bool textureCreated = fontTexture->Create(GetContentManager()->GetGameApp()->GetGraphicsDevice(), bitmap); + ASSERT(textureCreated == true); SAFE_DELETE(bitmap); if (!textureCreated) { @@ -271,7 +271,7 @@ void SpriteFontLoader::FreeContent(SpriteFont *content) SAFE_DELETE(content); } -BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *metrics) const +bool SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *metrics) const { ASSERT(metrics != NULL); @@ -284,7 +284,7 @@ BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uin metrics->index = stbtt_FindGlyphIndex(fontInfo, glyph); if (metrics->index == 0) - return FALSE; + return false; stbtt_GetGlyphBox(fontInfo, metrics->index, &metrics->dimensions.left, &metrics->dimensions.top, &metrics->dimensions.right, &metrics->dimensions.bottom); stbtt_GetFontVMetrics(fontInfo, &metrics->ascent, &metrics->descent, &metrics->lineGap); @@ -310,5 +310,5 @@ BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uin if (heightDifference != metrics->lineGap && metrics->lineGap == 0) metrics->lineGap = heightDifference; - return TRUE; + return true; } diff --git a/src/framework/content/spritefontloader.h b/src/framework/content/spritefontloader.h index 6311195..4803118 100644 --- a/src/framework/content/spritefontloader.h +++ b/src/framework/content/spritefontloader.h @@ -80,7 +80,7 @@ private: void DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint &outSize) const; SpriteFont* Load(File *file, uint size, SpriteFont *existing) const; - BOOL GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *glyphMetrics) const; + bool GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *glyphMetrics) const; }; #endif diff --git a/src/framework/content/textureloader.cpp b/src/framework/content/textureloader.cpp index 003900a..13a657d 100644 --- a/src/framework/content/textureloader.cpp +++ b/src/framework/content/textureloader.cpp @@ -84,7 +84,7 @@ Texture* TextureLoader::Load(const stl::string &file, Texture *existingTexture) texture = new Texture(); // load image into it - BOOL success = texture->Create(GetContentManager()->GetGameApp()->GetGraphicsDevice(), image); + bool success = texture->Create(GetContentManager()->GetGameApp()->GetGraphicsDevice(), image); // don't need to keep the underlying image around if not being used elsewhere GetContentManager()->Free(image); diff --git a/src/framework/file/diskfile.cpp b/src/framework/file/diskfile.cpp index 3a5e17b..b2fc704 100644 --- a/src/framework/file/diskfile.cpp +++ b/src/framework/file/diskfile.cpp @@ -7,8 +7,8 @@ DiskFile::DiskFile() { m_fp = NULL; m_mode = 0; - m_canRead = FALSE; - m_canWrite = FALSE; + m_canRead = false; + m_canWrite = false; } DiskFile::~DiskFile() @@ -16,26 +16,26 @@ DiskFile::~DiskFile() Close(); } -BOOL DiskFile::Open(const stl::string &filename, int mode) +bool DiskFile::Open(const stl::string &filename, int mode) { - ASSERT(IsOpen() == FALSE); + ASSERT(IsOpen() == false); m_filename = filename; char fopenMode[3] = { '\0', '\0', '\0' }; if (mode & FILEMODE_READ) { fopenMode[0] = 'r'; - m_canRead = TRUE; + m_canRead = true; } else if (mode & FILEMODE_WRITE) { fopenMode[0] = 'w'; - m_canWrite = TRUE; + m_canWrite = true; } else if (mode & FILEMODE_APPEND) { fopenMode[0] = 'a'; - m_canWrite = TRUE; + m_canWrite = true; } if (mode & FILEMODE_BINARY && fopenMode[0] != '\0') fopenMode[1] = 'b'; @@ -43,23 +43,23 @@ BOOL DiskFile::Open(const stl::string &filename, int mode) if (fopenMode[0] == '\0') { ASSERT(!"Unrecognized mode."); - return FALSE; + return false; } else { - ASSERT(m_canRead == TRUE || m_canWrite == TRUE); + ASSERT(m_canRead == true || m_canWrite == true); m_fp = fopen(filename.c_str(), fopenMode); if (m_fp) { LOG_INFO(LOGCAT_FILEIO, "Opened DiskFile \"%s\", mode = %s\n", filename.c_str(), fopenMode); m_mode = mode; - return TRUE; + return true; } else { LOG_WARN(LOGCAT_FILEIO, "Failed to open DiskFile \"%s\", mode = %s\n", filename.c_str(), fopenMode); - return FALSE; + return false; } } } @@ -74,8 +74,8 @@ void DiskFile::Close() m_fp = NULL; m_mode = 0; - m_canRead = FALSE; - m_canWrite = FALSE; + m_canRead = false; + m_canWrite = false; m_filename.clear(); } @@ -328,7 +328,7 @@ void DiskFile::Seek(size_t offset, FileSeek from) fseek(m_fp, offset, origin); } -BOOL DiskFile::AtEOF() +bool DiskFile::AtEOF() { ASSERT(IsOpen()); return feof(m_fp) != 0; diff --git a/src/framework/file/diskfile.h b/src/framework/file/diskfile.h index cbdd216..1df3453 100644 --- a/src/framework/file/diskfile.h +++ b/src/framework/file/diskfile.h @@ -17,12 +17,12 @@ public: DiskFile(); virtual ~DiskFile(); - BOOL Open(const stl::string &filename, int mode); + bool Open(const stl::string &filename, int mode); void Close(); - BOOL IsOpen() const { return m_fp != NULL; } - BOOL CanRead() const { return m_canRead; } - BOOL CanWrite() const { return m_canWrite; } + bool IsOpen() const { return m_fp != NULL; } + bool CanRead() const { return m_canRead; } + bool CanWrite() const { return m_canWrite; } FileType GetFileType() const { return FILETYPE_IO; } int8_t ReadChar(); @@ -53,7 +53,7 @@ public: size_t Tell(); void Seek(size_t offset, FileSeek from); - BOOL AtEOF(); + bool AtEOF(); size_t GetFileSize(); const stl::string& GetFilename() const { return m_filename; } @@ -61,8 +61,8 @@ public: private: FILE *m_fp; int m_mode; - BOOL m_canRead; - BOOL m_canWrite; + bool m_canRead; + bool m_canWrite; stl::string m_filename; }; diff --git a/src/framework/file/file.h b/src/framework/file/file.h index 017a8c6..b8cd273 100644 --- a/src/framework/file/file.h +++ b/src/framework/file/file.h @@ -41,19 +41,19 @@ public: virtual void Close() = 0; /** - * @return TRUE if the file is currently open + * @return true if the file is currently open */ - virtual BOOL IsOpen() const = 0; + virtual bool IsOpen() const = 0; /** - * @return TRUE if this file supports reading + * @return true if this file supports reading */ - virtual BOOL CanRead() const = 0; + virtual bool CanRead() const = 0; /** - * @return TRUE if this file supports writing + * @return true if this file supports writing */ - virtual BOOL CanWrite() const = 0; + virtual bool CanWrite() const = 0; /** * @return a type value representing the backing storage where this file's @@ -250,9 +250,9 @@ public: virtual void Seek(size_t offset, FileSeek from) = 0; /** - * @return TRUE if the current file pointer is at the end of the file + * @return true if the current file pointer is at the end of the file */ - virtual BOOL AtEOF() = 0; + virtual bool AtEOF() = 0; /** * @return the size of this file in bytes diff --git a/src/framework/file/marmaladefile.cpp b/src/framework/file/marmaladefile.cpp index f5b615b..5842786 100644 --- a/src/framework/file/marmaladefile.cpp +++ b/src/framework/file/marmaladefile.cpp @@ -9,8 +9,8 @@ MarmaladeFile::MarmaladeFile() { m_fp = NULL; m_mode = 0; - m_canRead = FALSE; - m_canWrite = FALSE; + m_canRead = false; + m_canWrite = false; } MarmaladeFile::~MarmaladeFile() @@ -18,26 +18,26 @@ MarmaladeFile::~MarmaladeFile() Close(); } -BOOL MarmaladeFile::Open(const stl::string &filename, int mode) +bool MarmaladeFile::Open(const stl::string &filename, int mode) { - ASSERT(IsOpen() == FALSE); + ASSERT(IsOpen() == false); m_filename = filename; char fopenMode[3] = { '\0', '\0', '\0' }; if (mode & FILEMODE_READ) { fopenMode[0] = 'r'; - m_canRead = TRUE; + m_canRead = true; } else if (mode & FILEMODE_WRITE) { fopenMode[0] = 'w'; - m_canWrite = TRUE; + m_canWrite = true; } else if (mode & FILEMODE_APPEND) { fopenMode[0] = 'a'; - m_canWrite = TRUE; + m_canWrite = true; } if (mode & FILEMODE_BINARY && fopenMode[0] != '\0') fopenMode[1] = 'b'; @@ -45,23 +45,23 @@ BOOL MarmaladeFile::Open(const stl::string &filename, int mode) if (fopenMode[0] == '\0') { ASSERT(!"Unrecognized mode."); - return FALSE; + return false; } else { - ASSERT(m_canRead == TRUE || m_canWrite == TRUE); + ASSERT(m_canRead == true || m_canWrite == true); m_fp = s3eFileOpen(filename.c_str(), fopenMode); if (m_fp) { LOG_INFO(LOGCAT_FILEIO, "Opened MarmaladeFile \"%s\", mode = %s\n", filename.c_str(), fopenMode); m_mode = mode; - return TRUE; + return true; } else { LOG_WARN(LOGCAT_FILEIO, "Failed to open MarmaladeFile \"%s\", mode = %s. Error: %d, %s\n", filename.c_str(), fopenMode, s3eFileGetError(), s3eFileGetErrorString()); - return FALSE; + return false; } } } @@ -76,8 +76,8 @@ void MarmaladeFile::Close() m_fp = NULL; m_mode = 0; - m_canRead = FALSE; - m_canWrite = FALSE; + m_canRead = false; + m_canWrite = false; m_filename.clear(); } @@ -330,13 +330,13 @@ void MarmaladeFile::Seek(size_t offset, FileSeek from) s3eFileSeek(m_fp, offset, origin); } -BOOL MarmaladeFile::AtEOF() +bool MarmaladeFile::AtEOF() { ASSERT(IsOpen()); - if (s3eFileEOF(m_fp) == S3E_TRUE) - return TRUE; + if (s3eFileEOF(m_fp) == S3E_true) + return true; else - return FALSE; + return false; } size_t MarmaladeFile::GetFileSize() diff --git a/src/framework/file/marmaladefile.h b/src/framework/file/marmaladefile.h index 9ad8bea..213e7f2 100644 --- a/src/framework/file/marmaladefile.h +++ b/src/framework/file/marmaladefile.h @@ -13,12 +13,12 @@ public: MarmaladeFile(); virtual ~MarmaladeFile(); - BOOL Open(const stl::string &filename, int mode); + bool Open(const stl::string &filename, int mode); void Close(); - BOOL IsOpen() const { return m_fp != NULL; } - BOOL CanRead() const { return m_canRead; } - BOOL CanWrite() const { return m_canWrite; } + bool IsOpen() const { return m_fp != NULL; } + bool CanRead() const { return m_canRead; } + bool CanWrite() const { return m_canWrite; } FileType GetFileType() const { return FILETYPE_IO; } int8_t ReadChar(); @@ -49,7 +49,7 @@ public: size_t Tell(); void Seek(size_t offset, FileSeek from); - BOOL AtEOF(); + bool AtEOF(); size_t GetFileSize(); const stl::string& GetFilename() const { return m_filename; } @@ -57,8 +57,8 @@ public: private: s3eFile *m_fp; int m_mode; - BOOL m_canRead; - BOOL m_canWrite; + bool m_canRead; + bool m_canWrite; stl::string m_filename; }; diff --git a/src/framework/file/memoryfile.cpp b/src/framework/file/memoryfile.cpp index 86357cc..53b6e9d 100644 --- a/src/framework/file/memoryfile.cpp +++ b/src/framework/file/memoryfile.cpp @@ -8,11 +8,11 @@ MemoryFile::MemoryFile() { m_data = NULL; - m_ownData = FALSE; + m_ownData = false; m_length = 0; m_position = 0; - m_canRead = FALSE; - m_canWrite = FALSE; + m_canRead = false; + m_canWrite = false; } MemoryFile::~MemoryFile() @@ -20,14 +20,14 @@ MemoryFile::~MemoryFile() Close(); } -BOOL MemoryFile::Open(File *srcFile) +bool MemoryFile::Open(File *srcFile) { - ASSERT(IsOpen() == FALSE); + ASSERT(IsOpen() == false); ASSERT(srcFile->IsOpen()); size_t filesize = srcFile->GetFileSize(); m_data = new int8_t[filesize]; ASSERT(m_data != NULL); - m_ownData = TRUE; + m_ownData = true; m_length = filesize; m_filename = srcFile->GetFilename(); @@ -38,15 +38,15 @@ BOOL MemoryFile::Open(File *srcFile) LOG_INFO(LOGCAT_FILEIO, "Create MemoryFile from source file \"%s\"\n", srcFile->GetFilename().c_str()); - return TRUE; + return true; } -BOOL MemoryFile::Open(const void *memory, size_t numBytes, BOOL canRead, BOOL canWrite, BOOL assumeOwnershipOfMemory) +bool MemoryFile::Open(const void *memory, size_t numBytes, bool canRead, bool canWrite, bool assumeOwnershipOfMemory) { - ASSERT(IsOpen() == FALSE); + ASSERT(IsOpen() == false); ASSERT(memory != NULL); ASSERT(numBytes > 0); - ASSERT(canRead == TRUE || canWrite == TRUE); + ASSERT(canRead == true || canWrite == true); m_data = (int8_t*)memory; m_ownData = assumeOwnershipOfMemory; @@ -56,7 +56,7 @@ BOOL MemoryFile::Open(const void *memory, size_t numBytes, BOOL canRead, BOOL ca m_canRead = canRead; m_canWrite = canWrite; - return TRUE; + return true; } void MemoryFile::Close() @@ -70,11 +70,11 @@ void MemoryFile::Close() LOG_INFO(LOGCAT_FILEIO, "Free MemoryFile \"%s\"\n", m_filename.c_str()); } - m_ownData = FALSE; + m_ownData = false; m_length = 0; m_position = 0; - m_canRead = FALSE; - m_canWrite = FALSE; + m_canRead = false; + m_canWrite = false; m_filename.clear(); } @@ -352,7 +352,7 @@ void MemoryFile::Seek(size_t offset, FileSeek from) m_position += offset; } -BOOL MemoryFile::AtEOF() +bool MemoryFile::AtEOF() { ASSERT(IsOpen()); return m_position >= m_length; diff --git a/src/framework/file/memoryfile.h b/src/framework/file/memoryfile.h index 40d16b0..c5119d8 100644 --- a/src/framework/file/memoryfile.h +++ b/src/framework/file/memoryfile.h @@ -14,13 +14,13 @@ public: MemoryFile(); virtual ~MemoryFile(); - BOOL Open(File *srcFile); - BOOL Open(const void *memory, size_t numBytes, BOOL canRead, BOOL canWrite, BOOL assumeOwnershipOfMemory = FALSE); + bool Open(File *srcFile); + bool Open(const void *memory, size_t numBytes, bool canRead, bool canWrite, bool assumeOwnershipOfMemory = false); void Close(); - BOOL IsOpen() const { return m_data != NULL; } - BOOL CanRead() const { return m_canRead; } - BOOL CanWrite() const { return m_canWrite; } + bool IsOpen() const { return m_data != NULL; } + bool CanRead() const { return m_canRead; } + bool CanWrite() const { return m_canWrite; } FileType GetFileType() const { return FILETYPE_MEMORY; } int8_t ReadChar(); @@ -51,7 +51,7 @@ public: size_t Tell(); void Seek(size_t offset, FileSeek from); - BOOL AtEOF(); + bool AtEOF(); size_t GetFileSize(); const stl::string& GetFilename() const { return m_filename; } @@ -60,11 +60,11 @@ public: private: int8_t *m_data; - BOOL m_ownData; + bool m_ownData; size_t m_length; size_t m_position; - BOOL m_canRead; - BOOL m_canWrite; + bool m_canRead; + bool m_canWrite; stl::string m_filename; }; diff --git a/src/framework/file/sdlfile.cpp b/src/framework/file/sdlfile.cpp index 2b7e65a..4e050cc 100644 --- a/src/framework/file/sdlfile.cpp +++ b/src/framework/file/sdlfile.cpp @@ -8,8 +8,8 @@ SDLFile::SDLFile() { m_fp = NULL; m_mode = 0; - m_canRead = FALSE; - m_canWrite = FALSE; + m_canRead = false; + m_canWrite = false; } SDLFile::~SDLFile() @@ -17,26 +17,26 @@ SDLFile::~SDLFile() Close(); } -BOOL SDLFile::Open(const stl::string &filename, int mode) +bool SDLFile::Open(const stl::string &filename, int mode) { - ASSERT(IsOpen() == FALSE); + ASSERT(IsOpen() == false); m_filename = filename; char fopenMode[3] = { '\0', '\0', '\0' }; if (mode & FILEMODE_READ) { fopenMode[0] = 'r'; - m_canRead = TRUE; + m_canRead = true; } else if (mode & FILEMODE_WRITE) { fopenMode[0] = 'w'; - m_canWrite = TRUE; + m_canWrite = true; } else if (mode & FILEMODE_APPEND) { fopenMode[0] = 'a'; - m_canWrite = TRUE; + m_canWrite = true; } if (mode & FILEMODE_BINARY && fopenMode[0] != '\0') fopenMode[1] = 'b'; @@ -44,23 +44,23 @@ BOOL SDLFile::Open(const stl::string &filename, int mode) if (fopenMode[0] == '\0') { ASSERT(!"Unrecognized mode."); - return FALSE; + return false; } else { - ASSERT(m_canRead == TRUE || m_canWrite == TRUE); + ASSERT(m_canRead == true || m_canWrite == true); m_fp = SDL_RWFromFile(filename.c_str(), fopenMode); if (m_fp) { LOG_INFO(LOGCAT_FILEIO, "Opened SDLFile \"%s\", mode = %s\n", filename.c_str(), fopenMode); m_mode = mode; - return TRUE; + return true; } else { LOG_WARN(LOGCAT_FILEIO, "Failed to open SDLFile \"%s\", mode = %s\n", filename.c_str(), fopenMode); - return FALSE; + return false; } } } @@ -75,8 +75,8 @@ void SDLFile::Close() m_fp = NULL; m_mode = 0; - m_canRead = FALSE; - m_canWrite = FALSE; + m_canRead = false; + m_canWrite = false; m_filename.clear(); } @@ -329,15 +329,15 @@ void SDLFile::Seek(size_t offset, FileSeek from) SDL_RWseek(m_fp, offset, origin); } -BOOL SDLFile::AtEOF() +bool SDLFile::AtEOF() { ASSERT(IsOpen()); size_t filesize = GetFileSize(); size_t currentPos = Tell(); if (filesize == currentPos) - return TRUE; + return true; else - return FALSE; + return false; } size_t SDLFile::GetFileSize() diff --git a/src/framework/file/sdlfile.h b/src/framework/file/sdlfile.h index 96738d8..1b423ad 100644 --- a/src/framework/file/sdlfile.h +++ b/src/framework/file/sdlfile.h @@ -14,12 +14,12 @@ public: SDLFile(); virtual ~SDLFile(); - BOOL Open(const stl::string &filename, int mode); + bool Open(const stl::string &filename, int mode); void Close(); - BOOL IsOpen() const { return m_fp != NULL; } - BOOL CanRead() const { return m_canRead; } - BOOL CanWrite() const { return m_canWrite; } + bool IsOpen() const { return m_fp != NULL; } + bool CanRead() const { return m_canRead; } + bool CanWrite() const { return m_canWrite; } FileType GetFileType() const { return FILETYPE_IO; } int8_t ReadChar(); @@ -50,7 +50,7 @@ public: size_t Tell(); void Seek(size_t offset, FileSeek from); - BOOL AtEOF(); + bool AtEOF(); size_t GetFileSize(); const stl::string& GetFilename() const { return m_filename; } @@ -58,8 +58,8 @@ public: private: SDL_RWops *m_fp; int m_mode; - BOOL m_canRead; - BOOL m_canWrite; + bool m_canRead; + bool m_canWrite; stl::string m_filename; }; diff --git a/src/framework/gamewindow.h b/src/framework/gamewindow.h index f93a4a6..02f46f8 100644 --- a/src/framework/gamewindow.h +++ b/src/framework/gamewindow.h @@ -10,7 +10,7 @@ struct OSEvent; struct GameWindowParams { - BOOL windowed; + bool windowed; }; /** @@ -30,23 +30,23 @@ public: /** * Creates the game window. * @param params platform specific window creation parameters - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - virtual BOOL Create(GameWindowParams *params) = 0; + virtual bool Create(GameWindowParams *params) = 0; /** * Resizes the window to the given dimensions. * @param width the new window width * @param height the new window height - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - virtual BOOL Resize(uint width, uint height) = 0; + virtual bool Resize(uint width, uint height) = 0; /** * Toggles between fullscreen and windowed mode. - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - virtual BOOL ToggleFullscreen() = 0; + virtual bool ToggleFullscreen() = 0; /** * Signals to the underlying system that the window should be closed @@ -75,9 +75,9 @@ public: virtual uint GetBPP() const = 0; /** - * @return TRUE if the current window is windowed, FALSE if fullscreen + * @return true if the current window is windowed, false if fullscreen */ - virtual BOOL IsWindowed() const = 0; + virtual bool IsWindowed() const = 0; /** * @return the current display rotation angle @@ -85,24 +85,24 @@ public: virtual SCREEN_ORIENTATION_ANGLE GetScreenOrientation() const = 0; /** - * @return TRUE if this window is the currently active one + * @return true if this window is the currently active one */ - virtual BOOL IsActive() const = 0; + virtual bool IsActive() const = 0; /** - * @return TRUE if this window currently is active and has input focus + * @return true if this window currently is active and has input focus */ - virtual BOOL IsFocused() const = 0; + virtual bool IsFocused() const = 0; /** - * @return TRUE if the window has been signaled that it should close + * @return true if the window has been signaled that it should close */ - virtual BOOL IsClosing() const = 0; + virtual bool IsClosing() const = 0; /** * @return TRUe if the window currently has an active and usable OpenGL context associated with it */ - virtual BOOL HasGLContext() const = 0; + virtual bool HasGLContext() const = 0; /** * Performs platform specific processing for an event raised by the operating system. diff --git a/src/framework/graphics/billboardspritebatch.cpp b/src/framework/graphics/billboardspritebatch.cpp index 2cc2bab..6b68335 100644 --- a/src/framework/graphics/billboardspritebatch.cpp +++ b/src/framework/graphics/billboardspritebatch.cpp @@ -54,10 +54,10 @@ BillboardSpriteBatch::BillboardSpriteBatch(GraphicsDevice *graphicsDevice) m_blendState = new BLENDSTATE_ALPHABLEND; ASSERT(m_blendState != NULL); - m_begunRendering = FALSE; + m_begunRendering = false; - m_isRenderStateOverridden = FALSE; - m_isBlendStateOverridden = FALSE; + m_isRenderStateOverridden = false; + m_isBlendStateOverridden = false; } BillboardSpriteBatch::~BillboardSpriteBatch() @@ -69,7 +69,7 @@ BillboardSpriteBatch::~BillboardSpriteBatch() void BillboardSpriteBatch::InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader) { - ASSERT(m_begunRendering == FALSE); + ASSERT(m_begunRendering == false); m_cameraPosition = m_graphicsDevice->GetViewContext()->GetCamera()->GetPosition(); m_cameraForward = m_graphicsDevice->GetViewContext()->GetCamera()->GetForward(); @@ -78,28 +78,28 @@ void BillboardSpriteBatch::InternalBegin(const RenderState *renderState, const B m_shader = m_graphicsDevice->GetSprite3DShader(); else { - ASSERT(shader->IsReadyForUse() == TRUE); + ASSERT(shader->IsReadyForUse() == true); m_shader = shader; } if (renderState != NULL) { - m_isRenderStateOverridden = TRUE; + m_isRenderStateOverridden = true; m_overrideRenderState = *renderState; } else - m_isRenderStateOverridden = FALSE; + m_isRenderStateOverridden = false; if (blendState != NULL) { - m_isBlendStateOverridden = TRUE; + m_isBlendStateOverridden = true; m_overrideBlendState = *blendState; } else - m_isBlendStateOverridden = FALSE; + m_isBlendStateOverridden = false; m_currentSpritePointer = 0; - m_begunRendering = TRUE; + m_begunRendering = true; } void BillboardSpriteBatch::Begin(SpriteShader *shader) @@ -224,7 +224,7 @@ void BillboardSpriteBatch::Printf(const SpriteFont *font, const Vector3 &positio void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); Matrix4x4 transform = GetTransformFor(type, position); // zero vector offset as the transform will translate the billboard to @@ -234,7 +234,7 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *t void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); Matrix4x4 transform = GetTransformFor(type, position); // zero vector offset as the transform will translate the billboard to @@ -244,7 +244,7 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *t void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); uint sourceWidth = sourceRight - sourceLeft; ASSERT(sourceWidth > 0); @@ -262,7 +262,7 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); CheckForNewSpriteSpace(); SetSpriteInfo(m_currentSpritePointer, type, transform, texture, offset, width, height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color); ++m_currentSpritePointer; @@ -318,7 +318,7 @@ void BillboardSpriteBatch::SetSpriteInfo(uint spriteIndex, BILLBOARDSPRITE_TYPE void BillboardSpriteBatch::End() { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); if (m_isRenderStateOverridden) m_overrideRenderState.Apply(); @@ -335,7 +335,7 @@ void BillboardSpriteBatch::End() RenderQueue(); m_graphicsDevice->UnbindShader(); - m_begunRendering = FALSE; + m_begunRendering = false; } void BillboardSpriteBatch::RenderQueue() diff --git a/src/framework/graphics/billboardspritebatch.h b/src/framework/graphics/billboardspritebatch.h index ca20380..3e99f5f 100644 --- a/src/framework/graphics/billboardspritebatch.h +++ b/src/framework/graphics/billboardspritebatch.h @@ -201,9 +201,9 @@ private: SpriteShader *m_shader; RenderState *m_renderState; BlendState *m_blendState; - BOOL m_isRenderStateOverridden; + bool m_isRenderStateOverridden; RenderState m_overrideRenderState; - BOOL m_isBlendStateOverridden; + bool m_isBlendStateOverridden; BlendState m_overrideBlendState; VertexBuffer *m_vertices; stl::vector m_textures; @@ -212,7 +212,7 @@ private: Vector3 m_cameraPosition; Vector3 m_cameraForward; - BOOL m_begunRendering; + bool m_begunRendering; }; #endif diff --git a/src/framework/graphics/blendstate.cpp b/src/framework/graphics/blendstate.cpp index 877cdb2..f0942e1 100644 --- a/src/framework/graphics/blendstate.cpp +++ b/src/framework/graphics/blendstate.cpp @@ -12,7 +12,7 @@ BlendState::BlendState(BLEND_FACTOR sourceFactor, BLEND_FACTOR destinationFactor { Initialize(); - m_blending = TRUE; + m_blending = true; m_sourceBlendFactor = sourceFactor; m_destBlendFactor = destinationFactor; } @@ -23,7 +23,7 @@ BlendState::~BlendState() void BlendState::Initialize() { - m_blending = FALSE; + m_blending = false; m_sourceBlendFactor = ONE; m_destBlendFactor = ZERO; } diff --git a/src/framework/graphics/blendstate.h b/src/framework/graphics/blendstate.h index cc4bb73..0550164 100644 --- a/src/framework/graphics/blendstate.h +++ b/src/framework/graphics/blendstate.h @@ -47,9 +47,9 @@ public: void Apply() const; /** - * @return TRUE if blending is enabled + * @return true if blending is enabled */ - BOOL GetBlending() const { return m_blending; } + bool GetBlending() const { return m_blending; } /** * @return the source blending factor @@ -64,7 +64,7 @@ public: /** * Toggles blending on/off. */ - void SetBlending(BOOL enable) { m_blending = enable; } + void SetBlending(bool enable) { m_blending = enable; } /** * Sets the source blending factor. @@ -80,7 +80,7 @@ private: void Initialize(); int FindBlendFactorValue(BLEND_FACTOR factor) const; - BOOL m_blending; + bool m_blending; BLEND_FACTOR m_sourceBlendFactor; BLEND_FACTOR m_destBlendFactor; }; diff --git a/src/framework/graphics/bufferobject.cpp b/src/framework/graphics/bufferobject.cpp index 33d960e..c8298b4 100644 --- a/src/framework/graphics/bufferobject.cpp +++ b/src/framework/graphics/bufferobject.cpp @@ -9,7 +9,7 @@ BufferObject::BufferObject() m_type = BUFFEROBJECT_TYPE_VERTEX; m_usage = BUFFEROBJECT_USAGE_STATIC; m_bufferId = 0; - m_isDirty = FALSE; + m_isDirty = false; m_sizeInBytes = 0; } @@ -21,15 +21,15 @@ void BufferObject::Release() m_type = BUFFEROBJECT_TYPE_VERTEX; m_usage = BUFFEROBJECT_USAGE_STATIC; m_bufferId = 0; - m_isDirty = FALSE; + m_isDirty = false; m_sizeInBytes = 0; GraphicsContextResource::Release(); } -BOOL BufferObject::Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage) +bool BufferObject::Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage) { - BOOL success = TRUE; + bool success = true; if (graphicsDevice != NULL) success = GraphicsContextResource::Initialize(graphicsDevice); else @@ -43,20 +43,20 @@ BOOL BufferObject::Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE void BufferObject::CreateOnGpu() { - ASSERT(IsClientSideBuffer() == TRUE); + ASSERT(IsClientSideBuffer() == true); CreateBufferObject(); } void BufferObject::RecreateOnGpu() { - ASSERT(IsClientSideBuffer() == FALSE); + ASSERT(IsClientSideBuffer() == false); FreeBufferObject(); CreateBufferObject(); } void BufferObject::FreeFromGpu() { - ASSERT(IsClientSideBuffer() == FALSE); + ASSERT(IsClientSideBuffer() == false); FreeBufferObject(); } @@ -65,7 +65,7 @@ void BufferObject::CreateBufferObject() GL_CALL(glGenBuffers(1, &m_bufferId)); SizeBufferObject(); - m_isDirty = TRUE; + m_isDirty = true; } void BufferObject::FreeBufferObject() @@ -74,14 +74,14 @@ void BufferObject::FreeBufferObject() GL_CALL(glDeleteBuffers(1, &m_bufferId)); m_bufferId = 0; - m_isDirty = FALSE; + m_isDirty = false; m_sizeInBytes = 0; } void BufferObject::Update() { - ASSERT(IsClientSideBuffer() == FALSE); - ASSERT(IsDirty() == TRUE); + ASSERT(IsClientSideBuffer() == false); + ASSERT(IsDirty() == true); ASSERT(GetNumElements() > 0); ASSERT(GetElementWidthInBytes() > 0); @@ -128,12 +128,12 @@ void BufferObject::Update() GL_CALL(glBindBuffer(target, 0)); - m_isDirty = FALSE; + m_isDirty = false; } void BufferObject::SizeBufferObject() { - ASSERT(IsClientSideBuffer() == FALSE); + ASSERT(IsClientSideBuffer() == false); ASSERT(GetNumElements() > 0); ASSERT(GetElementWidthInBytes() > 0); @@ -160,7 +160,7 @@ void BufferObject::SizeBufferObject() GL_CALL(glBufferData(target, m_sizeInBytes, NULL, usage)); GL_CALL(glBindBuffer(target, 0)); - m_isDirty = TRUE; + m_isDirty = true; } void BufferObject::OnNewContext() diff --git a/src/framework/graphics/bufferobject.h b/src/framework/graphics/bufferobject.h index 1a4eeac..866fe8b 100644 --- a/src/framework/graphics/bufferobject.h +++ b/src/framework/graphics/bufferobject.h @@ -32,10 +32,10 @@ public: virtual void Release(); /** - * @return TRUE if this buffer object is holding client side data only + * @return true if this buffer object is holding client side data only * (hasn't been created as a buffer object in video memory) */ - BOOL IsClientSideBuffer() const { return m_bufferId == 0; } + bool IsClientSideBuffer() const { return m_bufferId == 0; } /** * @return the type of data this buffer holds @@ -63,10 +63,10 @@ public: virtual size_t GetElementWidthInBytes() const = 0; /** - * @return TRUE if some or all of the buffer data has been changed since + * @return true if some or all of the buffer data has been changed since * the last Update() call */ - BOOL IsDirty() const { return m_isDirty; } + bool IsDirty() const { return m_isDirty; } /** * Uploads the current buffer data to video memory. @@ -94,7 +94,7 @@ protected: * will be stored in it * @param usage the expected usage pattern of this buffer object */ - BOOL Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage); + bool Initialize(GraphicsDevice *graphicsDevice, BUFFEROBJECT_TYPE type, BUFFEROBJECT_USAGE usage); /** * Creates a buffer object on the GPU but does not upload this @@ -118,14 +118,14 @@ protected: void CreateBufferObject(); void FreeBufferObject(); void SizeBufferObject(); - void SetDirty() { m_isDirty = TRUE; } + void SetDirty() { m_isDirty = true; } private: BUFFEROBJECT_TYPE m_type; BUFFEROBJECT_USAGE m_usage; uint m_bufferId; - BOOL m_isDirty; + bool m_isDirty; size_t m_sizeInBytes; }; diff --git a/src/framework/graphics/customspriteshader.cpp b/src/framework/graphics/customspriteshader.cpp index bb25b6b..8b5abbf 100644 --- a/src/framework/graphics/customspriteshader.cpp +++ b/src/framework/graphics/customspriteshader.cpp @@ -10,27 +10,27 @@ CustomSpriteShader::~CustomSpriteShader() { } -BOOL CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) +bool CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) { if (!SpriteShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; - ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetTextureHasAlphaOnlyUniform()) == TRUE); + ASSERT(HasUniform(GetModelViewMatrixUniform()) == true); + ASSERT(HasUniform(GetProjectionMatrixUniform()) == true); + ASSERT(HasUniform(GetTextureHasAlphaOnlyUniform()) == true); - return TRUE; + return true; } -BOOL CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) +bool CustomSpriteShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) { if (!SpriteShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; - ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetTextureHasAlphaOnlyUniform()) == TRUE); + ASSERT(HasUniform(GetModelViewMatrixUniform()) == true); + ASSERT(HasUniform(GetProjectionMatrixUniform()) == true); + ASSERT(HasUniform(GetTextureHasAlphaOnlyUniform()) == true); - return TRUE; + return true; } diff --git a/src/framework/graphics/customspriteshader.h b/src/framework/graphics/customspriteshader.h index 96b0096..9a8c089 100644 --- a/src/framework/graphics/customspriteshader.h +++ b/src/framework/graphics/customspriteshader.h @@ -22,9 +22,9 @@ public: * @param graphicsDevice the graphics device to associate this shader with * @param vertexShaderSource GLSL source for a vertex shader * @param fragmentShaderSource GLSL source for a vertex shader - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); + bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); /** * Initializes the shader object for rendering sprites using the given vertex @@ -32,9 +32,9 @@ public: * @param graphicsDevice the graphics device to associate this shader with * @param vertexShaderSource GLSL source for a vertex shader * @param fragmentShaderSource GLSL source for a vertex shader - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); + bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); }; #endif diff --git a/src/framework/graphics/customstandardshader.cpp b/src/framework/graphics/customstandardshader.cpp index e9387a5..708fd41 100644 --- a/src/framework/graphics/customstandardshader.cpp +++ b/src/framework/graphics/customstandardshader.cpp @@ -10,24 +10,24 @@ CustomStandardShader::~CustomStandardShader() { } -BOOL CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) +bool CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) { if (!StandardShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; - ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE); + ASSERT(HasUniform(GetModelViewMatrixUniform()) == true); + ASSERT(HasUniform(GetProjectionMatrixUniform()) == true); - return TRUE; + return true; } -BOOL CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) +bool CustomStandardShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) { if (!StandardShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; - ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE); + ASSERT(HasUniform(GetModelViewMatrixUniform()) == true); + ASSERT(HasUniform(GetProjectionMatrixUniform()) == true); - return TRUE; + return true; } diff --git a/src/framework/graphics/customstandardshader.h b/src/framework/graphics/customstandardshader.h index 0065236..fc2d875 100644 --- a/src/framework/graphics/customstandardshader.h +++ b/src/framework/graphics/customstandardshader.h @@ -21,9 +21,9 @@ public: * @param graphicsDevice the graphics device to associate this shader with * @param vertexShaderSource GLSL source for a vertex shader * @param fragmentShaderSource GLSL source for a vertex shader - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); + bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); /** * Initializes the shader object using the given vertex and fragment shader @@ -31,9 +31,9 @@ public: * @param graphicsDevice the graphics device to associate this shader with * @param vertexShaderSource GLSL source for a vertex shader * @param fragmentShaderSource GLSL source for a vertex shader - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); + bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); }; #endif diff --git a/src/framework/graphics/customvertexlerpshader.cpp b/src/framework/graphics/customvertexlerpshader.cpp index 477ea8f..6d2b431 100644 --- a/src/framework/graphics/customvertexlerpshader.cpp +++ b/src/framework/graphics/customvertexlerpshader.cpp @@ -10,26 +10,26 @@ CustomVertexLerpShader::~CustomVertexLerpShader() { } -BOOL CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) +bool CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) { if (!VertexLerpShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; - ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetLerpUniform()) == TRUE); + ASSERT(HasUniform(GetModelViewMatrixUniform()) == true); + ASSERT(HasUniform(GetProjectionMatrixUniform()) == true); + ASSERT(HasUniform(GetLerpUniform()) == true); - return TRUE; + return true; } -BOOL CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) +bool CustomVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) { if (!VertexLerpShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; - ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetLerpUniform()) == TRUE); + ASSERT(HasUniform(GetModelViewMatrixUniform()) == true); + ASSERT(HasUniform(GetProjectionMatrixUniform()) == true); + ASSERT(HasUniform(GetLerpUniform()) == true); - return TRUE; + return true; } diff --git a/src/framework/graphics/customvertexlerpshader.h b/src/framework/graphics/customvertexlerpshader.h index 823665e..fcef5d9 100644 --- a/src/framework/graphics/customvertexlerpshader.h +++ b/src/framework/graphics/customvertexlerpshader.h @@ -12,8 +12,8 @@ public: CustomVertexLerpShader(); virtual ~CustomVertexLerpShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); - BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); + bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); + bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); }; #endif diff --git a/src/framework/graphics/customvertexskinningshader.cpp b/src/framework/graphics/customvertexskinningshader.cpp index 854b581..44c2fcb 100644 --- a/src/framework/graphics/customvertexskinningshader.cpp +++ b/src/framework/graphics/customvertexskinningshader.cpp @@ -11,28 +11,28 @@ CustomVertexSkinningShader::~CustomVertexSkinningShader() { } -BOOL CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) +bool CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) { if (!VertexSkinningShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; - ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetJointPositionsUniform()) == TRUE); - ASSERT(HasUniform(GetJointRotationsUniform()) == TRUE); + ASSERT(HasUniform(GetModelViewMatrixUniform()) == true); + ASSERT(HasUniform(GetProjectionMatrixUniform()) == true); + ASSERT(HasUniform(GetJointPositionsUniform()) == true); + ASSERT(HasUniform(GetJointRotationsUniform()) == true); - return TRUE; + return true; } -BOOL CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) +bool CustomVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) { if (!VertexSkinningShader::Initialize(graphicsDevice, vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; - ASSERT(HasUniform(GetModelViewMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetProjectionMatrixUniform()) == TRUE); - ASSERT(HasUniform(GetJointPositionsUniform()) == TRUE); - ASSERT(HasUniform(GetJointRotationsUniform()) == TRUE); + ASSERT(HasUniform(GetModelViewMatrixUniform()) == true); + ASSERT(HasUniform(GetProjectionMatrixUniform()) == true); + ASSERT(HasUniform(GetJointPositionsUniform()) == true); + ASSERT(HasUniform(GetJointRotationsUniform()) == true); - return TRUE; + return true; } diff --git a/src/framework/graphics/customvertexskinningshader.h b/src/framework/graphics/customvertexskinningshader.h index 4633d9b..55dcd42 100644 --- a/src/framework/graphics/customvertexskinningshader.h +++ b/src/framework/graphics/customvertexskinningshader.h @@ -12,8 +12,8 @@ public: CustomVertexSkinningShader(); virtual ~CustomVertexSkinningShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); - BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); + bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); + bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); }; #endif diff --git a/src/framework/graphics/debugshader.cpp b/src/framework/graphics/debugshader.cpp index a0f38cd..789172e 100644 --- a/src/framework/graphics/debugshader.cpp +++ b/src/framework/graphics/debugshader.cpp @@ -38,16 +38,16 @@ DebugShader::~DebugShader() { } -BOOL DebugShader::Initialize(GraphicsDevice *graphicsDevice) +bool DebugShader::Initialize(GraphicsDevice *graphicsDevice) { if (!StandardShader::Initialize(graphicsDevice)) - return FALSE; + return false; - BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); - ASSERT(result == TRUE); + bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); + ASSERT(result == true); MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D); MapAttributeToStandardAttribType("a_color", VERTEX_STD_COLOR); - return TRUE; + return true; } diff --git a/src/framework/graphics/debugshader.h b/src/framework/graphics/debugshader.h index 75477bb..630f797 100644 --- a/src/framework/graphics/debugshader.h +++ b/src/framework/graphics/debugshader.h @@ -15,7 +15,7 @@ public: DebugShader(); virtual ~DebugShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); private: static const char *m_vertexShaderSource; diff --git a/src/framework/graphics/framebuffer.cpp b/src/framework/graphics/framebuffer.cpp index ddcd087..14f5f21 100644 --- a/src/framework/graphics/framebuffer.cpp +++ b/src/framework/graphics/framebuffer.cpp @@ -21,14 +21,14 @@ Framebuffer::Framebuffer() m_fixedHeight = 0; } -BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice) +bool Framebuffer::Initialize(GraphicsDevice *graphicsDevice) { ASSERT(m_framebufferName == 0); if (m_framebufferName != 0) - return FALSE; + return false; if (!GraphicsContextResource::Initialize(graphicsDevice)) - return FALSE; + return false; CreateFramebuffer(); @@ -36,24 +36,24 @@ BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice) m_fixedWidth = 0; m_fixedHeight = 0; - return TRUE; + return true; } -BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight) +bool Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight) { ASSERT(fixedWidth != 0); ASSERT(fixedHeight != 0); if (fixedWidth == 0 || fixedHeight == 0) - return FALSE; + return false; - BOOL createSuccess = Initialize(graphicsDevice); + bool createSuccess = Initialize(graphicsDevice); if (!createSuccess) - return FALSE; + return false; m_fixedWidth = fixedWidth; m_fixedHeight = fixedHeight; - return TRUE; + return true; } void Framebuffer::Release() @@ -98,18 +98,18 @@ void Framebuffer::CreateFramebuffer() GL_CALL(glGenFramebuffers(1, &m_framebufferName)); } -BOOL Framebuffer::AttachViewContext() +bool Framebuffer::AttachViewContext() { ASSERT(m_framebufferName != 0); if (m_framebufferName == 0) - return FALSE; + return false; ASSERT(m_viewContext == NULL); if (m_viewContext != NULL) - return FALSE; + return false; m_viewContext = new ViewContext(); - BOOL success; + bool success; if (IsUsingFixedDimensions()) success = m_viewContext->Create(GetGraphicsDevice(), Rect(0, 0, m_fixedWidth, m_fixedHeight)); else @@ -117,36 +117,36 @@ BOOL Framebuffer::AttachViewContext() if (!success) { SAFE_DELETE(m_viewContext); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type) +bool Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type) { ASSERT(m_framebufferName != 0); if (m_framebufferName == 0) - return FALSE; + return false; Texture *existing = GetTexture(type); ASSERT(existing == NULL); if (existing != NULL) - return FALSE; + return false; // also need to make sure a renderbuffer isn't already attached to this type! Renderbuffer *existingRenderbuffer = GetRenderbuffer(type); ASSERT(existingRenderbuffer == NULL); if (existingRenderbuffer != NULL) - return FALSE; + return false; // don't allow unsupported types! if (type == FRAMEBUFFER_DATA_NONE) - return FALSE; + return false; if (type == FRAMEBUFFER_DATA_DEPTH && !GetGraphicsDevice()->IsDepthTextureSupported()) - return FALSE; + return false; if (type == FRAMEBUFFER_DATA_STENCIL) - return FALSE; + return false; // determine texture format and framebuffer attachment type TEXTURE_FORMAT textureFormat; @@ -171,19 +171,19 @@ BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type) } ASSERT(attachmentType != 0); if (attachmentType == 0) - return FALSE; + return false; uint width = 0; uint height = 0; GetDimensionsForAttachment(width, height); Texture *attach = new Texture(); - BOOL textureSuccess = attach->Create(GetGraphicsDevice(), width, height, textureFormat); - ASSERT(textureSuccess == TRUE); + bool textureSuccess = attach->Create(GetGraphicsDevice(), width, height, textureFormat); + ASSERT(textureSuccess == true); if (!textureSuccess) { SAFE_DELETE(attach); - return FALSE; + return false; } GetGraphicsDevice()->BindFramebuffer(this); @@ -192,10 +192,10 @@ BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type) m_textures[type] = attach; - return TRUE; + return true; } -BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL releaseFirst) +bool Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, bool releaseFirst) { Texture *existing = itor->second; @@ -210,7 +210,7 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL } ASSERT(attachmentType != 0); if (attachmentType == 0) - return FALSE; + return false; uint width = 0; uint height = 0; @@ -221,38 +221,38 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL if (releaseFirst) existing->Release(); - BOOL textureSuccess = existing->Create(GetGraphicsDevice(), width, height, existingFormat); - ASSERT(textureSuccess == TRUE); + bool textureSuccess = existing->Create(GetGraphicsDevice(), width, height, existingFormat); + ASSERT(textureSuccess == true); if (!textureSuccess) - return FALSE; + return false; GetGraphicsDevice()->BindFramebuffer(this); GL_CALL(glFramebufferTexture2D(GL_FRAMEBUFFER, attachmentType, GL_TEXTURE_2D, existing->GetTextureName(), 0)); GetGraphicsDevice()->UnbindFramebuffer(this); - return TRUE; + return true; } -BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type) +bool Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type) { ASSERT(m_framebufferName != 0); if (m_framebufferName == 0) - return FALSE; + return false; Renderbuffer *existing = GetRenderbuffer(type); ASSERT(existing == NULL); if (existing != NULL) - return FALSE; + return false; // also need to make sure a texture isn't already attached to this type! Texture *existingTexture = GetTexture(type); ASSERT(existingTexture == NULL); if (existingTexture != NULL) - return FALSE; + return false; // don't allow unsupported types! if (type == FRAMEBUFFER_DATA_NONE) - return FALSE; + return false; // determine framebuffer attachment type GLenum attachmentType; @@ -266,19 +266,19 @@ BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type) } ASSERT(attachmentType != 0); if (attachmentType == 0) - return FALSE; + return false; uint width = 0; uint height = 0; GetDimensionsForAttachment(width, height); Renderbuffer *attach = new Renderbuffer(); - BOOL renderbufferSuccess = attach->Initialize(GetGraphicsDevice(), width, height, type); - ASSERT(renderbufferSuccess == TRUE); + bool renderbufferSuccess = attach->Initialize(GetGraphicsDevice(), width, height, type); + ASSERT(renderbufferSuccess == true); if (!renderbufferSuccess) { SAFE_DELETE(attach); - return FALSE; + return false; } GetGraphicsDevice()->BindFramebuffer(this); @@ -287,10 +287,10 @@ BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type) m_renderbuffers[type] = attach; - return TRUE; + return true; } -BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, BOOL releaseFirst) +bool Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, bool releaseFirst) { Renderbuffer *existing = itor->second; @@ -306,7 +306,7 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, } ASSERT(attachmentType != 0); if (attachmentType == 0) - return FALSE; + return false; uint width = 0; uint height = 0; @@ -317,46 +317,46 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, if (releaseFirst) existing->Release(); - BOOL renderbufferSuccess = existing->Initialize(GetGraphicsDevice(), width, height, existingType); - ASSERT(renderbufferSuccess == TRUE); + bool renderbufferSuccess = existing->Initialize(GetGraphicsDevice(), width, height, existingType); + ASSERT(renderbufferSuccess == true); if (!renderbufferSuccess) - return FALSE; + return false; GetGraphicsDevice()->BindFramebuffer(this); GL_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachmentType, GL_RENDERBUFFER, existing->GetRenderbufferName())); GetGraphicsDevice()->UnbindFramebuffer(this); - return TRUE; + return true; } -BOOL Framebuffer::ReleaseViewContext() +bool Framebuffer::ReleaseViewContext() { ASSERT(m_framebufferName != 0); if (m_framebufferName == 0) - return FALSE; + return false; ASSERT(m_viewContext != NULL); if (m_viewContext == NULL) - return FALSE; + return false; if (GetGraphicsDevice()->GetViewContext() == m_viewContext) GetGraphicsDevice()->SetViewContext(NULL); SAFE_DELETE(m_viewContext); - return TRUE; + return true; } -BOOL Framebuffer::ReleaseTexture(FRAMEBUFFER_DATA_TYPE type) +bool Framebuffer::ReleaseTexture(FRAMEBUFFER_DATA_TYPE type) { ASSERT(m_framebufferName != 0); if (m_framebufferName == 0) - return FALSE; + return false; Texture *existing = GetTexture(type); ASSERT(existing != NULL); if (existing == NULL) - return FALSE; + return false; // determine attachment type GLenum attachmentType; @@ -376,30 +376,30 @@ BOOL Framebuffer::ReleaseTexture(FRAMEBUFFER_DATA_TYPE type) } ASSERT(attachmentType != 0); if (attachmentType == 0) - return FALSE; + return false; GetGraphicsDevice()->BindFramebuffer(this); GL_CALL(glFramebufferTexture2D(GL_FRAMEBUFFER, attachmentType, GL_TEXTURE_2D, 0, 0)); GetGraphicsDevice()->UnbindFramebuffer(this); - BOOL removeSuccess = RemoveTexture(existing); - ASSERT(removeSuccess == TRUE); + bool removeSuccess = RemoveTexture(existing); + ASSERT(removeSuccess == true); if (!removeSuccess) - return FALSE; + return false; - return TRUE; + return true; } -BOOL Framebuffer::ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type) +bool Framebuffer::ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type) { ASSERT(m_framebufferName != 0); if (m_framebufferName == 0) - return FALSE; + return false; Renderbuffer *existing = GetRenderbuffer(type); ASSERT(existing != NULL); if (existing == NULL) - return FALSE; + return false; // determine attachment type GLenum attachmentType; @@ -419,18 +419,18 @@ BOOL Framebuffer::ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type) } ASSERT(attachmentType != 0); if (attachmentType == 0) - return FALSE; + return false; GetGraphicsDevice()->BindFramebuffer(this); GL_CALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, attachmentType, GL_RENDERBUFFER, 0)); GetGraphicsDevice()->UnbindFramebuffer(this); - BOOL removeSuccess = RemoveRenderbuffer(existing); - ASSERT(removeSuccess == TRUE); + bool removeSuccess = RemoveRenderbuffer(existing); + ASSERT(removeSuccess == true); if (!removeSuccess) - return FALSE; + return false; - return TRUE; + return true; } Texture* Framebuffer::GetTexture(FRAMEBUFFER_DATA_TYPE type) const @@ -497,8 +497,8 @@ void Framebuffer::OnNewContext() for (FramebufferTextureMap::iterator i = m_textures.begin(); i != m_textures.end(); ++i) { - BOOL success = ReCreateAndAttach(i, FALSE); - ASSERT(success == TRUE); + bool success = ReCreateAndAttach(i, false); + ASSERT(success == true); if (!success) { Release(); @@ -508,8 +508,8 @@ void Framebuffer::OnNewContext() for (FramebufferRenderbufferMap::iterator i = m_renderbuffers.begin(); i != m_renderbuffers.end(); ++i) { - BOOL success = ReCreateAndAttach(i, FALSE); - ASSERT(success == TRUE); + bool success = ReCreateAndAttach(i, false); + ASSERT(success == true); if (!success) { Release(); @@ -544,8 +544,8 @@ void Framebuffer::OnResize() for (FramebufferTextureMap::iterator i = m_textures.begin(); i != m_textures.end(); ++i) { - BOOL success = ReCreateAndAttach(i, TRUE); - ASSERT(success == TRUE); + bool success = ReCreateAndAttach(i, true); + ASSERT(success == true); if (!success) { Release(); @@ -555,8 +555,8 @@ void Framebuffer::OnResize() for (FramebufferRenderbufferMap::iterator i = m_renderbuffers.begin(); i != m_renderbuffers.end(); ++i) { - BOOL success = ReCreateAndAttach(i, TRUE); - ASSERT(success == TRUE); + bool success = ReCreateAndAttach(i, true); + ASSERT(success == true); if (!success) { Release(); @@ -574,7 +574,7 @@ void Framebuffer::OnUnBind() { } -BOOL Framebuffer::RemoveTexture(Texture *texture) +bool Framebuffer::RemoveTexture(Texture *texture) { for (FramebufferTextureMap::iterator i = m_textures.begin(); i != m_textures.end(); ++i) { @@ -582,14 +582,14 @@ BOOL Framebuffer::RemoveTexture(Texture *texture) { SAFE_DELETE(texture); m_textures.erase(i); - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer) +bool Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer) { for (FramebufferRenderbufferMap::iterator i = m_renderbuffers.begin(); i != m_renderbuffers.end(); ++i) { @@ -597,11 +597,11 @@ BOOL Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer) { SAFE_DELETE(renderbuffer); m_renderbuffers.erase(i); - return TRUE; + return true; } } - return FALSE; + return false; } void Framebuffer::GetDimensionsForAttachment(uint &width, uint &height) const diff --git a/src/framework/graphics/framebuffer.h b/src/framework/graphics/framebuffer.h index 87c26b1..c9da591 100644 --- a/src/framework/graphics/framebuffer.h +++ b/src/framework/graphics/framebuffer.h @@ -24,19 +24,19 @@ public: void Release(); - BOOL Initialize(GraphicsDevice *graphicsDevice); - BOOL Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight); + bool Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight); uint GetFramebufferName() const { return m_framebufferName; } - BOOL IsInvalidated() const { return m_framebufferName == 0; } - BOOL IsUsingFixedDimensions() const { return (m_fixedWidth != 0 && m_fixedHeight != 0); } + bool IsInvalidated() const { return m_framebufferName == 0; } + bool IsUsingFixedDimensions() const { return (m_fixedWidth != 0 && m_fixedHeight != 0); } - BOOL AttachViewContext(); - BOOL AttachTexture(FRAMEBUFFER_DATA_TYPE type); - BOOL AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type); - BOOL ReleaseViewContext(); - BOOL ReleaseTexture(FRAMEBUFFER_DATA_TYPE type); - BOOL ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type); + bool AttachViewContext(); + bool AttachTexture(FRAMEBUFFER_DATA_TYPE type); + bool AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type); + bool ReleaseViewContext(); + bool ReleaseTexture(FRAMEBUFFER_DATA_TYPE type); + bool ReleaseRenderbuffer(FRAMEBUFFER_DATA_TYPE type); ViewContext* GetViewContext() const { return m_viewContext; } Texture* GetTexture(FRAMEBUFFER_DATA_TYPE type) const; @@ -52,10 +52,10 @@ private: void CreateFramebuffer(); - BOOL ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL releaseFirst); - BOOL ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, BOOL releaseFirst); - BOOL RemoveTexture(Texture *texture); - BOOL RemoveRenderbuffer(Renderbuffer *renderbuffer); + bool ReCreateAndAttach(FramebufferTextureMap::iterator &itor, bool releaseFirst); + bool ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, bool releaseFirst); + bool RemoveTexture(Texture *texture); + bool RemoveRenderbuffer(Renderbuffer *renderbuffer); void GetDimensionsForAttachment(uint &width, uint &height) const; diff --git a/src/framework/graphics/geometrydebugrenderer.cpp b/src/framework/graphics/geometrydebugrenderer.cpp index 32b1096..253d1f0 100644 --- a/src/framework/graphics/geometrydebugrenderer.cpp +++ b/src/framework/graphics/geometrydebugrenderer.cpp @@ -16,7 +16,7 @@ #include "../math/point3.h" #include "../math/ray.h" -GeometryDebugRenderer::GeometryDebugRenderer(GraphicsDevice *graphicsDevice, BOOL depthTesting) +GeometryDebugRenderer::GeometryDebugRenderer(GraphicsDevice *graphicsDevice, bool depthTesting) { m_graphicsDevice = graphicsDevice; m_color1 = Color(1.0f, 1.0f, 0.0f); @@ -37,7 +37,7 @@ GeometryDebugRenderer::GeometryDebugRenderer(GraphicsDevice *graphicsDevice, BOO m_vertices->Initialize(attribs, 2, 16384, BUFFEROBJECT_USAGE_STREAM); m_currentVertex = 0; - m_begunRendering = FALSE; + m_begunRendering = false; } GeometryDebugRenderer::~GeometryDebugRenderer() @@ -49,12 +49,12 @@ GeometryDebugRenderer::~GeometryDebugRenderer() void GeometryDebugRenderer::Begin() { m_currentVertex = 0; - m_begunRendering = TRUE; + m_begunRendering = true; } void GeometryDebugRenderer::Render(const BoundingBox &box, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 24)); uint i = m_currentVertex; @@ -117,7 +117,7 @@ void GeometryDebugRenderer::Render(const Point3 &boxMin, const Point3 &boxMax, c void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 615)); uint p = m_currentVertex; @@ -178,7 +178,7 @@ void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &co void GeometryDebugRenderer::Render(const Ray &ray, float length, const Color &color1, const Color &color2) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 2)); Vector3 temp = ray.GetPositionAt(length); @@ -193,7 +193,7 @@ void GeometryDebugRenderer::Render(const Ray &ray, float length, const Color &co void GeometryDebugRenderer::Render(const LineSegment &line, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 2)); m_vertices->SetPosition3(m_currentVertex, line.a); @@ -206,7 +206,7 @@ void GeometryDebugRenderer::Render(const LineSegment &line, const Color &color) void GeometryDebugRenderer::Render(const Vector3 &a, const Vector3 &b, const Vector3 &c, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 6)); m_vertices->SetPosition3(m_currentVertex, a); @@ -227,7 +227,7 @@ void GeometryDebugRenderer::Render(const Vector3 &a, const Vector3 &b, const Vec void GeometryDebugRenderer::End() { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); if (m_currentVertex > 0) { @@ -247,5 +247,5 @@ void GeometryDebugRenderer::End() m_graphicsDevice->UnbindShader(); } - m_begunRendering = FALSE; + m_begunRendering = false; } diff --git a/src/framework/graphics/geometrydebugrenderer.h b/src/framework/graphics/geometrydebugrenderer.h index e18f15b..2809ccd 100644 --- a/src/framework/graphics/geometrydebugrenderer.h +++ b/src/framework/graphics/geometrydebugrenderer.h @@ -25,9 +25,9 @@ public: /** * Creates a geometry debug renderer. * @param graphicsDevice the graphics device to use for rendering - * @param depthTesting TRUE to enable depth testing for all geometry rendering + * @param depthTesting true to enable depth testing for all geometry rendering */ - GeometryDebugRenderer(GraphicsDevice *graphicsDevice, BOOL depthTesting = FALSE); + GeometryDebugRenderer(GraphicsDevice *graphicsDevice, bool depthTesting = false); virtual ~GeometryDebugRenderer(); @@ -126,7 +126,7 @@ private: VertexBuffer *m_vertices; uint m_currentVertex; - BOOL m_begunRendering; + bool m_begunRendering; }; inline void GeometryDebugRenderer::Render(const BoundingBox &box) diff --git a/src/framework/graphics/glutils.cpp b/src/framework/graphics/glutils.cpp index 9e64af1..5fa4e3a 100644 --- a/src/framework/graphics/glutils.cpp +++ b/src/framework/graphics/glutils.cpp @@ -3,14 +3,14 @@ #include "glutils.h" #include -BOOL IsGLExtensionPresent(const char* extension) +bool IsGLExtensionPresent(const char* extension) { ASSERT(extension != NULL); ASSERT(strlen(extension) > 0); const char* extensionsList = (const char*)glGetString(GL_EXTENSIONS); - return (strstr(extensionsList, extension) != NULL ? TRUE : FALSE); + return (strstr(extensionsList, extension) != NULL ? true : false); } const char* GetGLErrorString(GLenum error) diff --git a/src/framework/graphics/glutils.h b/src/framework/graphics/glutils.h index 24fefdf..4b62a5f 100644 --- a/src/framework/graphics/glutils.h +++ b/src/framework/graphics/glutils.h @@ -8,9 +8,9 @@ * Checks if an OpenGL extension is present in the current * implementation. This performs a case-sensitive string match. * @param extension the name of the extension to check for. - * @return TRUE if the extension is present, FALSE if not + * @return true if the extension is present, false if not */ -BOOL IsGLExtensionPresent(const char* extension); +bool IsGLExtensionPresent(const char* extension); /** * Converts a OpenGL error code to a string equivalent. diff --git a/src/framework/graphics/graphicscontextresource.cpp b/src/framework/graphics/graphicscontextresource.cpp index e416d49..db16ab2 100644 --- a/src/framework/graphics/graphicscontextresource.cpp +++ b/src/framework/graphics/graphicscontextresource.cpp @@ -16,27 +16,27 @@ void GraphicsContextResource::Release() m_graphicsDevice = NULL; } -BOOL GraphicsContextResource::Initialize() +bool GraphicsContextResource::Initialize() { ASSERT(m_graphicsDevice == NULL); if (m_graphicsDevice != NULL) - return FALSE; + return false; - return TRUE; + return true; } -BOOL GraphicsContextResource::Initialize(GraphicsDevice *graphicsDevice) +bool GraphicsContextResource::Initialize(GraphicsDevice *graphicsDevice) { ASSERT(m_graphicsDevice == NULL); if (m_graphicsDevice != NULL) - return FALSE; + return false; ASSERT(graphicsDevice != NULL); if (graphicsDevice == NULL) - return FALSE; + return false; m_graphicsDevice = graphicsDevice; m_graphicsDevice->RegisterManagedResource(this); - return TRUE; + return true; } diff --git a/src/framework/graphics/graphicscontextresource.h b/src/framework/graphics/graphicscontextresource.h index 090a3bb..54c49e5 100644 --- a/src/framework/graphics/graphicscontextresource.h +++ b/src/framework/graphics/graphicscontextresource.h @@ -31,8 +31,8 @@ public: GraphicsDevice* GetGraphicsDevice() const { return m_graphicsDevice; } protected: - BOOL Initialize(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(); + bool Initialize(GraphicsDevice *graphicsDevice); private: GraphicsDevice *m_graphicsDevice; diff --git a/src/framework/graphics/graphicsdevice.cpp b/src/framework/graphics/graphicsdevice.cpp index a9ffc4b..9cd729b 100644 --- a/src/framework/graphics/graphicsdevice.cpp +++ b/src/framework/graphics/graphicsdevice.cpp @@ -44,11 +44,11 @@ const unsigned int MAX_GPU_ATTRIB_SLOTS = 8; GraphicsDevice::GraphicsDevice() { - m_hasNewContextRunYet = FALSE; + m_hasNewContextRunYet = false; m_boundVertexBuffer = NULL; m_boundIndexBuffer = NULL; m_boundShader = NULL; - m_shaderVertexAttribsSet = FALSE; + m_shaderVertexAttribsSet = false; m_boundTextures = NULL; m_boundFramebuffer = NULL; m_boundRenderbuffer = NULL; @@ -64,22 +64,22 @@ GraphicsDevice::GraphicsDevice() m_sprite2dShader = NULL; m_sprite3dShader = NULL; m_debugShader = NULL; - m_isDepthTextureSupported = FALSE; - m_isNonPowerOfTwoTextureSupported = FALSE; + m_isDepthTextureSupported = false; + m_isNonPowerOfTwoTextureSupported = false; m_window = NULL; } -BOOL GraphicsDevice::Initialize(GameWindow *window) +bool GraphicsDevice::Initialize(GameWindow *window) { ASSERT(m_window == NULL); if (m_window != NULL) - return FALSE; + return false; ASSERT(window != NULL); if (window == NULL) - return FALSE; + return false; - m_hasNewContextRunYet = FALSE; + m_hasNewContextRunYet = false; m_boundTextures = new const Texture*[MAX_BOUND_TEXTURES]; m_enabledVertexAttribIndices.reserve(MAX_GPU_ATTRIB_SLOTS); @@ -106,7 +106,7 @@ BOOL GraphicsDevice::Initialize(GameWindow *window) m_solidColorTextures = new SolidColorTextureCache(this); - return TRUE; + return true; } void GraphicsDevice::Release() @@ -126,16 +126,16 @@ void GraphicsDevice::Release() m_enabledVertexAttribIndices.clear(); m_managedResources.clear(); - m_hasNewContextRunYet = FALSE; + m_hasNewContextRunYet = false; m_boundVertexBuffer = NULL; m_boundIndexBuffer = NULL; m_boundShader = NULL; - m_shaderVertexAttribsSet = FALSE; + m_shaderVertexAttribsSet = false; m_boundFramebuffer = NULL; m_boundRenderbuffer = NULL; m_activeViewContext = NULL; - m_isDepthTextureSupported = FALSE; - m_isNonPowerOfTwoTextureSupported = FALSE; + m_isDepthTextureSupported = false; + m_isNonPowerOfTwoTextureSupported = false; m_window = NULL; } @@ -256,7 +256,7 @@ void GraphicsDevice::OnNewContext() (*i)->OnNewContext(); } - m_hasNewContextRunYet = TRUE; + m_hasNewContextRunYet = true; } void GraphicsDevice::OnLostContext() @@ -317,7 +317,7 @@ void GraphicsDevice::BindTexture(const Texture *texture, uint unit) { ASSERT(unit < MAX_BOUND_TEXTURES); ASSERT(texture != NULL); - ASSERT(texture->IsInvalidated() == FALSE); + ASSERT(texture->IsInvalidated() == false); if (texture != m_boundTextures[unit]) { GL_CALL(glActiveTexture(GL_TEXTURE0 + unit)); @@ -356,7 +356,7 @@ void GraphicsDevice::UnbindTexture(const Texture *texture) void GraphicsDevice::BindRenderbuffer(Renderbuffer *renderbuffer) { ASSERT(renderbuffer != NULL); - ASSERT(renderbuffer->IsInvalidated() == FALSE); + ASSERT(renderbuffer->IsInvalidated() == false); if (m_boundRenderbuffer != renderbuffer) { GL_CALL(glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer->GetRenderbufferName())); @@ -383,7 +383,7 @@ void GraphicsDevice::UnbindRenderBuffer(Renderbuffer *renderBuffer) void GraphicsDevice::BindFramebuffer(Framebuffer *framebuffer) { ASSERT(framebuffer != NULL); - ASSERT(framebuffer->IsInvalidated() == FALSE); + ASSERT(framebuffer->IsInvalidated() == false); if (m_boundFramebuffer != framebuffer) { GL_CALL(glBindFramebuffer(GL_FRAMEBUFFER, framebuffer->GetFramebufferName())); @@ -505,7 +505,7 @@ void GraphicsDevice::UnbindIndexBuffer() void GraphicsDevice::BindShader(Shader *shader) { ASSERT(shader != NULL); - ASSERT(shader->IsReadyForUse() == TRUE); + ASSERT(shader->IsReadyForUse() == true); GL_CALL(glUseProgram(shader->GetProgramId())); m_boundShader = shader; @@ -557,7 +557,7 @@ void GraphicsDevice::SetShaderVertexAttributes() { ASSERT(m_boundVertexBuffer != NULL); ASSERT(m_boundShader != NULL); - ASSERT(m_enabledVertexAttribIndices.empty() == TRUE); + ASSERT(m_enabledVertexAttribIndices.empty() == true); ASSERT(m_boundVertexBuffer->GetNumAttributes() >= m_boundShader->GetNumAttributes()); uint numAttributes = m_boundShader->GetNumAttributes(); @@ -593,12 +593,12 @@ void GraphicsDevice::SetShaderVertexAttributes() buffer = (int8_t*)NULL + (offset * sizeof(float)); GL_CALL(glEnableVertexAttribArray(i)); - GL_CALL(glVertexAttribPointer(i, size, GL_FLOAT, FALSE, m_boundVertexBuffer->GetElementWidthInBytes(), buffer)); + GL_CALL(glVertexAttribPointer(i, size, GL_FLOAT, false, m_boundVertexBuffer->GetElementWidthInBytes(), buffer)); m_enabledVertexAttribIndices.push_back(i); } - m_shaderVertexAttribsSet = TRUE; + m_shaderVertexAttribsSet = true; } void GraphicsDevice::ClearSetShaderVertexAttributes() @@ -610,13 +610,13 @@ void GraphicsDevice::ClearSetShaderVertexAttributes() GL_CALL(glDisableVertexAttribArray(index)); } - m_shaderVertexAttribsSet = FALSE; + m_shaderVertexAttribsSet = false; } void GraphicsDevice::RenderTriangles(const IndexBuffer *buffer) { ASSERT(buffer != NULL); - ASSERT(buffer->IsClientSideBuffer() == TRUE); + ASSERT(buffer->IsClientSideBuffer() == true); ASSERT(m_boundVertexBuffer != NULL); ASSERT(m_boundIndexBuffer == NULL); if (!m_shaderVertexAttribsSet) @@ -692,7 +692,7 @@ void GraphicsDevice::RenderTriangles(uint startVertex, uint numTriangles) void GraphicsDevice::RenderLines(const IndexBuffer *buffer) { ASSERT(buffer != NULL); - ASSERT(buffer->IsClientSideBuffer() == TRUE); + ASSERT(buffer->IsClientSideBuffer() == true); ASSERT(m_boundVertexBuffer != NULL); ASSERT(m_boundIndexBuffer == NULL); if (!m_shaderVertexAttribsSet) @@ -768,7 +768,7 @@ void GraphicsDevice::RenderLines(uint startVertex, uint numLines) void GraphicsDevice::RenderPoints(const IndexBuffer *buffer) { ASSERT(buffer != NULL); - ASSERT(buffer->IsClientSideBuffer() == TRUE); + ASSERT(buffer->IsClientSideBuffer() == true); ASSERT(m_boundVertexBuffer != NULL); ASSERT(m_boundIndexBuffer == NULL); if (!m_shaderVertexAttribsSet) diff --git a/src/framework/graphics/graphicsdevice.h b/src/framework/graphics/graphicsdevice.h index bf0a4c2..0846bf3 100644 --- a/src/framework/graphics/graphicsdevice.h +++ b/src/framework/graphics/graphicsdevice.h @@ -55,9 +55,9 @@ public: * Initializes the graphics device object based on a parent window that is * hosting the OpenGL context. * @param window a window with an active OpenGL context associated with it - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GameWindow *window); + bool Initialize(GameWindow *window); /** * New OpenGL graphics context creation callback. @@ -345,15 +345,15 @@ public: DebugShader* GetDebugShader(); /** - * @return TRUE if depth textures are supported + * @return true if depth textures are supported */ - BOOL IsDepthTextureSupported() const { return m_isDepthTextureSupported; } + bool IsDepthTextureSupported() const { return m_isDepthTextureSupported; } /** - * @return TRUE if textures with dimensions that are not a power of two + * @return true if textures with dimensions that are not a power of two * are supported */ - BOOL IsNonPowerOfTwoTextureSupported() const { return m_isNonPowerOfTwoTextureSupported; } + bool IsNonPowerOfTwoTextureSupported() const { return m_isNonPowerOfTwoTextureSupported; } /** * @return the parent window object that this graphics device is for @@ -366,7 +366,7 @@ private: void BindIBO(IndexBuffer *buffer); void BindClientBuffer(IndexBuffer *buffer); - BOOL IsReadyToRender() const; + bool IsReadyToRender() const; void SetShaderVertexAttributes(); void ClearSetShaderVertexAttributes(); @@ -379,10 +379,10 @@ private: const IndexBuffer *m_boundIndexBuffer; const Texture **m_boundTextures; Shader *m_boundShader; - BOOL m_shaderVertexAttribsSet; + bool m_shaderVertexAttribsSet; EnabledVertexAttribList m_enabledVertexAttribIndices; - BOOL m_isDepthTextureSupported; - BOOL m_isNonPowerOfTwoTextureSupported; + bool m_isDepthTextureSupported; + bool m_isNonPowerOfTwoTextureSupported; GameWindow *m_window; ViewContext *m_defaultViewContext; @@ -401,7 +401,7 @@ private: Sprite3DShader *m_sprite3dShader; DebugShader *m_debugShader; - BOOL m_hasNewContextRunYet; + bool m_hasNewContextRunYet; }; inline void GraphicsDevice::SetTextureParameters(const TextureParameters ¶ms) @@ -409,12 +409,12 @@ inline void GraphicsDevice::SetTextureParameters(const TextureParameters ¶ms m_currentTextureParams = params; } -inline BOOL GraphicsDevice::IsReadyToRender() const +inline bool GraphicsDevice::IsReadyToRender() const { if (m_boundShader != NULL && m_boundVertexBuffer != NULL && m_shaderVertexAttribsSet) - return TRUE; + return true; else - return FALSE; + return false; } #endif diff --git a/src/framework/graphics/image.cpp b/src/framework/graphics/image.cpp index ce1e647..b310a71 100644 --- a/src/framework/graphics/image.cpp +++ b/src/framework/graphics/image.cpp @@ -32,16 +32,16 @@ void Image::Release() } -BOOL Image::Create(uint width, uint height, IMAGE_FORMAT format) +bool Image::Create(uint width, uint height, IMAGE_FORMAT format) { ASSERT(m_pixels == NULL); if (m_pixels != NULL) - return FALSE; + return false; ASSERT(width != 0); ASSERT(height != 0); if (width == 0 || height == 0) - return FALSE; + return false; int bpp = 0; if (format == IMAGE_FORMAT_RGB) @@ -53,7 +53,7 @@ BOOL Image::Create(uint width, uint height, IMAGE_FORMAT format) ASSERT(bpp != 0); if (bpp == 0) - return FALSE; + return false; uint pixelsLength = (width * height) * (bpp / 8); m_pixels = new uint8_t[pixelsLength]; @@ -65,59 +65,59 @@ BOOL Image::Create(uint width, uint height, IMAGE_FORMAT format) m_format = format; m_pitch = width * (bpp / 8); - return TRUE; + return true; } -BOOL Image::Create(const Image *source) +bool Image::Create(const Image *source) { ASSERT(source != NULL); if (source == NULL) - return FALSE; + return false; else return Create(source, 0, 0, source->GetWidth(), source->GetHeight()); } -BOOL Image::Create(const Image *source, uint x, uint y, uint width, uint height) +bool Image::Create(const Image *source, uint x, uint y, uint width, uint height) { ASSERT(m_pixels == NULL); if (m_pixels != NULL) - return FALSE; + return false; ASSERT(source != NULL); if (source == NULL) - return FALSE; + return false; ASSERT(source->GetPixels() != NULL); if (source->GetPixels() == NULL) - return FALSE; + return false; ASSERT(x < source->GetWidth()); ASSERT(y < source->GetHeight()); ASSERT((x + width) <= source->GetWidth()); ASSERT((y + height) <= source->GetHeight()); - BOOL baseCreateSuccess = Create(width, height, source->GetFormat()); + bool baseCreateSuccess = Create(width, height, source->GetFormat()); if (!baseCreateSuccess) - return FALSE; + return false; Copy(source, x, y, width, height, 0, 0); - return TRUE; + return true; } -BOOL Image::Create(File *file) +bool Image::Create(File *file) { ASSERT(m_pixels == NULL); if (m_pixels != NULL) - return FALSE; + return false; ASSERT(file != NULL); if (file == NULL) - return FALSE; + return false; ASSERT(file->IsOpen()); if (!file->IsOpen()) - return FALSE; + return false; uint8_t *imageFileBytes = NULL; size_t imageFileSize = file->GetFileSize(); @@ -147,7 +147,7 @@ BOOL Image::Create(File *file) if (file->GetFileType() != FILETYPE_MEMORY) SAFE_DELETE_ARRAY(imageFileBytes); - return FALSE; + return false; } else { @@ -166,7 +166,7 @@ BOOL Image::Create(File *file) { ASSERT(!"Unrecognized componentsPerPixel value."); stbi_image_free(pixels); - return FALSE; + return false; } // copy from STB "owned" memory to our own, then free up the STB stuff @@ -183,7 +183,7 @@ BOOL Image::Create(File *file) m_format = format; m_pitch = width * componentsPerPixel; - return TRUE; + return true; } } diff --git a/src/framework/graphics/image.h b/src/framework/graphics/image.h index 5288031..e2c45e8 100644 --- a/src/framework/graphics/image.h +++ b/src/framework/graphics/image.h @@ -26,16 +26,16 @@ public: * @param width the width of the image * @param height the height of the image * @param format the pixel format of the image - * @return TRUE if successful + * @return true if successful */ - BOOL Create(uint width, uint height, IMAGE_FORMAT format); + bool Create(uint width, uint height, IMAGE_FORMAT format); /** * Creates a copy of an image from another image object. * @param source the source image object to copy - * @return TRUE if successful + * @return true if successful */ - BOOL Create(const Image *source); + bool Create(const Image *source); /** * Creates a copy of a subsection of an image. @@ -44,16 +44,16 @@ public: * @param y top Y coordinate of the source region to copy * @param width the width of the source region to copy * @param height the height of the source region to copy - * @return TRUE if successful + * @return true if successful */ - BOOL Create(const Image *source, uint x, uint y, uint width, uint height); + bool Create(const Image *source, uint x, uint y, uint width, uint height); /** * Creates an image from an image file. * @param file the file to load as an image - * @return TRUE if successful + * @return true if successful */ - BOOL Create(File *file); + bool Create(File *file); /** * Frees all image resources. diff --git a/src/framework/graphics/indexbuffer.cpp b/src/framework/graphics/indexbuffer.cpp index f1f0c9f..b7d75a4 100644 --- a/src/framework/graphics/indexbuffer.cpp +++ b/src/framework/graphics/indexbuffer.cpp @@ -18,53 +18,53 @@ void IndexBuffer::Release() BufferObject::Release(); } -BOOL IndexBuffer::Initialize(uint numIndices, BUFFEROBJECT_USAGE usage) +bool IndexBuffer::Initialize(uint numIndices, BUFFEROBJECT_USAGE usage) { return Initialize(NULL, numIndices, usage); } -BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage) +bool IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage) { ASSERT(m_buffer.size() == 0); if (m_buffer.size() > 0) - return FALSE; + return false; ASSERT(numIndices > 0); if (numIndices == 0) - return FALSE; + return false; if (!BufferObject::Initialize(graphicsDevice, BUFFEROBJECT_TYPE_INDEX, usage)) - return FALSE; + return false; Resize(numIndices); - return TRUE; + return true; } -BOOL IndexBuffer::Initialize(const IndexBuffer *source) +bool IndexBuffer::Initialize(const IndexBuffer *source) { return Initialize(NULL, source); } -BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source) +bool IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source) { ASSERT(m_buffer.size() == 0); if (m_buffer.size() > 0) - return FALSE; + return false; ASSERT(source != NULL); if (source == NULL) - return FALSE; + return false; ASSERT(source->GetNumElements() > 0); if (source->GetNumElements() == 0) - return FALSE; + return false; Resize(source->GetNumElements()); memcpy(&m_buffer[0], source->GetBuffer(), GetNumElements() * GetElementWidthInBytes()); - return TRUE; + return true; } void IndexBuffer::Set(const uint16_t *indices, uint numIndices) diff --git a/src/framework/graphics/indexbuffer.h b/src/framework/graphics/indexbuffer.h index 917a112..45e1e03 100644 --- a/src/framework/graphics/indexbuffer.h +++ b/src/framework/graphics/indexbuffer.h @@ -28,9 +28,9 @@ public: * Initializes the index buffer. * @param numIndices the initial number of indices the buffer should hold * @param usage the expected usage pattern of this index buffer - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(uint numIndices, BUFFEROBJECT_USAGE usage); + bool Initialize(uint numIndices, BUFFEROBJECT_USAGE usage); /** * Initializes the index buffer. @@ -38,25 +38,25 @@ public: * on the GPU * @param numIndices the initial number of indices the buffer should hold * @param usage the expected usage pattern of this index buffer - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage); + bool Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage); /** * Initializes the index buffer. * @param source the source buffer to copy during creation of this buffer - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(const IndexBuffer *source); + bool Initialize(const IndexBuffer *source); /** * Initializes the index buffer. * @param graphicsDevice the graphics device to use to create this buffer * on the GPU * @param source the source buffer to copy during creation of this buffer - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source); + bool Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer *source); /** * Copies the source indices over top of this buffer's existing indices. @@ -74,17 +74,17 @@ public: /** * Moves the current index position to the next position. - * @return TRUE if the move succeeded, FALSE if there is no more indices + * @return true if the move succeeded, false if there is no more indices * to move to after this one */ - BOOL MoveNext(); + bool MoveNext(); /** * Moves the current index position to the previous position. - * @return TRUE if the move succeeded, FALSE if there is no more indices + * @return true if the move succeeded, false if there is no more indices * to move to before the current one */ - BOOL MovePrevious(); + bool MovePrevious(); /** * Moves the current index position by the specified amount relative @@ -168,26 +168,26 @@ inline void IndexBuffer::SetIndex(uint index, uint16_t value) m_buffer[index] = value; } -inline BOOL IndexBuffer::MoveNext() +inline bool IndexBuffer::MoveNext() { ++m_currentIndex; if (m_currentIndex >= GetNumElements()) { --m_currentIndex; - return FALSE; + return false; } else - return TRUE; + return true; } -inline BOOL IndexBuffer::MovePrevious() +inline bool IndexBuffer::MovePrevious() { if (m_currentIndex == 0) - return FALSE; + return false; else { --m_currentIndex; - return TRUE; + return true; } } diff --git a/src/framework/graphics/renderbuffer.cpp b/src/framework/graphics/renderbuffer.cpp index 0e063e2..a1f2c06 100644 --- a/src/framework/graphics/renderbuffer.cpp +++ b/src/framework/graphics/renderbuffer.cpp @@ -15,20 +15,20 @@ Renderbuffer::Renderbuffer() m_type = FRAMEBUFFER_DATA_NONE; } -BOOL Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type) +bool Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type) { ASSERT(m_renderbufferName == 0); if (m_renderbufferName != 0) - return FALSE; + return false; if (!GraphicsContextResource::Initialize(graphicsDevice)) - return FALSE; + return false; m_width = width; m_height = height; m_type = type; - BOOL success = CreateRenderbuffer(); + bool success = CreateRenderbuffer(); if (!success) { m_width = 0; @@ -54,7 +54,7 @@ void Renderbuffer::Release() GraphicsContextResource::Release(); } -BOOL Renderbuffer::CreateRenderbuffer() +bool Renderbuffer::CreateRenderbuffer() { ASSERT(m_renderbufferName == 0); @@ -95,7 +95,7 @@ BOOL Renderbuffer::CreateRenderbuffer() #endif ASSERT(format != 0); if (format == 0) - return FALSE; + return false; GL_CALL(glGenRenderbuffers(1, &m_renderbufferName)); @@ -108,15 +108,15 @@ BOOL Renderbuffer::CreateRenderbuffer() // object that this will get attached to manage that for itself... GetGraphicsDevice()->UnbindRenderbuffer(); - return TRUE; + return true; } void Renderbuffer::OnNewContext() { if (m_renderbufferName == 0 && GetGraphicsDevice() != NULL) { - BOOL success = CreateRenderbuffer(); - ASSERT(success == TRUE); + bool success = CreateRenderbuffer(); + ASSERT(success == true); } } diff --git a/src/framework/graphics/renderbuffer.h b/src/framework/graphics/renderbuffer.h index fc8c06f..cfe9e5d 100644 --- a/src/framework/graphics/renderbuffer.h +++ b/src/framework/graphics/renderbuffer.h @@ -29,9 +29,9 @@ public: * @param width the width of the renderbuffer in pixels * @param height the height of the renderbuffer in pixels * @param format the type of data this renderbuffer contains - * @return TRUE if the renderbuffer was created successfully + * @return true if the renderbuffer was created successfully */ - BOOL Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type); + bool Initialize(GraphicsDevice *graphicsDevice, uint width, uint height, FRAMEBUFFER_DATA_TYPE type); /** * @return the name or ID assigned to this renderbuffer by OpenGL @@ -54,9 +54,9 @@ public: FRAMEBUFFER_DATA_TYPE GetType() const { return m_type; } /** - * @return TRUE if the renderbuffer has been marked as invalid and needs to be recreated + * @return true if the renderbuffer has been marked as invalid and needs to be recreated */ - BOOL IsInvalidated() const { return m_renderbufferName == 0; } + bool IsInvalidated() const { return m_renderbufferName == 0; } /** * New OpenGL graphics context creation callback. @@ -69,7 +69,7 @@ public: void OnLostContext(); private: - BOOL CreateRenderbuffer(); + bool CreateRenderbuffer(); uint m_renderbufferName; uint m_width; diff --git a/src/framework/graphics/renderstate.cpp b/src/framework/graphics/renderstate.cpp index ffeb892..237c0b6 100644 --- a/src/framework/graphics/renderstate.cpp +++ b/src/framework/graphics/renderstate.cpp @@ -14,9 +14,9 @@ RenderState::~RenderState() void RenderState::Initialize() { - m_depthTesting = TRUE; + m_depthTesting = true; m_depthFunction = DEPTH_LESS; - m_faceCulling = TRUE; + m_faceCulling = true; m_faceCullingMode = BACK; m_lineWidth = 1.0f; } diff --git a/src/framework/graphics/renderstate.h b/src/framework/graphics/renderstate.h index d8da13c..c8673ff 100644 --- a/src/framework/graphics/renderstate.h +++ b/src/framework/graphics/renderstate.h @@ -43,9 +43,9 @@ public: void Apply() const; /** - * @return TRUE if depth testing is enabled + * @return true if depth testing is enabled */ - BOOL GetDepthTesting() const { return m_depthTesting; } + bool GetDepthTesting() const { return m_depthTesting; } /** * @return the depth testing function @@ -53,9 +53,9 @@ public: DEPTH_FUNCTION GetDepthFunction() const { return m_depthFunction; } /** - * @return TRUE if polygons are being culled based on their vertices winding + * @return true if polygons are being culled based on their vertices winding */ - BOOL GetFaceCulling() const { return m_faceCulling; } + bool GetFaceCulling() const { return m_faceCulling; } /** * @return the polygon cull mode @@ -70,7 +70,7 @@ public: /** * Toggles depth testing on/off. */ - void SetDepthTesting(BOOL enable) { m_depthTesting = enable; } + void SetDepthTesting(bool enable) { m_depthTesting = enable; } /** * Sets the depth testing function. @@ -80,7 +80,7 @@ public: /** * Toggles polygon culling based on their vertices winding on/off. */ - void SetFaceCulling(BOOL enable) { m_faceCulling = enable; } + void SetFaceCulling(bool enable) { m_faceCulling = enable; } /** * Sets the polygon culling mode. @@ -97,9 +97,9 @@ private: void SetFaceCulling() const; int FindDepthFunctionValue(DEPTH_FUNCTION function) const; - BOOL m_depthTesting; + bool m_depthTesting; DEPTH_FUNCTION m_depthFunction; - BOOL m_faceCulling; + bool m_faceCulling; CULL_MODE m_faceCullingMode; float m_lineWidth; }; diff --git a/src/framework/graphics/shader.cpp b/src/framework/graphics/shader.cpp index 92b58ac..a5e14ed 100644 --- a/src/framework/graphics/shader.cpp +++ b/src/framework/graphics/shader.cpp @@ -32,12 +32,12 @@ STATIC_ASSERT(sizeof(Point3) == 3 * sizeof(int)); Shader::Shader() { - m_isBound = FALSE; + m_isBound = false; m_cachedVertexShaderSource = NULL; m_cachedFragmentShaderSource = NULL; - m_vertexShaderCompileStatus = FALSE; - m_fragmentShaderCompileStatus = FALSE; - m_linkStatus = FALSE; + m_vertexShaderCompileStatus = 0; + m_fragmentShaderCompileStatus = 0; + m_linkStatus = 0; m_vertexShaderId = 0; m_fragmentShaderId = 0; m_programId = 0; @@ -45,44 +45,44 @@ Shader::Shader() m_numAttributes = 0; } -BOOL Shader::Initialize(GraphicsDevice *graphicsDevice) +bool Shader::Initialize(GraphicsDevice *graphicsDevice) { if (!GraphicsContextResource::Initialize(graphicsDevice)) - return FALSE; + return false; - return TRUE; + return true; } -BOOL Shader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) +bool Shader::Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource) { if (!GraphicsContextResource::Initialize(graphicsDevice)) - return FALSE; + return false; ASSERT(vertexShaderSource != NULL); if (vertexShaderSource == NULL) - return FALSE; + return false; ASSERT(fragmentShaderSource != NULL); if (fragmentShaderSource == NULL) - return FALSE; + return false; if (!LoadCompileAndLink(vertexShaderSource, fragmentShaderSource)) - return FALSE; + return false; CacheShaderSources(vertexShaderSource, fragmentShaderSource); - return TRUE; + return true; } -BOOL Shader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) +bool Shader::Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource) { ASSERT(vertexShaderSource != NULL && vertexShaderSource->GetLength() > 0); if (vertexShaderSource == NULL || vertexShaderSource->GetLength() == 0) - return FALSE; + return false; ASSERT(fragmentShaderSource != NULL && fragmentShaderSource->GetLength() > 0); if (fragmentShaderSource == NULL && fragmentShaderSource->GetLength() == 0) - return FALSE; + return false; return Initialize(graphicsDevice, vertexShaderSource->GetText(), fragmentShaderSource->GetText()); } @@ -117,12 +117,12 @@ void Shader::Release() SAFE_DELETE_ARRAY(m_cachedFragmentShaderSource); } - m_isBound = FALSE; + m_isBound = false; m_cachedVertexShaderSource = NULL; m_cachedFragmentShaderSource = NULL; - m_vertexShaderCompileStatus = FALSE; - m_fragmentShaderCompileStatus = FALSE; - m_linkStatus = FALSE; + m_vertexShaderCompileStatus = 0; + m_fragmentShaderCompileStatus = 0; + m_linkStatus = 0; m_vertexShaderId = 0; m_fragmentShaderId = 0; m_programId = 0; @@ -136,7 +136,7 @@ void Shader::Release() GraphicsContextResource::Release(); } -BOOL Shader::LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource) +bool Shader::LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource) { const char *vertexShaderToLoad = vertexShaderSource; const char *fragmentShaderToLoad = fragmentShaderSource; @@ -152,24 +152,24 @@ BOOL Shader::LoadCompileAndLink(const char *vertexShaderSource, const char *frag ASSERT(fragmentShaderToLoad != NULL); if (!Compile(vertexShaderToLoad, fragmentShaderToLoad)) - return FALSE; + return false; if (!Link()) - return FALSE; + return false; LoadUniformInfo(); LoadAttributeInfo(); - return TRUE; + return true; } -BOOL Shader::ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource) +bool Shader::ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource) { // clear out data that will be reset during the reload first - m_isBound = FALSE; - m_vertexShaderCompileStatus = FALSE; - m_fragmentShaderCompileStatus = FALSE; - m_linkStatus = FALSE; + m_isBound = false; + m_vertexShaderCompileStatus = 0; + m_fragmentShaderCompileStatus = 0; + m_linkStatus = 0; m_vertexShaderId = 0; m_fragmentShaderId = 0; m_programId = 0; @@ -216,7 +216,7 @@ void Shader::CacheShaderSources(const char *vertexShaderSource, const char *frag } } -BOOL Shader::Compile(const char *vertexShaderSource, const char *fragmentShaderSource) +bool Shader::Compile(const char *vertexShaderSource, const char *fragmentShaderSource) { ASSERT(m_vertexShaderId == 0); ASSERT(m_fragmentShaderId == 0); @@ -292,12 +292,12 @@ BOOL Shader::Compile(const char *vertexShaderSource, const char *fragmentShaderS // only return success if both compiled successfully if (m_fragmentShaderCompileStatus && m_vertexShaderCompileStatus) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL Shader::Link() +bool Shader::Link() { ASSERT(m_vertexShaderId != 0); ASSERT(m_fragmentShaderId != 0); @@ -434,7 +434,7 @@ void Shader::LoadAttributeInfo() attribute.location = (uint)location; attribute.type = (uint)type; attribute.size = (uint)size; - attribute.isTypeBound = FALSE; + attribute.isTypeBound = false; stl::string name = attributeName; m_attributes[name] = attribute; @@ -443,13 +443,13 @@ void Shader::LoadAttributeInfo() SAFE_DELETE_ARRAY(attributeName); } -BOOL Shader::HasUniform(const stl::string &name) const +bool Shader::HasUniform(const stl::string &name) const { ShaderUniformMap::const_iterator i = m_uniforms.find(name); if (i == m_uniforms.end()) - return FALSE; + return false; else - return TRUE; + return true; } const ShaderUniform* Shader::GetUniform(const stl::string &name) const @@ -470,13 +470,13 @@ ShaderUniform* Shader::GetUniform(const stl::string &name) return &i->second; } -BOOL Shader::HasAttribute(const stl::string &name) const +bool Shader::HasAttribute(const stl::string &name) const { ShaderAttributeMap::const_iterator i = m_attributes.find(name); if (i == m_attributes.end()) - return FALSE; + return false; else - return TRUE; + return true; } const ShaderAttribute* Shader::GetAttribute(const stl::string &name) const @@ -516,7 +516,7 @@ CachedShaderUniform* Shader::GetCachedUniform(const stl::string &name) void Shader::FlushCachedUniforms() { - ASSERT(m_isBound == TRUE); + ASSERT(m_isBound == true); if (m_cachedUniforms.empty()) return; @@ -851,7 +851,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix3x3 &m) const ShaderUniform *uniform = GetUniform(name); ASSERT(uniform != NULL); ASSERT(uniform->size == 1); - GL_CALL(glUniformMatrix3fv(uniform->location, 1, FALSE, m.m)); + GL_CALL(glUniformMatrix3fv(uniform->location, 1, false, m.m)); } else { @@ -869,7 +869,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 &m) const ShaderUniform *uniform = GetUniform(name); ASSERT(uniform != NULL); ASSERT(uniform->size == 1); - GL_CALL(glUniformMatrix4fv(uniform->location, 1, FALSE, m.m)); + GL_CALL(glUniformMatrix4fv(uniform->location, 1, false, m.m)); } else { @@ -998,7 +998,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix3x3 *m, uint count) ASSERT(uniform != NULL); ASSERT(uniform->size >= count); - GL_CALL(glUniformMatrix3fv(uniform->location, count, FALSE, values)); + GL_CALL(glUniformMatrix3fv(uniform->location, count, false, values)); } else { @@ -1017,7 +1017,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint count) ASSERT(uniform != NULL); ASSERT(uniform->size >= count); - GL_CALL(glUniformMatrix4fv(uniform->location, count, FALSE, values)); + GL_CALL(glUniformMatrix4fv(uniform->location, count, false, values)); } else { @@ -1032,10 +1032,10 @@ void Shader::MapAttributeToVboAttribIndex(const stl::string &name, uint vboAttri ASSERT(attribute->location < m_numAttributes); ShaderAttributeMapInfo *mappingInfo = &m_attributeMapping[attribute->location]; - mappingInfo->usesStandardType = FALSE; + mappingInfo->usesStandardType = false; mappingInfo->attribIndex = vboAttribIndex; - attribute->isTypeBound = TRUE; + attribute->isTypeBound = true; } void Shader::MapAttributeToStandardAttribType(const stl::string &name, VERTEX_STANDARD_ATTRIBS standardAttribType) @@ -1045,10 +1045,10 @@ void Shader::MapAttributeToStandardAttribType(const stl::string &name, VERTEX_ST ASSERT(attribute->location < m_numAttributes); ShaderAttributeMapInfo *mappingInfo = &m_attributeMapping[attribute->location]; - mappingInfo->usesStandardType = TRUE; + mappingInfo->usesStandardType = true; mappingInfo->standardType = standardAttribType; - attribute->isTypeBound = TRUE; + attribute->isTypeBound = true; } void Shader::OnNewContext() @@ -1062,14 +1062,14 @@ void Shader::OnLostContext() void Shader::OnBind() { - ASSERT(m_isBound == FALSE); - m_isBound = TRUE; + ASSERT(m_isBound == false); + m_isBound = true; FlushCachedUniforms(); } void Shader::OnUnbind() { - ASSERT(m_isBound == TRUE); - m_isBound = FALSE; + ASSERT(m_isBound == true); + m_isBound = false; m_cachedUniforms.clear(); } diff --git a/src/framework/graphics/shader.h b/src/framework/graphics/shader.h index e44cd7a..b56aa73 100644 --- a/src/framework/graphics/shader.h +++ b/src/framework/graphics/shader.h @@ -41,9 +41,9 @@ public: * @param graphicsDevice the graphics device to associate this shader with * @param vertexShaderSource GLSL source for a vertex shader * @param fragmentShaderSource GLSL source for a vertex shader - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - virtual BOOL Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); + virtual bool Initialize(GraphicsDevice *graphicsDevice, const char *vertexShaderSource, const char *fragmentShaderSource); /** * Initializes the shader object using the given vertex and fragment shader @@ -51,36 +51,36 @@ public: * @param graphicsDevice the graphics device to associate this shader with * @param vertexShaderSource GLSL source for a vertex shader * @param fragmentShaderSource GLSL source for a vertex shader - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - virtual BOOL Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); + virtual bool Initialize(GraphicsDevice *graphicsDevice, const Text *vertexShaderSource, const Text *fragmentShaderSource); /** - * @return TRUE if this shader has been compiled and linked into a program + * @return true if this shader has been compiled and linked into a program * that can be bound and rendered with */ - BOOL IsReadyForUse() const; + bool IsReadyForUse() const; /** - * @return TRUE if this shader is currently bound to the graphics device + * @return true if this shader is currently bound to the graphics device */ - BOOL IsBound() const { return m_isBound; } + bool IsBound() const { return m_isBound; } /** - * @return TRUE if the vertex shader was compiled without errors + * @return true if the vertex shader was compiled without errors */ - BOOL GetVertexShaderCompileStatus() const { return m_vertexShaderCompileStatus; } + bool GetVertexShaderCompileStatus() const { return m_vertexShaderCompileStatus; } /** - * @return TRUE if the fragment shader was compiled without errors + * @return true if the fragment shader was compiled without errors */ - BOOL GetFragmentShaderCompileStatus() const { return m_fragmentShaderCompileStatus; } + bool GetFragmentShaderCompileStatus() const { return m_fragmentShaderCompileStatus; } /** - * @return TRUE if the compiled vertex and fragment shaders were linked + * @return true if the compiled vertex and fragment shaders were linked * without errors */ - BOOL GetLinkStatus() const { return m_linkStatus; } + bool GetLinkStatus() const { return m_linkStatus; } /** * @return the OpenGL program ID that can be bound @@ -91,18 +91,18 @@ public: * Checks if this shader contains a uniform. Note that the GLSL compiler * could optimize out uniforms if they aren't used in the GLSL code. * @param name the name of the uniform to check for - * @return TRUE if the uniform is present + * @return true if the uniform is present */ - BOOL HasUniform(const stl::string &name) const; + bool HasUniform(const stl::string &name) const; /** * Checks if this shader contains an attribute. Note that the GLSL * compiler could optimize out attributes if they aren't used in the * GLSL code. * @param name the name of the attribute to check for - * @return TRUE if the attribute is present + * @return true if the attribute is present */ - BOOL HasAttribute(const stl::string &name) const; + bool HasAttribute(const stl::string &name) const; /** * Sets the value of a uniform. @@ -225,10 +225,10 @@ public: * attribute type or not. * @param attribIndex the index of the shader attribute to check the * mapping of - * @return TRUE if this shader attribute was mapped to a standard attribute - * type or FALSE if it wasn't + * @return true if this shader attribute was mapped to a standard attribute + * type or false if it wasn't */ - BOOL IsAttributeMappedToStandardType(uint attribIndex) const; + bool IsAttributeMappedToStandardType(uint attribIndex) const; /** * Gets a vertex buffer object attribute index that corresponds to the @@ -289,19 +289,19 @@ protected: * for shader subclasses to begin initializing their own custom state * immediately afterward. * @param graphicsDevice the graphics device to associate this shader with - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); /** * Loads the provided shader sources, compiles and links them and * caches information about attributes and uniforms. * @param vertexShaderSource vertex shader source * @param fragmentShaderSource fragment shader source - * @return TRUE if compilation and linking succeeded and the shader + * @return true if compilation and linking succeeded and the shader * is now ready for use */ - BOOL LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource); + bool LoadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource); /** * Reloads shader sources either from those provided or from the @@ -311,10 +311,10 @@ protected: * the source from the cache * @param fragmentShaderSource fragment shader source, or NULL to load * the source from the cache - * @return TRUE if compilation and linking succeeded and the shader + * @return true if compilation and linking succeeded and the shader * is now ready for use */ - BOOL ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource); + bool ReloadCompileAndLink(const char *vertexShaderSource, const char *fragmentShaderSource); /** * Caches the provided shader sources. ReloadCompileAndLink() can @@ -353,8 +353,8 @@ protected: ShaderAttribute* GetAttribute(const stl::string &name); private: - BOOL Compile(const char *vertexShaderSource, const char *fragmentShaderSource); - BOOL Link(); + bool Compile(const char *vertexShaderSource, const char *fragmentShaderSource); + bool Link(); void LoadUniformInfo(); void LoadAttributeInfo(); @@ -367,13 +367,13 @@ private: char *m_cachedVertexShaderSource; char *m_cachedFragmentShaderSource; - BOOL m_vertexShaderCompileStatus; - BOOL m_fragmentShaderCompileStatus; - BOOL m_linkStatus; + int m_vertexShaderCompileStatus; + int m_fragmentShaderCompileStatus; + int m_linkStatus; uint m_vertexShaderId; uint m_fragmentShaderId; uint m_programId; - BOOL m_isBound; + bool m_isBound; ShaderUniformMap m_uniforms; ShaderAttributeMap m_attributes; @@ -383,15 +383,15 @@ private: CachedShaderUniformMap m_cachedUniforms; }; -inline BOOL Shader::IsReadyForUse() const +inline bool Shader::IsReadyForUse() const { if (GetVertexShaderCompileStatus() && GetFragmentShaderCompileStatus() && GetLinkStatus()) - return TRUE; + return true; else - return FALSE; + return false; } -inline BOOL Shader::IsAttributeMappedToStandardType(uint attribIndex) const +inline bool Shader::IsAttributeMappedToStandardType(uint attribIndex) const { return m_attributeMapping[attribIndex].usesStandardType; } diff --git a/src/framework/graphics/shaderstructs.h b/src/framework/graphics/shaderstructs.h index 054440f..75bac9e 100644 --- a/src/framework/graphics/shaderstructs.h +++ b/src/framework/graphics/shaderstructs.h @@ -25,7 +25,7 @@ struct ShaderAttribute uint location; uint type; uint size; - BOOL isTypeBound; + bool isTypeBound; }; /** @@ -33,7 +33,7 @@ struct ShaderAttribute */ struct ShaderAttributeMapInfo { - BOOL usesStandardType; + bool usesStandardType; VERTEX_STANDARD_ATTRIBS standardType; uint attribIndex; }; diff --git a/src/framework/graphics/simplecolorshader.cpp b/src/framework/graphics/simplecolorshader.cpp index b94e223..146eb45 100644 --- a/src/framework/graphics/simplecolorshader.cpp +++ b/src/framework/graphics/simplecolorshader.cpp @@ -37,16 +37,16 @@ SimpleColorShader::~SimpleColorShader() { } -BOOL SimpleColorShader::Initialize(GraphicsDevice *graphicsDevice) +bool SimpleColorShader::Initialize(GraphicsDevice *graphicsDevice) { if (!StandardShader::Initialize(graphicsDevice)) - return FALSE; + return false; - BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); - ASSERT(result == TRUE); + bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); + ASSERT(result == true); MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D); MapAttributeToStandardAttribType("a_color", VERTEX_STD_COLOR); - return TRUE; + return true; } diff --git a/src/framework/graphics/simplecolorshader.h b/src/framework/graphics/simplecolorshader.h index 8909448..14bf644 100644 --- a/src/framework/graphics/simplecolorshader.h +++ b/src/framework/graphics/simplecolorshader.h @@ -14,7 +14,7 @@ public: SimpleColorShader(); virtual ~SimpleColorShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); private: static const char *m_vertexShaderSource; diff --git a/src/framework/graphics/simplecolortextureshader.cpp b/src/framework/graphics/simplecolortextureshader.cpp index ca265d6..240fd13 100644 --- a/src/framework/graphics/simplecolortextureshader.cpp +++ b/src/framework/graphics/simplecolortextureshader.cpp @@ -42,17 +42,17 @@ SimpleColorTextureShader::~SimpleColorTextureShader() { } -BOOL SimpleColorTextureShader::Initialize(GraphicsDevice *graphicsDevice) +bool SimpleColorTextureShader::Initialize(GraphicsDevice *graphicsDevice) { if (!StandardShader::Initialize(graphicsDevice)) - return FALSE; + return false; - BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); - ASSERT(result == TRUE); + bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); + ASSERT(result == true); MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D); MapAttributeToStandardAttribType("a_color", VERTEX_STD_COLOR); MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD); - return TRUE; + return true; } diff --git a/src/framework/graphics/simplecolortextureshader.h b/src/framework/graphics/simplecolortextureshader.h index 4625fcd..17deeba 100644 --- a/src/framework/graphics/simplecolortextureshader.h +++ b/src/framework/graphics/simplecolortextureshader.h @@ -14,7 +14,7 @@ public: SimpleColorTextureShader(); virtual ~SimpleColorTextureShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); private: static const char *m_vertexShaderSource; diff --git a/src/framework/graphics/simpletextureshader.cpp b/src/framework/graphics/simpletextureshader.cpp index 07a5892..4817bf8 100644 --- a/src/framework/graphics/simpletextureshader.cpp +++ b/src/framework/graphics/simpletextureshader.cpp @@ -37,16 +37,16 @@ SimpleTextureShader::~SimpleTextureShader() { } -BOOL SimpleTextureShader::Initialize(GraphicsDevice *graphicsDevice) +bool SimpleTextureShader::Initialize(GraphicsDevice *graphicsDevice) { if (!StandardShader::Initialize(graphicsDevice)) - return FALSE; + return false; - BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); - ASSERT(result == TRUE); + bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); + ASSERT(result == true); MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D); MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD); - return TRUE; + return true; } diff --git a/src/framework/graphics/simpletextureshader.h b/src/framework/graphics/simpletextureshader.h index cb3691f..b6e83ad 100644 --- a/src/framework/graphics/simpletextureshader.h +++ b/src/framework/graphics/simpletextureshader.h @@ -14,7 +14,7 @@ public: SimpleTextureShader(); virtual ~SimpleTextureShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); private: static const char *m_vertexShaderSource; diff --git a/src/framework/graphics/simpletexturevertexlerpshader.cpp b/src/framework/graphics/simpletexturevertexlerpshader.cpp index 2132af1..00240a7 100644 --- a/src/framework/graphics/simpletexturevertexlerpshader.cpp +++ b/src/framework/graphics/simpletexturevertexlerpshader.cpp @@ -38,17 +38,17 @@ SimpleTextureVertexLerpShader::~SimpleTextureVertexLerpShader() { } -BOOL SimpleTextureVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice) +bool SimpleTextureVertexLerpShader::Initialize(GraphicsDevice *graphicsDevice) { if (!VertexLerpShader::Initialize(graphicsDevice)) - return FALSE; + return false; - BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); - ASSERT(result == TRUE); + bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); + ASSERT(result == true); MapAttributeToVboAttribIndex("a_position1", 0); MapAttributeToVboAttribIndex("a_position2", 1); MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD); - return TRUE; + return true; } diff --git a/src/framework/graphics/simpletexturevertexlerpshader.h b/src/framework/graphics/simpletexturevertexlerpshader.h index 292639f..f2c7041 100644 --- a/src/framework/graphics/simpletexturevertexlerpshader.h +++ b/src/framework/graphics/simpletexturevertexlerpshader.h @@ -11,7 +11,7 @@ public: SimpleTextureVertexLerpShader(); virtual ~SimpleTextureVertexLerpShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); private: static const char *m_vertexShaderSource; diff --git a/src/framework/graphics/simpletexturevertexskinningshader.cpp b/src/framework/graphics/simpletexturevertexskinningshader.cpp index c8758f3..90f6c28 100644 --- a/src/framework/graphics/simpletexturevertexskinningshader.cpp +++ b/src/framework/graphics/simpletexturevertexskinningshader.cpp @@ -56,17 +56,17 @@ SimpleTextureVertexSkinningShader::~SimpleTextureVertexSkinningShader() { } -BOOL SimpleTextureVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice) +bool SimpleTextureVertexSkinningShader::Initialize(GraphicsDevice *graphicsDevice) { if (!VertexSkinningShader::Initialize(graphicsDevice)) - return FALSE; + return false; - BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); - ASSERT(result == TRUE); + bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); + ASSERT(result == true); MapAttributeToVboAttribIndex("a_jointIndex", 0); MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D); MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD); - return TRUE; + return true; } diff --git a/src/framework/graphics/simpletexturevertexskinningshader.h b/src/framework/graphics/simpletexturevertexskinningshader.h index 0f1bc97..380a5a9 100644 --- a/src/framework/graphics/simpletexturevertexskinningshader.h +++ b/src/framework/graphics/simpletexturevertexskinningshader.h @@ -11,7 +11,7 @@ public: SimpleTextureVertexSkinningShader(); virtual ~SimpleTextureVertexSkinningShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); private: static const char *m_vertexShaderSource; diff --git a/src/framework/graphics/solidcolortexturecache.cpp b/src/framework/graphics/solidcolortexturecache.cpp index 3bb5edc..73170dc 100644 --- a/src/framework/graphics/solidcolortexturecache.cpp +++ b/src/framework/graphics/solidcolortexturecache.cpp @@ -63,8 +63,8 @@ Texture* SolidColorTextureCache::CreateFor(const Color &color, Texture *existing LOG_INFO(LOGCAT_ASSETS, "SolidColorTextureCache: creating texture for color 0x%8x.\n", color.ToInt()); Image *img = new Image(); - BOOL imageCreateSuccess = img->Create(8, 8, IMAGE_FORMAT_RGBA); - ASSERT(imageCreateSuccess == TRUE); + bool imageCreateSuccess = img->Create(8, 8, IMAGE_FORMAT_RGBA); + ASSERT(imageCreateSuccess == true); Texture *texture; if (existing != NULL) @@ -76,7 +76,7 @@ Texture* SolidColorTextureCache::CreateFor(const Color &color, Texture *existing texture = new Texture(); img->Clear(color); - BOOL success = texture->Create(m_graphicsDevice, img); + bool success = texture->Create(m_graphicsDevice, img); SAFE_DELETE(img); if (!success) diff --git a/src/framework/graphics/sprite2dshader.cpp b/src/framework/graphics/sprite2dshader.cpp index 6adb349..1c0f02e 100644 --- a/src/framework/graphics/sprite2dshader.cpp +++ b/src/framework/graphics/sprite2dshader.cpp @@ -48,17 +48,17 @@ Sprite2DShader::~Sprite2DShader() { } -BOOL Sprite2DShader::Initialize(GraphicsDevice *graphicsDevice) +bool Sprite2DShader::Initialize(GraphicsDevice *graphicsDevice) { if (!SpriteShader::Initialize(graphicsDevice)) - return FALSE; + return false; - BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); - ASSERT(result == TRUE); + bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); + ASSERT(result == true); MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_2D); MapAttributeToStandardAttribType("a_color", VERTEX_STD_COLOR); MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD); - return TRUE; + return true; } diff --git a/src/framework/graphics/sprite2dshader.h b/src/framework/graphics/sprite2dshader.h index 7c6155b..3033deb 100644 --- a/src/framework/graphics/sprite2dshader.h +++ b/src/framework/graphics/sprite2dshader.h @@ -16,7 +16,7 @@ public: Sprite2DShader(); virtual ~Sprite2DShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); private: static const char *m_vertexShaderSource; diff --git a/src/framework/graphics/sprite3dshader.cpp b/src/framework/graphics/sprite3dshader.cpp index c9b63e7..d97d272 100644 --- a/src/framework/graphics/sprite3dshader.cpp +++ b/src/framework/graphics/sprite3dshader.cpp @@ -54,17 +54,17 @@ Sprite3DShader::~Sprite3DShader() { } -BOOL Sprite3DShader::Initialize(GraphicsDevice *graphicsDevice) +bool Sprite3DShader::Initialize(GraphicsDevice *graphicsDevice) { if (!SpriteShader::Initialize(graphicsDevice)) - return FALSE; + return false; - BOOL result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); - ASSERT(result == TRUE); + bool result = LoadCompileAndLinkInlineSources(m_vertexShaderSource, m_fragmentShaderSource); + ASSERT(result == true); MapAttributeToStandardAttribType("a_position", VERTEX_STD_POS_3D); MapAttributeToStandardAttribType("a_color", VERTEX_STD_COLOR); MapAttributeToStandardAttribType("a_texcoord0", VERTEX_STD_TEXCOORD); - return TRUE; + return true; } diff --git a/src/framework/graphics/sprite3dshader.h b/src/framework/graphics/sprite3dshader.h index 0f3553c..5debce3 100644 --- a/src/framework/graphics/sprite3dshader.h +++ b/src/framework/graphics/sprite3dshader.h @@ -17,7 +17,7 @@ public: Sprite3DShader(); virtual ~Sprite3DShader(); - BOOL Initialize(GraphicsDevice *graphicsDevice); + bool Initialize(GraphicsDevice *graphicsDevice); private: static const char *m_vertexShaderSource; diff --git a/src/framework/graphics/spritebatch.cpp b/src/framework/graphics/spritebatch.cpp index 1f926ca..91ba155 100644 --- a/src/framework/graphics/spritebatch.cpp +++ b/src/framework/graphics/spritebatch.cpp @@ -51,17 +51,17 @@ SpriteBatch::SpriteBatch(GraphicsDevice *graphicsDevice) m_renderState = new RENDERSTATE_DEFAULT; ASSERT(m_renderState != NULL); - m_renderState->SetDepthTesting(FALSE); + m_renderState->SetDepthTesting(false); m_blendState = new BLENDSTATE_ALPHABLEND; ASSERT(m_blendState != NULL); - m_begunRendering = FALSE; + m_begunRendering = false; - m_isRenderStateOverridden = FALSE; - m_isBlendStateOverridden = FALSE; + m_isRenderStateOverridden = false; + m_isBlendStateOverridden = false; - m_isClipping = FALSE; + m_isClipping = false; } SpriteBatch::~SpriteBatch() @@ -73,7 +73,7 @@ SpriteBatch::~SpriteBatch() void SpriteBatch::InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader) { - ASSERT(m_begunRendering == FALSE); + ASSERT(m_begunRendering == false); // keep these around for any 3d -> 2d coordinate projection we may need to do // (since we're switching to a 2d orthographic projection mode next) @@ -84,28 +84,28 @@ void SpriteBatch::InternalBegin(const RenderState *renderState, const BlendState m_shader = m_graphicsDevice->GetSprite2DShader(); else { - ASSERT(shader->IsReadyForUse() == TRUE); + ASSERT(shader->IsReadyForUse() == true); m_shader = shader; } if (renderState != NULL) { - m_isRenderStateOverridden = TRUE; + m_isRenderStateOverridden = true; m_overrideRenderState = *renderState; } else - m_isRenderStateOverridden = FALSE; + m_isRenderStateOverridden = false; if (blendState != NULL) { - m_isBlendStateOverridden = TRUE; + m_isBlendStateOverridden = true; m_overrideBlendState = *blendState; } else - m_isBlendStateOverridden = FALSE; + m_isBlendStateOverridden = false; m_currentSpritePointer = 0; - m_begunRendering = TRUE; + m_begunRendering = true; m_vertices->MoveToStart(); } @@ -436,7 +436,7 @@ void SpriteBatch::RenderFilledBox(const Rect &rect, const Color &color) void SpriteBatch::AddSprite(const Texture *texture, int destLeft, int destTop, int destRight, int destBottom, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); uint width = sourceRight - sourceLeft; ASSERT(width > 0); @@ -464,7 +464,7 @@ void SpriteBatch::AddSprite(const Texture *texture, int destLeft, int destTop, i void SpriteBatch::AddSprite(const Texture *texture, int destLeft, int destTop, int destRight, int destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); float destLeftF = (float)destLeft; float destTopF = (float)destTop; @@ -484,7 +484,7 @@ void SpriteBatch::AddSprite(const Texture *texture, int destLeft, int destTop, i void SpriteBatch::AddSprite(const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); if (m_isClipping) { @@ -497,17 +497,17 @@ void SpriteBatch::AddSprite(const Texture *texture, float destLeft, float destTo ++m_currentSpritePointer; } -BOOL SpriteBatch::ClipSpriteCoords(float &left, float &top, float &right, float &bottom, float &texCoordLeft, float &texCoordTop, float &texCoordRight, float &texCoordBottom) +bool SpriteBatch::ClipSpriteCoords(float &left, float &top, float &right, float &bottom, float &texCoordLeft, float &texCoordTop, float &texCoordRight, float &texCoordBottom) { // check for completely out of bounds scenarios first if (left >= m_clipRegion.right) - return FALSE; + return false; if (right < m_clipRegion.left) - return FALSE; + return false; if (top >= m_clipRegion.bottom) - return FALSE; + return false; if (bottom < m_clipRegion.top) - return FALSE; + return false; float clippedLeft = left; float clippedTop = top; @@ -552,7 +552,7 @@ BOOL SpriteBatch::ClipSpriteCoords(float &left, float &top, float &right, float texCoordRight = clippedTexCoordRight; texCoordBottom = clippedTexCoordBottom; - return TRUE; + return true; } void SpriteBatch::SetSpriteInfo(uint spriteIndex, const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) @@ -593,7 +593,7 @@ void SpriteBatch::SetSpriteInfo(uint spriteIndex, const Texture *texture, float void SpriteBatch::AddLine(float x1, float y1, float x2, float y2, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); if (m_isClipping) { @@ -631,16 +631,16 @@ void SpriteBatch::SetLineInfo(uint spriteIndex, float x1, float y1, float x2, fl entity.lastVertex = base + 1; } -BOOL SpriteBatch::ClipLineCoords(float &x1, float &y1, float &x2, float &y2) +bool SpriteBatch::ClipLineCoords(float &x1, float &y1, float &x2, float &y2) { // TODO: implementation - return TRUE; + return true; } void SpriteBatch::AddFilledBox(float left, float top, float right, float bottom, const Color &color) { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); if (m_isClipping) { @@ -690,17 +690,17 @@ void SpriteBatch::SetFilledBoxInfo(uint spriteIndex, float left, float top, floa entity.lastVertex = base + 5; } -BOOL SpriteBatch::ClipFilledBoxCoords(float &left, float &top, float &right, float &bottom) +bool SpriteBatch::ClipFilledBoxCoords(float &left, float &top, float &right, float &bottom) { // check for completely out of bounds scenarios first if (left >= m_clipRegion.right) - return FALSE; + return false; if (right < m_clipRegion.left) - return FALSE; + return false; if (top >= m_clipRegion.bottom) - return FALSE; + return false; if (bottom < m_clipRegion.top) - return FALSE; + return false; float clippedLeft = left; float clippedTop = top; @@ -721,19 +721,19 @@ BOOL SpriteBatch::ClipFilledBoxCoords(float &left, float &top, float &right, flo right = clippedRight; bottom = clippedBottom; - return TRUE; + return true; } void SpriteBatch::End() { - ASSERT(m_begunRendering == TRUE); + ASSERT(m_begunRendering == true); // don't do anything if nothing is to be rendered! if (m_currentSpritePointer == 0) { // should do this regardless if we're rendering anything or not ClearClipRegion(); - m_begunRendering = FALSE; + m_begunRendering = false; return; } @@ -752,9 +752,9 @@ void SpriteBatch::End() RenderQueue(); m_graphicsDevice->UnbindShader(); - // ClearClipRegion expects that m_begunRendering == TRUE, so we need to set that last + // ClearClipRegion expects that m_begunRendering == true, so we need to set that last ClearClipRegion(); - m_begunRendering = FALSE; + m_begunRendering = false; } void SpriteBatch::RenderQueue() @@ -870,8 +870,8 @@ inline float SpriteBatch::FixYCoord(int y, float sourceHeight) const void SpriteBatch::SetClipRegion(const Rect &rect) { - ASSERT(m_begunRendering == TRUE); - m_isClipping = TRUE; + ASSERT(m_begunRendering == true); + m_isClipping = true; int fixedTop = ((int)m_graphicsDevice->GetViewContext()->GetViewportHeight() - rect.top - rect.GetHeight()); int fixedBottom = fixedTop + rect.GetHeight(); @@ -884,8 +884,8 @@ void SpriteBatch::SetClipRegion(const Rect &rect) void SpriteBatch::SetClipRegion(int left, int top, int right, int bottom) { - ASSERT(m_begunRendering == TRUE); - m_isClipping = TRUE; + ASSERT(m_begunRendering == true); + m_isClipping = true; int height = bottom - top; int fixedTop = (m_graphicsDevice->GetViewContext()->GetViewportHeight() - top - height); @@ -899,7 +899,7 @@ void SpriteBatch::SetClipRegion(int left, int top, int right, int bottom) void SpriteBatch::ClearClipRegion() { - ASSERT(m_begunRendering == TRUE); - m_isClipping = FALSE; + ASSERT(m_begunRendering == true); + m_isClipping = false; } diff --git a/src/framework/graphics/spritebatch.h b/src/framework/graphics/spritebatch.h index d17e27e..65096bc 100644 --- a/src/framework/graphics/spritebatch.h +++ b/src/framework/graphics/spritebatch.h @@ -380,16 +380,16 @@ private: void AddSprite(const Texture *texture, int destLeft, int destTop, int destRight, int destBottom, uint sourceLeft, uint sourceTop, uint sourceRight, uint sourceBottom, const Color &color); void AddSprite(const Texture *texture, int destLeft, int destTop, int destRight, int destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color); void AddSprite(const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color); - BOOL ClipSpriteCoords(float &left, float &top, float &right, float &bottom, float &texCoordLeft, float &texCoordTop, float &texCoordRight, float &texCoordBottom); + bool ClipSpriteCoords(float &left, float &top, float &right, float &bottom, float &texCoordLeft, float &texCoordTop, float &texCoordRight, float &texCoordBottom); void SetSpriteInfo(uint spriteIndex, const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color); void AddLine(float x1, float y1, float x2, float y2, const Color &color); void SetLineInfo(uint spriteIndex, float x1, float y1, float x2, float y2, const Color &color); - BOOL ClipLineCoords(float &x1, float &y1, float &x2, float &y2); + bool ClipLineCoords(float &x1, float &y1, float &x2, float &y2); void AddFilledBox(float left, float top, float right, float bottom, const Color &color); void SetFilledBoxInfo(uint spriteIndex, float left, float top, float right, float bottom, const Color &color); - BOOL ClipFilledBoxCoords(float &left, float &top, float &right, float &bottom); + bool ClipFilledBoxCoords(float &left, float &top, float &right, float &bottom); void RenderQueue(); void RenderQueueRange(const SpriteBatchEntity *firstEntity, const SpriteBatchEntity *lastEntity); @@ -404,19 +404,19 @@ private: SpriteShader *m_shader; RenderState *m_renderState; BlendState *m_blendState; - BOOL m_isRenderStateOverridden; + bool m_isRenderStateOverridden; RenderState m_overrideRenderState; - BOOL m_isBlendStateOverridden; + bool m_isBlendStateOverridden; BlendState m_overrideBlendState; VertexBuffer *m_vertices; stl::vector m_entities; uint m_currentSpritePointer; Matrix4x4 m_previousProjection; Matrix4x4 m_previousModelview; - BOOL m_isClipping; + bool m_isClipping; RectF m_clipRegion; - BOOL m_begunRendering; + bool m_begunRendering; }; #endif diff --git a/src/framework/graphics/spriteshader.cpp b/src/framework/graphics/spriteshader.cpp index 7f693fc..251968c 100644 --- a/src/framework/graphics/spriteshader.cpp +++ b/src/framework/graphics/spriteshader.cpp @@ -11,8 +11,8 @@ SpriteShader::~SpriteShader() { } -void SpriteShader::SetTextureHasAlphaOnly(BOOL hasAlphaOnly) +void SpriteShader::SetTextureHasAlphaOnly(bool hasAlphaOnly) { - ASSERT(IsReadyForUse() == TRUE); + ASSERT(IsReadyForUse() == true); SetUniform(m_textureHasAlphaOnlyUniform, (int)hasAlphaOnly); } diff --git a/src/framework/graphics/spriteshader.h b/src/framework/graphics/spriteshader.h index 8773a27..fa2cdc0 100644 --- a/src/framework/graphics/spriteshader.h +++ b/src/framework/graphics/spriteshader.h @@ -19,7 +19,7 @@ public: * the way which color modulation is done using vertex colors. * @param hasAlphaOnly whether the texture has only an alpha component */ - void SetTextureHasAlphaOnly(BOOL hasAlphaOnly); + void SetTextureHasAlphaOnly(bool hasAlphaOnly); protected: /** diff --git a/src/framework/graphics/standardshader.cpp b/src/framework/graphics/standardshader.cpp index 0c371b9..351223f 100644 --- a/src/framework/graphics/standardshader.cpp +++ b/src/framework/graphics/standardshader.cpp @@ -16,12 +16,12 @@ StandardShader::~StandardShader() { } -BOOL StandardShader::LoadCompileAndLinkInlineSources(const char *inlineVertexShaderSource, const char *inlineFragmentShaderSource) +bool StandardShader::LoadCompileAndLinkInlineSources(const char *inlineVertexShaderSource, const char *inlineFragmentShaderSource) { ASSERT(inlineVertexShaderSource != NULL); ASSERT(inlineFragmentShaderSource != NULL); - BOOL result = LoadCompileAndLink(inlineVertexShaderSource, inlineFragmentShaderSource); + bool result = LoadCompileAndLink(inlineVertexShaderSource, inlineFragmentShaderSource); if (result) { // keep the pointers around to the inline sources for easy reloading later @@ -35,13 +35,13 @@ BOOL StandardShader::LoadCompileAndLinkInlineSources(const char *inlineVertexSha void StandardShader::SetModelViewMatrix(const Matrix4x4 &matrix) { - ASSERT(IsReadyForUse() == TRUE); + ASSERT(IsReadyForUse() == true); SetUniform(m_modelViewMatrixUniform, matrix); } void StandardShader::SetProjectionMatrix(const Matrix4x4 &matrix) { - ASSERT(IsReadyForUse() == TRUE); + ASSERT(IsReadyForUse() == true); SetUniform(m_projectionMatrixUniform, matrix); } diff --git a/src/framework/graphics/standardshader.h b/src/framework/graphics/standardshader.h index 48cd920..829018c 100644 --- a/src/framework/graphics/standardshader.h +++ b/src/framework/graphics/standardshader.h @@ -48,10 +48,10 @@ protected: * defined via constants or statically in the application C++ code. * @param vertexShaderSource vertex shader source * @param fragmentShaderSource fragment shader source - * @return TRUE if compilation and linking succeeded and the shader + * @return true if compilation and linking succeeded and the shader * is now ready for use */ - BOOL LoadCompileAndLinkInlineSources(const char *inlineVertexShaderSource, const char *inlineFragmentShaderSource); + bool LoadCompileAndLinkInlineSources(const char *inlineVertexShaderSource, const char *inlineFragmentShaderSource); /** * @return the name of the modelview matrix uniform diff --git a/src/framework/graphics/texture.cpp b/src/framework/graphics/texture.cpp index 9c56dbe..4c52994 100644 --- a/src/framework/graphics/texture.cpp +++ b/src/framework/graphics/texture.cpp @@ -24,11 +24,11 @@ Texture::~Texture() Release(); } -BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image) +bool Texture::Create(GraphicsDevice *graphicsDevice, Image *image) { ASSERT(m_textureName == 0); if (m_textureName != 0) - return FALSE; + return false; ASSERT(graphicsDevice != NULL); ASSERT(IsPowerOf2(image->GetWidth()) && IsPowerOf2(image->GetHeight())); @@ -60,7 +60,7 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image) } ASSERT(glFormat != 0); if (glFormat == 0) - return FALSE; + return false; m_graphicsDevice = graphicsDevice; m_width = image->GetWidth(); @@ -76,21 +76,21 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image) LOG_INFO(LOGCAT_GRAPHICS, "Created texture from image. ID = %d, bpp = %d, size = %d x %d\n", m_textureName, image->GetBpp(), image->GetWidth(), image->GetHeight()); - return TRUE; + return true; } -BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint width, uint height, TEXTURE_FORMAT textureFormat) +bool Texture::Create(GraphicsDevice *graphicsDevice, uint width, uint height, TEXTURE_FORMAT textureFormat) { ASSERT(m_textureName == 0); if (m_textureName != 0) - return FALSE; + return false; ASSERT(graphicsDevice != NULL); if (!graphicsDevice->IsNonPowerOfTwoTextureSupported()) { ASSERT(IsPowerOf2(width) && IsPowerOf2(height)); if (!IsPowerOf2(width) || !IsPowerOf2(height)) - return FALSE; + return false; } int bpp = 0; @@ -99,10 +99,10 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint width, uint height, TE GetTextureSpecsFromFormat(textureFormat, &bpp, &format, &type); ASSERT(format != 0); if (format == 0) - return FALSE; + return false; ASSERT(type != 0); if (type == 0) - return FALSE; + return false; m_graphicsDevice = graphicsDevice; m_width = width; @@ -122,7 +122,7 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint width, uint height, TE else LOG_INFO(LOGCAT_GRAPHICS, "Created uninitialized texture. ID = %d, bpp = %d, size = %d x %d\n", m_textureName, bpp, m_width, m_height); - return TRUE; + return true; } void Texture::Release() @@ -142,16 +142,16 @@ void Texture::Release() m_format = TEXTURE_FORMAT_NONE; } -BOOL Texture::Update(Image *image, uint destX, uint destY) +bool Texture::Update(Image *image, uint destX, uint destY) { ASSERT(m_textureName != 0); if (m_textureName == 0) - return FALSE; + return false; // TODO: for now ... ASSERT(m_format != TEXTURE_FORMAT_DEPTH); if (m_format == TEXTURE_FORMAT_DEPTH) - return FALSE; + return false; ASSERT(image != NULL); ASSERT(destX < m_width); @@ -181,12 +181,12 @@ BOOL Texture::Update(Image *image, uint destX, uint destY) ASSERT(glFormat != 0); if (glFormat == 0) - return FALSE; + return false; m_graphicsDevice->BindTexture(this, 0); GL_CALL(glTexSubImage2D(GL_TEXTURE_2D, 0, destX, destY, image->GetWidth(), image->GetHeight(), glFormat, glType, pixels)); - return TRUE; + return true; } void Texture::OnLostContext() diff --git a/src/framework/graphics/texture.h b/src/framework/graphics/texture.h index 58cb68b..c59b08f 100644 --- a/src/framework/graphics/texture.h +++ b/src/framework/graphics/texture.h @@ -24,9 +24,9 @@ public: * Creates a new texture from the specified image. * @param graphicsDevice the graphics device this texture is associated with * @param image the image to create the texture from - * @return TRUE if the texture was created successfully + * @return true if the texture was created successfully */ - BOOL Create(GraphicsDevice *graphicsDevice, Image *image); + bool Create(GraphicsDevice *graphicsDevice, Image *image); /** * Creates a new texture with uninitialized image data. Image data should @@ -36,7 +36,7 @@ public: * @param height the height of the texture in pixels * @param textureFormat the format of the pixel data this texture contains */ - BOOL Create(GraphicsDevice *graphicsDevice, uint width, uint height, TEXTURE_FORMAT textureFormat); + bool Create(GraphicsDevice *graphicsDevice, uint width, uint height, TEXTURE_FORMAT textureFormat); /** * Frees the texture resources. @@ -49,9 +49,9 @@ public: * have dimensions equal to or less then this texture. * @param destX the X coordinate on the texture to place the new image at * @param destY the Y coordinate on the texture to place the new image at - * @return TRUE if the texture was updated successfully + * @return true if the texture was updated successfully */ - BOOL Update(Image *image, uint destX = 0, uint destY = 0); + bool Update(Image *image, uint destX = 0, uint destY = 0); /** * @return the texture name or ID assigned to this texture by OpenGL @@ -74,9 +74,9 @@ public: TEXTURE_FORMAT GetFormat() const { return m_format; } /** - * @return TRUE if the texture has invalidated and needs to be recreated + * @return true if the texture has invalidated and needs to be recreated */ - BOOL IsInvalidated() const { return m_textureName == 0; } + bool IsInvalidated() const { return m_textureName == 0; } /** * Callback which handles freeing the texture resources when the OpenGL diff --git a/src/framework/graphics/vertexbuffer.cpp b/src/framework/graphics/vertexbuffer.cpp index 83ac697..77ee62f 100644 --- a/src/framework/graphics/vertexbuffer.cpp +++ b/src/framework/graphics/vertexbuffer.cpp @@ -44,56 +44,56 @@ void VertexBuffer::Release() BufferObject::Release(); } -BOOL VertexBuffer::Initialize(const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage) +bool VertexBuffer::Initialize(const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage) { return Initialize(NULL, attributes, numAttributes, numVertices, usage); } -BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage) +bool VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage) { ASSERT(m_buffer.size() == 0); if (m_buffer.size() > 0) - return FALSE; + return false; if (!BufferObject::Initialize(graphicsDevice, BUFFEROBJECT_TYPE_VERTEX, usage)) - return FALSE; + return false; if (!SetSizesAndOffsets(attributes, numAttributes)) - return FALSE; + return false; Resize(numVertices); - return TRUE; + return true; } -BOOL VertexBuffer::Initialize(const VertexBuffer *source) +bool VertexBuffer::Initialize(const VertexBuffer *source) { return Initialize(NULL, source); } -BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer *source) +bool VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer *source) { ASSERT(m_buffer.size() == 0); if (m_buffer.size() > 0) - return FALSE; + return false; ASSERT(source != NULL); if (source == NULL) - return FALSE; + return false; ASSERT(source->GetNumElements() > 0); if (source->GetNumElements() == 0) - return FALSE; + return false; if (!BufferObject::Initialize(graphicsDevice, BUFFEROBJECT_TYPE_VERTEX, source->GetUsage())) - return FALSE; + return false; uint numAttribs = source->GetNumAttributes(); VERTEX_ATTRIBS *attribs = new VERTEX_ATTRIBS[numAttribs]; for (uint i = 0; i < numAttribs; ++i) attribs[i] = source->GetAttributeInfo(i)->standardType; - BOOL success = SetSizesAndOffsets(attribs, numAttribs); + bool success = SetSizesAndOffsets(attribs, numAttribs); if (success) { Resize(source->GetNumElements()); @@ -105,7 +105,7 @@ BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer return success; } -BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint numAttributes) +bool VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint numAttributes) { ASSERT(attributes != NULL); ASSERT(numAttributes > 0); @@ -113,19 +113,19 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint num ASSERT(m_attribs == NULL); if (attributes == NULL) - return FALSE; + return false; if (numAttributes == 0) - return FALSE; + return false; if (m_buffer.size() > 0) - return FALSE; + return false; if (m_attribs != NULL) - return FALSE; + return false; uint numGpuSlotsUsed = 0; uint offset = 0; VertexBufferAttribute *attribsInfo = new VertexBufferAttribute[numAttributes]; - BOOL success = TRUE; + bool success = true; for (uint i = 0; i < numAttributes; ++i) { @@ -140,17 +140,17 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint num ASSERT(numGpuSlotsUsed + thisAttribsGpuSlotSize <= MAX_GPU_ATTRIB_SLOTS); if (numGpuSlotsUsed + thisAttribsGpuSlotSize > MAX_GPU_ATTRIB_SLOTS) { - success = FALSE; + success = false; break; } if (standardTypeBitMask > 0) { // ensure no duplicate standard attribute types are specified - ASSERT(IsBitSet(standardTypeBitMask, m_standardTypeAttribs) == FALSE); + ASSERT(IsBitSet(standardTypeBitMask, m_standardTypeAttribs) == false); if (IsBitSet(standardTypeBitMask, m_standardTypeAttribs)) { - success = FALSE; + success = false; break; } diff --git a/src/framework/graphics/vertexbuffer.h b/src/framework/graphics/vertexbuffer.h index 64b774d..4e2080a 100644 --- a/src/framework/graphics/vertexbuffer.h +++ b/src/framework/graphics/vertexbuffer.h @@ -39,9 +39,9 @@ public: * @param numAttributes the number of vertex attributes * @param numVertices the initial number of vertices this buffer will contain * @param usage the expected usage pattern of this vertex buffer - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage); + bool Initialize(const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage); /** * Initializes the vertex buffer. @@ -51,17 +51,17 @@ public: * @param numAttributes the number of vertex attributes * @param numVertices the initial number of vertices this buffer will contain * @param usage the expected usage pattern of this vertex buffer - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage); + bool Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage); /** * Initializes the vertex buffer. * @param source the source buffer to create this buffer from. it's * properties and vertex data will be used to create this one - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(const VertexBuffer *source); + bool Initialize(const VertexBuffer *source); /** * Initializes the vertex buffer. @@ -69,9 +69,9 @@ public: * on the GPU * @param source the source buffer to create this buffer from. it's * properties and vertex data will be used to create this one - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer *source); + bool Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer *source); /** * @return the number of attributes in this vertex buffer @@ -96,10 +96,10 @@ public: * Checks whether this buffer's vertex data includes the specified standard * attribute. * @param standardAttrib the standard attribute to test - * @return TRUE if the vertex data in this buffer contains this standard + * @return true if the vertex data in this buffer contains this standard * attribute */ - BOOL HasStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const { return (m_standardTypeAttribs & (uint)standardAttrib) > 0; } + bool HasStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const { return (m_standardTypeAttribs & (uint)standardAttrib) > 0; } /** * Returns the index of the specified standard attribute. @@ -442,17 +442,17 @@ public: /** * Moves the current vertex position to the next position. - * @return TRUE if the move succeeded, FALSE if there is no more vertices + * @return true if the move succeeded, false if there is no more vertices * to move to after this one */ - BOOL MoveNext(); + bool MoveNext(); /** * Moves the current vertex position to the previous position. - * @return TRUE if the move succeeded, FALSE if there is no more vertices + * @return true if the move succeeded, false if there is no more vertices * to move to before the current one */ - BOOL MovePrevious(); + bool MovePrevious(); /** * Moves the current vertex position by the specified amount relative @@ -529,9 +529,9 @@ public: uint GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); } private: - BOOL SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint numAttributes); + bool SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint numAttributes); - BOOL IsBufferAllocated() const { return m_buffer.size() > 0; } + bool IsBufferAllocated() const { return m_buffer.size() > 0; } uint GetVertexPosition(uint index) const { return (index * m_elementWidth); } uint GetColorBufferPosition(uint index) const { return GetVertexPosition(index) + m_colorOffset; } @@ -912,26 +912,26 @@ inline void VertexBuffer::Set16f(uint attrib, uint index, const Matrix4x4 &m) SetDirty(); } -inline BOOL VertexBuffer::MoveNext() +inline bool VertexBuffer::MoveNext() { ++m_currentVertex; if (m_currentVertex >= GetNumElements()) { --m_currentVertex; - return FALSE; + return false; } else - return TRUE; + return true; } -inline BOOL VertexBuffer::MovePrevious() +inline bool VertexBuffer::MovePrevious() { if (m_currentVertex == 0) - return FALSE; + return false; else { --m_currentVertex; - return TRUE; + return true; } } diff --git a/src/framework/graphics/vertexlerpshader.cpp b/src/framework/graphics/vertexlerpshader.cpp index a224102..6975249 100644 --- a/src/framework/graphics/vertexlerpshader.cpp +++ b/src/framework/graphics/vertexlerpshader.cpp @@ -13,6 +13,6 @@ VertexLerpShader::~VertexLerpShader() void VertexLerpShader::SetLerp(float t) { - ASSERT(IsReadyForUse() == TRUE); + ASSERT(IsReadyForUse() == true); SetUniform(m_lerpUniform, t); } diff --git a/src/framework/graphics/vertexskinningshader.cpp b/src/framework/graphics/vertexskinningshader.cpp index 9302fa1..e8d20a2 100644 --- a/src/framework/graphics/vertexskinningshader.cpp +++ b/src/framework/graphics/vertexskinningshader.cpp @@ -16,12 +16,12 @@ VertexSkinningShader::~VertexSkinningShader() void VertexSkinningShader::SetJointPositions(const Vector3 *positions, uint count) { - ASSERT(IsReadyForUse() == TRUE); + ASSERT(IsReadyForUse() == true); SetUniform(m_positionsUniform, positions, count); } void VertexSkinningShader::SetJointRotations(const Quaternion *rotations, uint count) { - ASSERT(IsReadyForUse() == TRUE); + ASSERT(IsReadyForUse() == true); SetUniform(m_rotationsUniform, rotations, count); } diff --git a/src/framework/graphics/viewcontext.cpp b/src/framework/graphics/viewcontext.cpp index e6f323a..d4b66f0 100644 --- a/src/framework/graphics/viewcontext.cpp +++ b/src/framework/graphics/viewcontext.cpp @@ -17,9 +17,9 @@ ViewContext::ViewContext() { m_graphicsDevice = NULL; m_viewport = Rect(0, 0, 0, 0); - m_viewportIsFixedSize = FALSE; + m_viewportIsFixedSize = false; m_camera = NULL; - m_usingDefaultCamera = FALSE; + m_usingDefaultCamera = false; } ViewContext::~ViewContext() @@ -34,48 +34,48 @@ void ViewContext::Release() m_graphicsDevice = NULL; m_viewport = Rect(0, 0, 0, 0); - m_viewportIsFixedSize = FALSE; + m_viewportIsFixedSize = false; m_screenOrientation = SCREEN_ANGLE_0; m_camera = NULL; - m_usingDefaultCamera = FALSE; + m_usingDefaultCamera = false; } -BOOL ViewContext::Create(GraphicsDevice *graphicsDevice) +bool ViewContext::Create(GraphicsDevice *graphicsDevice) { ASSERT(m_graphicsDevice == NULL); if (m_graphicsDevice != NULL) - return FALSE; + return false; ASSERT(graphicsDevice != NULL); m_graphicsDevice = graphicsDevice; m_viewport = m_graphicsDevice->GetWindow()->GetRect(); - m_viewportIsFixedSize = FALSE; + m_viewportIsFixedSize = false; m_screenOrientation = SCREEN_ANGLE_0; m_camera = new Camera(this); - m_usingDefaultCamera = TRUE; + m_usingDefaultCamera = true; - return TRUE; + return true; } -BOOL ViewContext::Create(GraphicsDevice *graphicsDevice, const Rect &fixedViewportSize) +bool ViewContext::Create(GraphicsDevice *graphicsDevice, const Rect &fixedViewportSize) { ASSERT(m_graphicsDevice == NULL); if (m_graphicsDevice != NULL) - return FALSE; + return false; ASSERT(graphicsDevice != NULL); m_graphicsDevice = graphicsDevice; m_viewport = fixedViewportSize; - m_viewportIsFixedSize = TRUE; + m_viewportIsFixedSize = true; m_screenOrientation = SCREEN_ANGLE_0; m_camera = new Camera(this); - m_usingDefaultCamera = TRUE; + m_usingDefaultCamera = true; - return TRUE; + return true; } void ViewContext::OnNewContext() @@ -175,7 +175,7 @@ void ViewContext::SetCamera(Camera *camera) if (m_usingDefaultCamera && camera != NULL) { SAFE_DELETE(m_camera); - m_usingDefaultCamera = FALSE; + m_usingDefaultCamera = false; m_camera = camera; } @@ -190,7 +190,7 @@ void ViewContext::SetCamera(Camera *camera) { m_camera = new Camera(this); ASSERT(m_camera != NULL); - m_usingDefaultCamera = TRUE; + m_usingDefaultCamera = true; } } diff --git a/src/framework/graphics/viewcontext.h b/src/framework/graphics/viewcontext.h index a812b28..e2c43e9 100644 --- a/src/framework/graphics/viewcontext.h +++ b/src/framework/graphics/viewcontext.h @@ -16,8 +16,8 @@ public: ViewContext(); virtual ~ViewContext(); - BOOL Create(GraphicsDevice *graphicsDevice); - BOOL Create(GraphicsDevice *graphicsDevice, const Rect &fixedViewportSize); + bool Create(GraphicsDevice *graphicsDevice); + bool Create(GraphicsDevice *graphicsDevice, const Rect &fixedViewportSize); void Release(); void OnNewContext(); @@ -47,8 +47,8 @@ public: uint GetViewportWidth() const { return (uint)m_viewport.GetWidth(); } uint GetViewportHeight() const { return (uint)m_viewport.GetHeight(); } - BOOL IsViewportFixedSize() const { return m_viewportIsFixedSize; } - BOOL IgnoringScreenRotation() const { return m_viewportIsFixedSize; } + bool IsViewportFixedSize() const { return m_viewportIsFixedSize; } + bool IgnoringScreenRotation() const { return m_viewportIsFixedSize; } private: void SetupViewport(const Rect &size, SCREEN_ORIENTATION_ANGLE screenOrientation); @@ -56,11 +56,11 @@ private: GraphicsDevice *m_graphicsDevice; Rect m_viewport; - BOOL m_viewportIsFixedSize; + bool m_viewportIsFixedSize; SCREEN_ORIENTATION_ANGLE m_screenOrientation; Camera *m_camera; - BOOL m_usingDefaultCamera; + bool m_usingDefaultCamera; MatrixStack m_modelviewStack; MatrixStack m_projectionStack; diff --git a/src/framework/gwen/gwen_inputprocessor.cpp b/src/framework/gwen/gwen_inputprocessor.cpp index c06e506..7c951ce 100644 --- a/src/framework/gwen/gwen_inputprocessor.cpp +++ b/src/framework/gwen/gwen_inputprocessor.cpp @@ -15,29 +15,29 @@ namespace Gwen { m_gameApp = gameApp; m_canvas = canvas; - m_enabled = FALSE; + m_enabled = false; - Enable(TRUE); + Enable(true); } InputProcessor::~InputProcessor() { - Enable(FALSE); + Enable(false); } - BOOL InputProcessor::OnKeyDown(KEYS key) + bool InputProcessor::OnKeyDown(KEYS key) { unsigned char gwenKey = ConvertToGwenKey(key); - return (BOOL)m_canvas->InputKey(gwenKey, TRUE); + return (bool)m_canvas->InputKey(gwenKey, true); } - BOOL InputProcessor::OnKeyUp(KEYS key) + bool InputProcessor::OnKeyUp(KEYS key) { unsigned char gwenKey = ConvertToGwenKey(key); - return (BOOL)m_canvas->InputKey(gwenKey, FALSE); + return (bool)m_canvas->InputKey(gwenKey, false); } - BOOL InputProcessor::OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y) + bool InputProcessor::OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y) { int gwenButton = ConvertToGwenButton(button); @@ -46,14 +46,14 @@ namespace Gwen // trigger mouse move event for button events to ensure GWEN // knows where the button event occured at - BOOL movedResult = (BOOL)m_canvas->InputMouseMoved(scaledX, scaledY, 0, 0); - BOOL clickResult = (BOOL)m_canvas->InputMouseButton(gwenButton, TRUE); + bool movedResult = (bool)m_canvas->InputMouseMoved(scaledX, scaledY, 0, 0); + bool clickResult = (bool)m_canvas->InputMouseButton(gwenButton, true); // TODO: is this really the right way to do this .. ? return (movedResult || clickResult); } - BOOL InputProcessor::OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y) + bool InputProcessor::OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y) { int gwenButton = ConvertToGwenButton(button); @@ -62,14 +62,14 @@ namespace Gwen // trigger mouse move event for button events to ensure GWEN // knows where the button event occured at - BOOL movedResult = (BOOL)m_canvas->InputMouseMoved(scaledX, scaledY, 0, 0); - BOOL clickResult = (BOOL)m_canvas->InputMouseButton(gwenButton, FALSE); + bool movedResult = (bool)m_canvas->InputMouseMoved(scaledX, scaledY, 0, 0); + bool clickResult = (bool)m_canvas->InputMouseButton(gwenButton, false); // TODO: is this really the right way to do this .. ? return (movedResult || clickResult); } - BOOL InputProcessor::OnMouseMove(uint x, uint y, int deltaX, int deltaY) + bool InputProcessor::OnMouseMove(uint x, uint y, int deltaX, int deltaY) { // Gwen's input handling only processes coordinates in terms of scale = 1.0f int scaledX = (float)x / m_canvas->Scale(); @@ -77,46 +77,46 @@ namespace Gwen int scaledDeltaX = (float)deltaX / m_canvas->Scale(); int scaledDeltaY = (float)deltaY / m_canvas->Scale(); - return (BOOL)m_canvas->InputMouseMoved(scaledX, scaledY, scaledDeltaX, scaledDeltaY); + return (bool)m_canvas->InputMouseMoved(scaledX, scaledY, scaledDeltaX, scaledDeltaY); } - BOOL InputProcessor::OnTouchDown(int id, uint x, uint y, BOOL isPrimary) + bool InputProcessor::OnTouchDown(int id, uint x, uint y, bool isPrimary) { if (!isPrimary) - return FALSE; + return false; // Gwen's input handling only processes coordinates in terms of scale = 1.0f int scaledX = (float)x / m_canvas->Scale(); int scaledY = (float)y / m_canvas->Scale(); - BOOL movedResult = (BOOL)m_canvas->InputMouseMoved(scaledX, scaledY, 0, 0); - BOOL clickResult = (BOOL)m_canvas->InputMouseButton(0, TRUE); + bool movedResult = (bool)m_canvas->InputMouseMoved(scaledX, scaledY, 0, 0); + bool clickResult = (bool)m_canvas->InputMouseButton(0, true); // TODO: is this really the right way to do this .. ? return (movedResult || clickResult); } - BOOL InputProcessor::OnTouchUp(int id, BOOL isPrimary) + bool InputProcessor::OnTouchUp(int id, bool isPrimary) { if (!isPrimary) - return FALSE; + return false; - BOOL clickResult = (BOOL)m_canvas->InputMouseButton(0, FALSE); + bool clickResult = (bool)m_canvas->InputMouseButton(0, false); // we do this so that GWEN isn't left thinking that the "mouse" is // hovering over whatever we were just clicking/touching. This is // done because obviously with a touchscreen, you don't hover over // anything unless you are clicking/touching... - BOOL movedResult = (BOOL)m_canvas->InputMouseMoved(-1, -1, 0, 0); + bool movedResult = (bool)m_canvas->InputMouseMoved(-1, -1, 0, 0); // TODO: is this really the right way to do this .. ? return (movedResult || clickResult); } - BOOL InputProcessor::OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, BOOL isPrimary) + bool InputProcessor::OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, bool isPrimary) { if (!isPrimary) - return FALSE; + return false; // Gwen's input handling only processes coordinates in terms of scale = 1.0f int scaledX = (float)x / m_canvas->Scale(); @@ -124,14 +124,14 @@ namespace Gwen int scaledDeltaX = (float)deltaX / m_canvas->Scale(); int scaledDeltaY = (float)deltaY / m_canvas->Scale(); - BOOL movedResult = (BOOL)m_canvas->InputMouseMoved(scaledX, scaledY, scaledDeltaX, scaledDeltaY); - BOOL clickResult = (BOOL)m_canvas->InputMouseButton(0, TRUE); + bool movedResult = (bool)m_canvas->InputMouseMoved(scaledX, scaledY, scaledDeltaX, scaledDeltaY); + bool clickResult = (bool)m_canvas->InputMouseButton(0, true); // TODO: is this really the right way to do this .. ? return (movedResult || clickResult); } - void InputProcessor::Enable(BOOL enable) + void InputProcessor::Enable(bool enable) { if (IsEnabled() == enable) return; diff --git a/src/framework/gwen/gwen_inputprocessor.h b/src/framework/gwen/gwen_inputprocessor.h index f444383..3d7417d 100644 --- a/src/framework/gwen/gwen_inputprocessor.h +++ b/src/framework/gwen/gwen_inputprocessor.h @@ -19,19 +19,19 @@ namespace Gwen InputProcessor(BaseGameApp *gameApp, Gwen::Controls::Canvas *canvas); virtual ~InputProcessor(); - BOOL OnKeyDown(KEYS key); - BOOL OnKeyUp(KEYS key); + bool OnKeyDown(KEYS key); + bool OnKeyUp(KEYS key); - BOOL OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y); - BOOL OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y); - BOOL OnMouseMove(uint x, uint y, int deltaX, int deltaY); + bool OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y); + bool OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y); + bool OnMouseMove(uint x, uint y, int deltaX, int deltaY); - BOOL OnTouchDown(int id, uint x, uint y, BOOL isPrimary); - BOOL OnTouchUp(int id, BOOL isPrimary); - BOOL OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, BOOL isPrimary); + bool OnTouchDown(int id, uint x, uint y, bool isPrimary); + bool OnTouchUp(int id, bool isPrimary); + bool OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, bool isPrimary); - BOOL IsEnabled() const { return m_enabled; } - void Enable(BOOL enable); + bool IsEnabled() const { return m_enabled; } + void Enable(bool enable); private: unsigned char ConvertToGwenKey(KEYS key) const; @@ -39,7 +39,7 @@ namespace Gwen BaseGameApp *m_gameApp; Gwen::Controls::Canvas *m_canvas; - BOOL m_enabled; + bool m_enabled; }; } } diff --git a/src/framework/input/keyboard.h b/src/framework/input/keyboard.h index 95d6535..059140e 100644 --- a/src/framework/input/keyboard.h +++ b/src/framework/input/keyboard.h @@ -16,26 +16,26 @@ public: virtual ~Keyboard() {} /** - * @return TRUE if the underlying keyboard device was detected to have + * @return true if the underlying keyboard device was detected to have * enough physical keys for full game control */ - virtual BOOL HasPhysicalKeysForGameControls() const = 0; + virtual bool HasPhysicalKeysForGameControls() const = 0; /** * Checks if the key is currently down, but not locked. * @param key the key to check - * @return TRUE if down and not locked, FALSE if not down or locked + * @return true if down and not locked, false if not down or locked */ - virtual BOOL IsDown(KEYS key) = 0; + virtual bool IsDown(KEYS key) = 0; /** * Checks if the key is currently down, but not locked. If so, the key is * locked until released so that duplicate "down" events will not be * registered for this key until it is released and pressed down again. * @param key the key to check - * @return TRUE if down and not locked, FALSE if not down or locked + * @return true if down and not locked, false if not down or locked */ - virtual BOOL IsPressed(KEYS key) = 0; + virtual bool IsPressed(KEYS key) = 0; /** * Locks the key so that it will not be reported as down until it is diff --git a/src/framework/input/keyboardlistener.h b/src/framework/input/keyboardlistener.h index 70a820c..ba06f7b 100644 --- a/src/framework/input/keyboardlistener.h +++ b/src/framework/input/keyboardlistener.h @@ -13,18 +13,18 @@ public: /** * Callback for when a key is down (pressed). * @param key the key that the event is for - * @return TRUE if no further listener callbacks of this kind should + * @return true if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnKeyDown(KEYS key) = 0; + virtual bool OnKeyDown(KEYS key) = 0; /** * Callback for when a key is up (released). * @param key the key that the event is for - * @return TRUE if no further listener callbacks of this kind should + * @return true if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnKeyUp(KEYS key) = 0; + virtual bool OnKeyUp(KEYS key) = 0; }; #endif diff --git a/src/framework/input/marmaladekeyboard.cpp b/src/framework/input/marmaladekeyboard.cpp index 22d7b17..75aa0ab 100644 --- a/src/framework/input/marmaladekeyboard.cpp +++ b/src/framework/input/marmaladekeyboard.cpp @@ -3,12 +3,12 @@ #include "keyboardlistener.h" #include -MarmaladeKeyboard::MarmaladeKeyboard(BOOL hasPhysicalKeysForGameControls) +MarmaladeKeyboard::MarmaladeKeyboard(bool hasPhysicalKeysForGameControls) { m_hasPhysicalKeysForGameControls = hasPhysicalKeysForGameControls; - m_keys = new BOOL[KSYM_LAST]; - m_lockedKeys = new BOOL[KSYM_LAST]; + m_keys = new bool[KSYM_LAST]; + m_lockedKeys = new bool[KSYM_LAST]; Reset(); } @@ -19,10 +19,10 @@ MarmaladeKeyboard::~MarmaladeKeyboard() SAFE_DELETE_ARRAY(m_lockedKeys); } -BOOL MarmaladeKeyboard::OnKeyEvent(const s3eKeyboardEvent *eventArgs) +bool MarmaladeKeyboard::OnKeyEvent(const s3eKeyboardEvent *eventArgs) { int keyCode = (int)eventArgs->m_Key; - BOOL isDown = (BOOL)eventArgs->m_Pressed; + bool isDown = (bool)eventArgs->m_Pressed; if (isDown) { @@ -49,34 +49,34 @@ BOOL MarmaladeKeyboard::OnKeyEvent(const s3eKeyboardEvent *eventArgs) } } - m_keys[keyCode] = FALSE; - m_lockedKeys[keyCode] = FALSE; + m_keys[keyCode] = false; + m_lockedKeys[keyCode] = false; } - return TRUE; + return true; } -BOOL MarmaladeKeyboard::OnKeyCharEvent(const s3eKeyboardCharEvent *eventArgs) +bool MarmaladeKeyboard::OnKeyCharEvent(const s3eKeyboardCharEvent *eventArgs) { // TODO: implementation - return FALSE; + return false; } -BOOL MarmaladeKeyboard::IsPressed(KEYS key) +bool MarmaladeKeyboard::IsPressed(KEYS key) { if (m_keys[key] && !m_lockedKeys[key]) { - m_lockedKeys[key] = TRUE; - return TRUE; + m_lockedKeys[key] = true; + return true; } else - return FALSE; + return false; } void MarmaladeKeyboard::Reset() { - memset(m_keys, FALSE, sizeof(BOOL) * KSYM_LAST); - memset(m_lockedKeys, FALSE, sizeof(BOOL) * KSYM_LAST); + memset(m_keys, false, sizeof(bool) * KSYM_LAST); + memset(m_lockedKeys, false, sizeof(bool) * KSYM_LAST); } void MarmaladeKeyboard::RegisterListener(KeyboardListener *listener) diff --git a/src/framework/input/marmaladekeyboard.h b/src/framework/input/marmaladekeyboard.h index 1ef888b..fa9e628 100644 --- a/src/framework/input/marmaladekeyboard.h +++ b/src/framework/input/marmaladekeyboard.h @@ -12,17 +12,17 @@ class KeyboardListener; class MarmaladeKeyboard : public Keyboard { public: - MarmaladeKeyboard(BOOL hasPhysicalKeysForGameControls); + MarmaladeKeyboard(bool hasPhysicalKeysForGameControls); virtual ~MarmaladeKeyboard(); - BOOL OnKeyEvent(const s3eKeyboardEvent *eventArgs); - BOOL OnKeyCharEvent(const s3eKeyboardCharEvent *eventArgs); + bool OnKeyEvent(const s3eKeyboardEvent *eventArgs); + bool OnKeyCharEvent(const s3eKeyboardCharEvent *eventArgs); - BOOL HasPhysicalKeysForGameControls() const { return m_hasPhysicalKeysForGameControls; } + bool HasPhysicalKeysForGameControls() const { return m_hasPhysicalKeysForGameControls; } - BOOL IsDown(KEYS key) { return m_keys[key] && !m_lockedKeys[key]; } - BOOL IsPressed(KEYS key); - void Lock(KEYS key) { m_lockedKeys[key] = TRUE; } + bool IsDown(KEYS key) { return m_keys[key] && !m_lockedKeys[key]; } + bool IsPressed(KEYS key); + void Lock(KEYS key) { m_lockedKeys[key] = true; } void Reset(); @@ -31,9 +31,9 @@ public: private: stl::set m_listeners; - BOOL *m_keys; - BOOL *m_lockedKeys; - BOOL m_hasPhysicalKeysForGameControls; + bool *m_keys; + bool *m_lockedKeys; + bool m_hasPhysicalKeysForGameControls; }; #endif diff --git a/src/framework/input/marmalademouse.cpp b/src/framework/input/marmalademouse.cpp index 8303dc2..93aa88d 100644 --- a/src/framework/input/marmalademouse.cpp +++ b/src/framework/input/marmalademouse.cpp @@ -9,8 +9,8 @@ const int32_t NUM_BUTTONS = S3E_POINTER_BUTTON_MAX; MarmaladeMouse::MarmaladeMouse() { - m_buttons = new BOOL[NUM_BUTTONS]; - m_lockedButtons = new BOOL[NUM_BUTTONS]; + m_buttons = new bool[NUM_BUTTONS]; + m_lockedButtons = new bool[NUM_BUTTONS]; Reset(); } @@ -27,10 +27,10 @@ void MarmaladeMouse::ResetDeltas() m_deltaY = 0; } -BOOL MarmaladeMouse::OnButtonEvent(const s3ePointerEvent *eventArgs) +bool MarmaladeMouse::OnButtonEvent(const s3ePointerEvent *eventArgs) { int button = (int32_t)eventArgs->m_Button; - BOOL isDown = (BOOL)eventArgs->m_Pressed; + bool isDown = (bool)eventArgs->m_Pressed; int x = eventArgs->m_x; int y = eventArgs->m_y; @@ -60,14 +60,14 @@ BOOL MarmaladeMouse::OnButtonEvent(const s3ePointerEvent *eventArgs) } } - m_buttons[button] = FALSE; - m_lockedButtons[button] = FALSE; + m_buttons[button] = false; + m_lockedButtons[button] = false; } - return TRUE; + return true; } -BOOL MarmaladeMouse::OnMotionEvent(const s3ePointerMotionEvent *eventArgs) +bool MarmaladeMouse::OnMotionEvent(const s3ePointerMotionEvent *eventArgs) { m_deltaX = eventArgs->m_x - m_x; m_deltaY = eventArgs->m_y - m_y; @@ -85,24 +85,24 @@ BOOL MarmaladeMouse::OnMotionEvent(const s3ePointerMotionEvent *eventArgs) } } - return TRUE; + return true; } -BOOL MarmaladeMouse::IsPressed(MOUSE_BUTTONS button) +bool MarmaladeMouse::IsPressed(MOUSE_BUTTONS button) { if (m_buttons[button] && !m_lockedButtons[button]) { - m_lockedButtons[button] = TRUE; - return TRUE; + m_lockedButtons[button] = true; + return true; } else - return FALSE; + return false; } void MarmaladeMouse::Reset() { - memset(m_buttons, FALSE, sizeof(BOOL) * NUM_BUTTONS); - memset(m_lockedButtons, FALSE, sizeof(BOOL) * NUM_BUTTONS); + memset(m_buttons, false, sizeof(bool) * NUM_BUTTONS); + memset(m_lockedButtons, false, sizeof(bool) * NUM_BUTTONS); m_x = 0; m_y = 0; m_deltaX = 0; diff --git a/src/framework/input/marmalademouse.h b/src/framework/input/marmalademouse.h index 04a09e8..6bb9416 100644 --- a/src/framework/input/marmalademouse.h +++ b/src/framework/input/marmalademouse.h @@ -17,12 +17,12 @@ public: void ResetDeltas(); - BOOL OnButtonEvent(const s3ePointerEvent *eventArgs); - BOOL OnMotionEvent(const s3ePointerMotionEvent *eventArgs); + bool OnButtonEvent(const s3ePointerEvent *eventArgs); + bool OnMotionEvent(const s3ePointerMotionEvent *eventArgs); - BOOL IsDown(MOUSE_BUTTONS button) { return m_buttons[button] && !m_lockedButtons[button]; } - BOOL IsPressed(MOUSE_BUTTONS button); - void Lock(MOUSE_BUTTONS button) { m_lockedButtons[button] = TRUE; } + bool IsDown(MOUSE_BUTTONS button) { return m_buttons[button] && !m_lockedButtons[button]; } + bool IsPressed(MOUSE_BUTTONS button); + void Lock(MOUSE_BUTTONS button) { m_lockedButtons[button] = true; } uint GetX() const { return m_x; } uint GetY() const { return m_y; } @@ -36,8 +36,8 @@ public: private: stl::set m_listeners; - BOOL *m_buttons; - BOOL *m_lockedButtons; + bool *m_buttons; + bool *m_lockedButtons; uint m_x; uint m_y; diff --git a/src/framework/input/marmaladetouchscreen.cpp b/src/framework/input/marmaladetouchscreen.cpp index bc04210..c0fe025 100644 --- a/src/framework/input/marmaladetouchscreen.cpp +++ b/src/framework/input/marmaladetouchscreen.cpp @@ -14,7 +14,7 @@ MarmaladeTouchPointer::MarmaladeTouchPointer() m_y = 0; m_deltaX = 0; m_deltaY = 0; - m_isTouching = FALSE; + m_isTouching = false; } MarmaladeTouchPointer::~MarmaladeTouchPointer() @@ -27,51 +27,51 @@ void MarmaladeTouchPointer::ResetDeltas() m_deltaY = 0; } -BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint left, uint top, uint right, uint bottom) const +bool MarmaladeTouchPointer::IsTouchingWithinArea(uint left, uint top, uint right, uint bottom) const { if (m_isTouching && m_x >= left && m_y >= top && m_x <= right && m_y <= bottom) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Rect &area) const +bool MarmaladeTouchPointer::IsTouchingWithinArea(const Rect &area) const { if (m_isTouching && m_x >= area.left && m_y >= area.top && m_x <= area.right && m_y <= area.bottom) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint centerX, uint centerY, uint radius) const +bool MarmaladeTouchPointer::IsTouchingWithinArea(uint centerX, uint centerY, uint radius) const { if (m_isTouching) { uint squaredDistance = ((centerX - m_x) * (centerX - m_x)) + ((centerY - m_y) * (centerY - m_y)); uint squaredRadius = radius * radius; if (squaredDistance <= squaredRadius) - return TRUE; + return true; } - return FALSE; + return false; } -BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Circle &area) const +bool MarmaladeTouchPointer::IsTouchingWithinArea(const Circle &area) const { if (m_isTouching) { uint squaredDistance = ((area.x - m_x) * (area.x - m_x)) + ((area.y - m_y) * (area.y - m_y)); uint squaredRadius = area.radius * area.radius; if (squaredDistance <= squaredRadius) - return TRUE; + return true; } - return FALSE; + return false; } void MarmaladeTouchPointer::OnDown(int id, uint x, uint y) { - m_isTouching = TRUE; + m_isTouching = true; m_x = x; m_y = y; m_deltaX = 0; @@ -97,10 +97,10 @@ void MarmaladeTouchPointer::OnUp() m_y = 0; m_deltaX = 0; m_deltaY = 0; - m_isTouching = FALSE; + m_isTouching = false; } -MarmaladeTouchscreen::MarmaladeTouchscreen(MarmaladeSystem *system, BOOL isMultitouchAvailable) +MarmaladeTouchscreen::MarmaladeTouchscreen(MarmaladeSystem *system, bool isMultitouchAvailable) { m_system = system; @@ -135,22 +135,22 @@ void MarmaladeTouchscreen::ResetViewBounds(const Rect &viewBounds) m_viewBounds = viewBounds; } -BOOL MarmaladeTouchscreen::OnSingleTouchTapEvent(const s3ePointerEvent *eventArgs) +bool MarmaladeTouchscreen::OnSingleTouchTapEvent(const s3ePointerEvent *eventArgs) { ASSERT(m_maxTouchPoints == 1); - return FALSE; + return false; } -BOOL MarmaladeTouchscreen::OnSingleTouchMotionEvent(const s3ePointerMotionEvent *eventArgs) +bool MarmaladeTouchscreen::OnSingleTouchMotionEvent(const s3ePointerMotionEvent *eventArgs) { ASSERT(m_maxTouchPoints == 1); - return FALSE; + return false; } -BOOL MarmaladeTouchscreen::OnMultiTouchTapEvent(const s3ePointerTouchEvent *eventArgs) +bool MarmaladeTouchscreen::OnMultiTouchTapEvent(const s3ePointerTouchEvent *eventArgs) { ASSERT(m_maxTouchPoints > 1); - BOOL isDown = (BOOL)eventArgs->m_Pressed; + bool isDown = (bool)eventArgs->m_Pressed; if (isDown) { // this should only happen for new touch points? @@ -163,11 +163,11 @@ BOOL MarmaladeTouchscreen::OnMultiTouchTapEvent(const s3ePointerTouchEvent *even // if no other touch points are currently down, then this one is to be // considered the primary one - BOOL isPrimary = FALSE; + bool isPrimary = false; if (m_currentTouchPoints == 0) { m_primaryPointer = pointer; - isPrimary = TRUE; + isPrimary = true; } ++m_currentTouchPoints; @@ -193,11 +193,11 @@ BOOL MarmaladeTouchscreen::OnMultiTouchTapEvent(const s3ePointerTouchEvent *even // if this pointer was the primary one, we need to switch the primary // to one of the other currently down pointers - BOOL wasPrimary = FALSE; + bool wasPrimary = false; if (m_primaryPointer == pointer) { m_primaryPointer = GetNextDownPointer(); - wasPrimary = TRUE; + wasPrimary = true; } --m_currentTouchPoints; @@ -216,10 +216,10 @@ BOOL MarmaladeTouchscreen::OnMultiTouchTapEvent(const s3ePointerTouchEvent *even } } - return TRUE; + return true; } -BOOL MarmaladeTouchscreen::OnMultiTouchMotionEvent(const s3ePointerTouchMotionEvent *eventArgs) +bool MarmaladeTouchscreen::OnMultiTouchMotionEvent(const s3ePointerTouchMotionEvent *eventArgs) { ASSERT(m_maxTouchPoints > 1); MarmaladeTouchPointer *pointer = GetPointerById_internal(eventArgs->m_TouchID); @@ -229,9 +229,9 @@ BOOL MarmaladeTouchscreen::OnMultiTouchMotionEvent(const s3ePointerTouchMotionEv uint y = Clamp(eventArgs->m_y, m_viewBounds.top, m_viewBounds.bottom) - m_viewBounds.top; pointer->OnMove(eventArgs->m_TouchID, x, y); - BOOL isPrimary = FALSE; + bool isPrimary = false; if (m_primaryPointer == pointer) - isPrimary = TRUE; + isPrimary = true; for (stl::set::iterator i = m_listeners.begin(); i != m_listeners.end(); ++i) { @@ -246,22 +246,22 @@ BOOL MarmaladeTouchscreen::OnMultiTouchMotionEvent(const s3ePointerTouchMotionEv LOG_WARN("TOUCHSCREEN", "Received s3ePointerTouchMotionEvent, m_TouchID=%d which is not currently in m_pointers.\n", eventArgs->m_TouchID); } - return TRUE; + return true; } -BOOL MarmaladeTouchscreen::WasTapped() +bool MarmaladeTouchscreen::WasTapped() { if (m_isTouching && !m_isLocked) { - m_isLocked = TRUE; + m_isLocked = true; } else if (!m_isTouching && m_isLocked) { - m_isLocked = FALSE; - return TRUE; + m_isLocked = false; + return true; } - return FALSE; + return false; } const TouchPointer* MarmaladeTouchscreen::GetPointerById(int id) const @@ -325,15 +325,15 @@ void MarmaladeTouchscreen::Reset() MarmaladeTouchPointer *oldPrimaryPointer = m_primaryPointer; m_primaryPointer = &m_pointers[0]; - m_isTouching = FALSE; - m_isLocked = FALSE; + m_isTouching = false; + m_isLocked = false; m_currentTouchPoints = 0; for (uint i = 0; i < m_maxTouchPoints; ++i) { - BOOL isPrimary = FALSE; + bool isPrimary = false; if (oldPrimaryPointer == &m_pointers[i]) - isPrimary = TRUE; + isPrimary = true; int id = m_pointers[i].GetId(); m_pointers[i].OnUp(); diff --git a/src/framework/input/marmaladetouchscreen.h b/src/framework/input/marmaladetouchscreen.h index 75b9e12..1167151 100644 --- a/src/framework/input/marmaladetouchscreen.h +++ b/src/framework/input/marmaladetouchscreen.h @@ -25,12 +25,12 @@ public: uint GetY() const { return m_y; } int GetDeltaX() const { return m_deltaX; } int GetDeltaY() const { return m_deltaY; } - BOOL IsTouching() const { return m_isTouching; } + bool IsTouching() const { return m_isTouching; } - BOOL IsTouchingWithinArea(uint left, uint top, uint right, uint bottom) const; - BOOL IsTouchingWithinArea(const Rect &area) const; - BOOL IsTouchingWithinArea(uint centerX, uint centerY, uint radius) const; - BOOL IsTouchingWithinArea(const Circle &area) const; + bool IsTouchingWithinArea(uint left, uint top, uint right, uint bottom) const; + bool IsTouchingWithinArea(const Rect &area) const; + bool IsTouchingWithinArea(uint centerX, uint centerY, uint radius) const; + bool IsTouchingWithinArea(const Circle &area) const; void OnDown(int id, uint x, uint y); void OnMove(int id, uint x, uint y); @@ -42,28 +42,28 @@ private: uint m_y; int m_deltaX; int m_deltaY; - BOOL m_isTouching; + bool m_isTouching; }; class MarmaladeTouchscreen : public Touchscreen { public: - MarmaladeTouchscreen(MarmaladeSystem *system, BOOL isMultitouchAvailable); + MarmaladeTouchscreen(MarmaladeSystem *system, bool isMultitouchAvailable); virtual ~MarmaladeTouchscreen(); void ResetDeltas(); void ResetViewBounds(const Rect &viewBounds); - BOOL OnSingleTouchTapEvent(const s3ePointerEvent *eventArgs); - BOOL OnSingleTouchMotionEvent(const s3ePointerMotionEvent *eventArgs); - BOOL OnMultiTouchTapEvent(const s3ePointerTouchEvent *eventArgs); - BOOL OnMultiTouchMotionEvent(const s3ePointerTouchMotionEvent *eventArgs); + bool OnSingleTouchTapEvent(const s3ePointerEvent *eventArgs); + bool OnSingleTouchMotionEvent(const s3ePointerMotionEvent *eventArgs); + bool OnMultiTouchTapEvent(const s3ePointerTouchEvent *eventArgs); + bool OnMultiTouchMotionEvent(const s3ePointerTouchMotionEvent *eventArgs); - BOOL IsMultitouchAvailable() const { return m_isMultitouchAvailable; } + bool IsMultitouchAvailable() const { return m_isMultitouchAvailable; } uint GetPointerCount() const { return m_maxTouchPoints; } uint GetCurrentPointerCount() const { return m_currentTouchPoints; } - BOOL IsTouching() const { return m_isTouching; } - BOOL WasTapped(); + bool IsTouching() const { return m_isTouching; } + bool WasTapped(); const TouchPointer* GetPrimaryPointer() const { return (TouchPointer*)m_primaryPointer; } const TouchPointer* GetPointer(uint index) const { return (TouchPointer*)&m_pointers[index]; } const TouchPointer* GetPointerById(int id) const; @@ -84,11 +84,11 @@ private: stl::set m_listeners; MarmaladeTouchPointer *m_pointers; MarmaladeTouchPointer *m_primaryPointer; - BOOL m_isTouching; - BOOL m_isLocked; + bool m_isTouching; + bool m_isLocked; MarmaladeSystem *m_system; - BOOL m_isMultitouchAvailable; + bool m_isMultitouchAvailable; uint m_maxTouchPoints; uint m_currentTouchPoints; }; diff --git a/src/framework/input/mouse.h b/src/framework/input/mouse.h index 1a6b4ea..9bb870a 100644 --- a/src/framework/input/mouse.h +++ b/src/framework/input/mouse.h @@ -18,9 +18,9 @@ public: /** * Checks if the button is currently down, but not locked. * @param button the button to check - * @return TRUE if down and not locked, FALSE if not down or locked + * @return true if down and not locked, false if not down or locked */ - virtual BOOL IsDown(MOUSE_BUTTONS button) = 0; + virtual bool IsDown(MOUSE_BUTTONS button) = 0; /** * Checks if the button is currently down, but not locked. If so, the @@ -28,9 +28,9 @@ public: * not be registered for this button until it is released and pressed * down again. * @param button the button to check - * @return TRUE if down and not locked, FALSE if not down or locked + * @return true if down and not locked, false if not down or locked */ - virtual BOOL IsPressed(MOUSE_BUTTONS button) = 0; + virtual bool IsPressed(MOUSE_BUTTONS button) = 0; /** * Locks the button so that it will not be reported as down until it is diff --git a/src/framework/input/mouselistener.h b/src/framework/input/mouselistener.h index 049ae55..025fc83 100644 --- a/src/framework/input/mouselistener.h +++ b/src/framework/input/mouselistener.h @@ -16,20 +16,20 @@ public: * @param button the button that the event is for * @param x current X coordinate of the mouse cursor * @param y current Y coordinate of the mouse cursor - * @return TRUE if no further listener callbacks of this kind should + * @return true if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y) = 0; + virtual bool OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y) = 0; /** * Callback for when a button is up (released). * @param button the button that the event is for * @param x current X coordinate of the mouse cursor * @param y current Y coordinate of the mouse cursor - * @return TRUE if no further listener callbacks of this kind should + * @return true if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y) = 0; + virtual bool OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y) = 0; /** * Callback for when the mouse cursor moves. @@ -37,10 +37,10 @@ public: * @param y new Y coordinate of the mouse cursor * @param deltaX amount the mouse cursor moved since the last move event along the X axis * @param deltaY amount the mouse cursor moved since the last move event along the Y axis - * @return TRUE if no further listener callbacks of this kind should + * @return true if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnMouseMove(uint x, uint y, int deltaX, int deltaY) = 0; + virtual bool OnMouseMove(uint x, uint y, int deltaX, int deltaY) = 0; }; #endif diff --git a/src/framework/input/sdlkeyboard.cpp b/src/framework/input/sdlkeyboard.cpp index 1dc0a33..83d80fc 100644 --- a/src/framework/input/sdlkeyboard.cpp +++ b/src/framework/input/sdlkeyboard.cpp @@ -5,13 +5,13 @@ #include "../sdlsystem.h" #include -SDLKeyboard::SDLKeyboard(SDLSystem *system, BOOL hasPhysicalKeysForGameControls) +SDLKeyboard::SDLKeyboard(SDLSystem *system, bool hasPhysicalKeysForGameControls) { m_system = system; m_hasPhysicalKeysForGameControls = hasPhysicalKeysForGameControls; - m_keys = new BOOL[KSYM_LAST]; - m_lockedKeys = new BOOL[KSYM_LAST]; + m_keys = new bool[KSYM_LAST]; + m_lockedKeys = new bool[KSYM_LAST]; Reset(); } @@ -22,7 +22,7 @@ SDLKeyboard::~SDLKeyboard() SAFE_DELETE_ARRAY(m_lockedKeys); } -BOOL SDLKeyboard::OnKeyEvent(const SDL_KeyboardEvent *eventArgs) +bool SDLKeyboard::OnKeyEvent(const SDL_KeyboardEvent *eventArgs) { int keyCode = (int)eventArgs->keysym.sym; @@ -51,28 +51,28 @@ BOOL SDLKeyboard::OnKeyEvent(const SDL_KeyboardEvent *eventArgs) } } - m_keys[keyCode] = FALSE; - m_lockedKeys[keyCode] = FALSE; + m_keys[keyCode] = false; + m_lockedKeys[keyCode] = false; } - return TRUE; + return true; } -BOOL SDLKeyboard::IsPressed(KEYS key) +bool SDLKeyboard::IsPressed(KEYS key) { if (m_keys[key] && !m_lockedKeys[key]) { - m_lockedKeys[key] = TRUE; - return TRUE; + m_lockedKeys[key] = true; + return true; } else - return FALSE; + return false; } void SDLKeyboard::Reset() { - memset(m_keys, FALSE, sizeof(BOOL) * KSYM_LAST); - memset(m_lockedKeys, FALSE, sizeof(BOOL) * KSYM_LAST); + memset(m_keys, false, sizeof(bool) * KSYM_LAST); + memset(m_lockedKeys, false, sizeof(bool) * KSYM_LAST); } void SDLKeyboard::RegisterListener(KeyboardListener *listener) diff --git a/src/framework/input/sdlkeyboard.h b/src/framework/input/sdlkeyboard.h index c133ea1..751ec6d 100644 --- a/src/framework/input/sdlkeyboard.h +++ b/src/framework/input/sdlkeyboard.h @@ -13,16 +13,16 @@ class SDLSystem; class SDLKeyboard : public Keyboard { public: - SDLKeyboard(SDLSystem *system, BOOL hasPhysicalKeysForGameControls); + SDLKeyboard(SDLSystem *system, bool hasPhysicalKeysForGameControls); virtual ~SDLKeyboard(); - BOOL OnKeyEvent(const SDL_KeyboardEvent *eventArgs); + bool OnKeyEvent(const SDL_KeyboardEvent *eventArgs); - BOOL HasPhysicalKeysForGameControls() const { return m_hasPhysicalKeysForGameControls; } + bool HasPhysicalKeysForGameControls() const { return m_hasPhysicalKeysForGameControls; } - BOOL IsDown(KEYS key) { return m_keys[key] && !m_lockedKeys[key]; } - BOOL IsPressed(KEYS key); - void Lock(KEYS key) { m_lockedKeys[key] = TRUE; } + bool IsDown(KEYS key) { return m_keys[key] && !m_lockedKeys[key]; } + bool IsPressed(KEYS key); + void Lock(KEYS key) { m_lockedKeys[key] = true; } void Reset(); @@ -33,9 +33,9 @@ private: stl::set m_listeners; SDLSystem *m_system; - BOOL *m_keys; - BOOL *m_lockedKeys; - BOOL m_hasPhysicalKeysForGameControls; + bool *m_keys; + bool *m_lockedKeys; + bool m_hasPhysicalKeysForGameControls; }; #endif diff --git a/src/framework/input/sdlmouse.cpp b/src/framework/input/sdlmouse.cpp index 915f5e2..6a149e9 100644 --- a/src/framework/input/sdlmouse.cpp +++ b/src/framework/input/sdlmouse.cpp @@ -12,8 +12,8 @@ SDLMouse::SDLMouse(SDLSystem *system) { m_system = system; - m_buttons = new BOOL[NUM_BUTTONS]; - m_lockedButtons = new BOOL[NUM_BUTTONS]; + m_buttons = new bool[NUM_BUTTONS]; + m_lockedButtons = new bool[NUM_BUTTONS]; Reset(); } @@ -30,7 +30,7 @@ void SDLMouse::ResetDeltas() m_deltaY = 0; } -BOOL SDLMouse::OnButtonEvent(const SDL_MouseButtonEvent *eventArgs) +bool SDLMouse::OnButtonEvent(const SDL_MouseButtonEvent *eventArgs) { // translate from SDL's button values to our own MOUSE_BUTTONS enum int button = (int)eventArgs->button - 1; @@ -67,14 +67,14 @@ BOOL SDLMouse::OnButtonEvent(const SDL_MouseButtonEvent *eventArgs) } } - m_buttons[button] = FALSE; - m_lockedButtons[button] = FALSE; + m_buttons[button] = false; + m_lockedButtons[button] = false; } - return TRUE; + return true; } -BOOL SDLMouse::OnMotionEvent(const SDL_MouseMotionEvent *eventArgs) +bool SDLMouse::OnMotionEvent(const SDL_MouseMotionEvent *eventArgs) { m_deltaX = eventArgs->x - m_x; m_deltaY = eventArgs->y - m_y; @@ -92,24 +92,24 @@ BOOL SDLMouse::OnMotionEvent(const SDL_MouseMotionEvent *eventArgs) } } - return TRUE; + return true; } -BOOL SDLMouse::IsPressed(MOUSE_BUTTONS button) +bool SDLMouse::IsPressed(MOUSE_BUTTONS button) { if (m_buttons[button] && !m_lockedButtons[button]) { - m_lockedButtons[button] = TRUE; - return TRUE; + m_lockedButtons[button] = true; + return true; } else - return FALSE; + return false; } void SDLMouse::Reset() { - memset(m_buttons, FALSE, sizeof(BOOL) * NUM_BUTTONS); - memset(m_lockedButtons, FALSE, sizeof(BOOL) * NUM_BUTTONS); + memset(m_buttons, false, sizeof(bool) * NUM_BUTTONS); + memset(m_lockedButtons, false, sizeof(bool) * NUM_BUTTONS); m_x = 0; m_y = 0; m_deltaX = 0; diff --git a/src/framework/input/sdlmouse.h b/src/framework/input/sdlmouse.h index 8587165..f7d54e7 100644 --- a/src/framework/input/sdlmouse.h +++ b/src/framework/input/sdlmouse.h @@ -18,12 +18,12 @@ public: void ResetDeltas(); - BOOL OnButtonEvent(const SDL_MouseButtonEvent *eventArgs); - BOOL OnMotionEvent(const SDL_MouseMotionEvent *eventArgs); + bool OnButtonEvent(const SDL_MouseButtonEvent *eventArgs); + bool OnMotionEvent(const SDL_MouseMotionEvent *eventArgs); - BOOL IsDown(MOUSE_BUTTONS button) { return m_buttons[button] && !m_lockedButtons[button]; } - BOOL IsPressed(MOUSE_BUTTONS button); - void Lock(MOUSE_BUTTONS button) { m_lockedButtons[button] = TRUE; } + bool IsDown(MOUSE_BUTTONS button) { return m_buttons[button] && !m_lockedButtons[button]; } + bool IsPressed(MOUSE_BUTTONS button); + void Lock(MOUSE_BUTTONS button) { m_lockedButtons[button] = true; } uint GetX() const { return m_x; } uint GetY() const { return m_y; } @@ -39,8 +39,8 @@ private: stl::set m_listeners; SDLSystem *m_system; - BOOL *m_buttons; - BOOL *m_lockedButtons; + bool *m_buttons; + bool *m_lockedButtons; uint m_x; uint m_y; diff --git a/src/framework/input/touchscreen.h b/src/framework/input/touchscreen.h index f3c185e..5afb383 100644 --- a/src/framework/input/touchscreen.h +++ b/src/framework/input/touchscreen.h @@ -46,9 +46,9 @@ public: virtual int GetDeltaY() const = 0; /** - * @return TRUE if this touch point is currently down + * @return true if this touch point is currently down */ - virtual BOOL IsTouching() const = 0; + virtual bool IsTouching() const = 0; /** * Checks if this touch point is currently down within a given area. @@ -56,32 +56,32 @@ public: * @param top top Y coordinate of the area to check * @param right right X coordinate of the area to check * @param bottom bottom Y coordinate of the area to check - * @return TRUE if the touch point is currently down within the given area + * @return true if the touch point is currently down within the given area */ - virtual BOOL IsTouchingWithinArea(uint left, uint top, uint right, uint bottom) const = 0; + virtual bool IsTouchingWithinArea(uint left, uint top, uint right, uint bottom) const = 0; /** * Checks if this touch point is currently down within a given area. * @param area the area to check - * @return TRUE if the touch point is currently down within the given area + * @return true if the touch point is currently down within the given area */ - virtual BOOL IsTouchingWithinArea(const Rect &area) const = 0; + virtual bool IsTouchingWithinArea(const Rect &area) const = 0; /** * Checks if this touch point is currently down within a given area. * @param centerX X coordinate of the center of a circular area to check * @param centerY Y coordinate of the center of a circular area to check * @param radius the radius of the circular area to check - * @return TRUE if the touch point is currently down within the given area + * @return true if the touch point is currently down within the given area */ - virtual BOOL IsTouchingWithinArea(uint centerX, uint centerY, uint radius) const = 0; + virtual bool IsTouchingWithinArea(uint centerX, uint centerY, uint radius) const = 0; /** * Checks if this touch point is currently down within a given area. * @param area the area to check - * @return TRUE if the touch point is currently down within the given area + * @return true if the touch point is currently down within the given area */ - virtual BOOL IsTouchingWithinArea(const Circle &area) const = 0; + virtual bool IsTouchingWithinArea(const Circle &area) const = 0; }; /** @@ -94,9 +94,9 @@ public: virtual ~Touchscreen() {} /** - * @return TRUE if multitouch support was detected in the touch screen input device + * @return true if multitouch support was detected in the touch screen input device */ - virtual BOOL IsMultitouchAvailable() const = 0; + virtual bool IsMultitouchAvailable() const = 0; /** * @return the maximum number of touch points supported (not necessarily the number currently down) @@ -104,21 +104,21 @@ public: virtual uint GetPointerCount() const = 0; /** - * @return TRUE if at least one touch point is currently down + * @return true if at least one touch point is currently down */ - virtual BOOL IsTouching() const = 0; + virtual bool IsTouching() const = 0; /** * Determines if the touch screen was tapped during the last tick, but not * the tick before that (in other words, was just initially tapped). - * @return TRUE if the touch screen was just tapped in the last tick + * @return true if the touch screen was just tapped in the last tick */ - virtual BOOL WasTapped() = 0; + virtual bool WasTapped() = 0; /** * @return the primary touch pointer (the first one down or the only one * down). This will never be NULL, but it may refer to a touch - * point whose IsTouching returns FALSE. + * point whose IsTouching returns false. */ virtual const TouchPointer* GetPrimaryPointer() const = 0; diff --git a/src/framework/input/touchscreenlistener.h b/src/framework/input/touchscreenlistener.h index ebbcf8f..f609828 100644 --- a/src/framework/input/touchscreenlistener.h +++ b/src/framework/input/touchscreenlistener.h @@ -15,22 +15,22 @@ public: * @param id the unique ID of the touch point * @param x the X coordinate of the touch point * @param y the Y coordinate of the touch point - * @param isPrimary TRUE if the touch screen input device class + * @param isPrimary true if the touch screen input device class * considers this touch point to be the primary one - * @return TRUE if no further listener callbacks of this kind should + * @return true if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnTouchDown(int id, uint x, uint y, BOOL isPrimary) = 0; + virtual bool OnTouchDown(int id, uint x, uint y, bool isPrimary) = 0; /** * Callback for when a touch point is up (released). * @param id the unique ID of the touch point - * @param isPrimary TRUE if the touch screen input device class + * @param isPrimary true if the touch screen input device class * considers this touch point to be the primary one - * @return TRUE if no further listener callbacks of this kind should + * @return true if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnTouchUp(int id, BOOL isPrimary) = 0; + virtual bool OnTouchUp(int id, bool isPrimary) = 0; /** * Callback for when the touch point moves. @@ -39,12 +39,12 @@ public: * @param y the new Y coordinate of the touch point * @param deltaX amount the touch point moved since the last move event along the X axis * @param deltaY amount the touch point moved since the last move event along the Y axis - * @param isPrimary TRUE if the touch screen input device class + * @param isPrimary true if the touch screen input device class * considers this touch point to be the primary one - * @return TRUE if no further listener callbacks of this kind should + * @return true if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, BOOL isPrimary) = 0; + virtual bool OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, bool isPrimary) = 0; }; #endif diff --git a/src/framework/marmaladegamewindow.cpp b/src/framework/marmaladegamewindow.cpp index a639e2f..92d469b 100644 --- a/src/framework/marmaladegamewindow.cpp +++ b/src/framework/marmaladegamewindow.cpp @@ -16,12 +16,12 @@ MarmaladeGameWindow::MarmaladeGameWindow(BaseGameApp *gameApp, MarmaladeSystem * : GameWindow(gameApp) { m_system = system; - m_active = FALSE; - m_focused = FALSE; - m_closing = FALSE; + m_active = false; + m_focused = false; + m_closing = false; m_rect = Rect(0, 0, 0, 0); m_bpp = 0; - m_fullscreen = TRUE; + m_fullscreen = true; m_screenOrientation = SCREEN_ANGLE_0; m_eglContext = EGL_NO_CONTEXT; m_eglDisplay = EGL_NO_DISPLAY; @@ -35,7 +35,7 @@ MarmaladeGameWindow::~MarmaladeGameWindow() LOG_ERROR(LOGCAT_WINDOW, "Failed to destroy the EGL context.\n"); } -BOOL MarmaladeGameWindow::Create(GameWindowParams *params) +bool MarmaladeGameWindow::Create(GameWindowParams *params) { LOG_INFO(LOGCAT_WINDOW, "Creating a window.\n"); @@ -46,18 +46,18 @@ BOOL MarmaladeGameWindow::Create(GameWindowParams *params) // Set up the window and EGL context if (!SetUpWindow()) - return FALSE; + return false; LOG_INFO(LOGCAT_WINDOW, "Finished initialization.\n"); LOG_INFO(LOGCAT_WINDOW, "Window marked active.\n"); - m_active = TRUE; - m_focused = TRUE; + m_active = true; + m_focused = true; - return TRUE; + return true; } -BOOL MarmaladeGameWindow::Resize(uint width, uint height) +bool MarmaladeGameWindow::Resize(uint width, uint height) { // note that the parameters are ignored completely because they don't really // make sense for our primary/only usage of Marmalade (mobile devices) @@ -92,49 +92,49 @@ BOOL MarmaladeGameWindow::Resize(uint width, uint height) LOG_INFO(LOGCAT_WINDOW, "Device's current screen orientation angle: %d\n", angle); m_screenOrientation = angle; - return TRUE; + return true; } -BOOL MarmaladeGameWindow::ToggleFullscreen() +bool MarmaladeGameWindow::ToggleFullscreen() { ASSERT(!"Not implemented."); - return FALSE; + return false; } -BOOL MarmaladeGameWindow::SetUpWindow() +bool MarmaladeGameWindow::SetUpWindow() { if (!SetUpEGL()) { LOG_ERROR(LOGCAT_WINDOW, "EGL setup not completed successfully.\n"); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL MarmaladeGameWindow::DestroyWindow() +bool MarmaladeGameWindow::DestroyWindow() { if (!DestroyEGL()) { LOG_ERROR(LOGCAT_WINDOW, "EGL destroy not completed successfully.\n"); - return FALSE; + return false; } - return TRUE; + return true; } -BOOL MarmaladeGameWindow::SetUpEGL() +bool MarmaladeGameWindow::SetUpEGL() { LOG_INFO(LOGCAT_WINDOW, "Connecting to EGL display server.\n"); EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (display == EGL_NO_DISPLAY) { LOG_ERROR(LOGCAT_WINDOW, "eglGetDisplay() failed.\n"); - return FALSE; + return false; } LOG_INFO(LOGCAT_WINDOW, "Initializing EGL.\n"); - if (eglInitialize(display, 0, 0) == EGL_FALSE) + if (eglInitialize(display, 0, 0) == EGL_false) { EGLint initError = eglGetError(); if (initError == EGL_BAD_DISPLAY) @@ -143,22 +143,22 @@ BOOL MarmaladeGameWindow::SetUpEGL() LOG_ERROR(LOGCAT_WINDOW, "eglInitialize() failed: EGL_NOT_INITIALIZED\n"); else LOG_ERROR(LOGCAT_WINDOW, "eglInitialize() failed.\n"); - return FALSE; + return false; } LOG_INFO(LOGCAT_WINDOW, "Querying available EGL configs.\n"); const EGLint MAX_EGL_CONFIGS = 30; // Too much? Or good enough? EGLint numConfigsFound = 0; EGLConfig configs[MAX_EGL_CONFIGS]; - if (eglGetConfigs(display, configs, MAX_EGL_CONFIGS, &numConfigsFound) == EGL_FALSE) + if (eglGetConfigs(display, configs, MAX_EGL_CONFIGS, &numConfigsFound) == EGL_false) { LOG_ERROR(LOGCAT_WINDOW, "eglGetConfigs() failed.\n"); - return FALSE; + return false; } if (numConfigsFound == 0) { LOG_ERROR(LOGCAT_WINDOW, "eglGetConfigs() found 0 EGL configs. Aborting.\n"); - return FALSE; + return false; } // TODO: these should probably come from a config file or something @@ -258,7 +258,7 @@ BOOL MarmaladeGameWindow::SetUpEGL() if (surface == EGL_NO_SURFACE) { LOG_ERROR(LOGCAT_WINDOW, "eglCreateWindowSurface() failed.\n"); - return FALSE; + return false; } LOG_INFO(LOGCAT_WINDOW, "Creating rendering context.\n"); @@ -267,14 +267,14 @@ BOOL MarmaladeGameWindow::SetUpEGL() if (context == EGL_NO_CONTEXT) { LOG_ERROR(LOGCAT_WINDOW, "eglCreateContext() failed.\n"); - return FALSE; + return false; } LOG_INFO(LOGCAT_WINDOW, "Making this rendering context current.\n"); - if (eglMakeCurrent(display, surface, surface, context) == EGL_FALSE) + if (eglMakeCurrent(display, surface, surface, context) == EGL_false) { LOG_ERROR(LOGCAT_WINDOW, "eglMakeCurrent() failed.\n"); - return FALSE; + return false; } LOG_INFO(LOGCAT_WINDOW, "EGL window set up successfully.\n"); @@ -308,10 +308,10 @@ BOOL MarmaladeGameWindow::SetUpEGL() LOG_INFO(LOGCAT_WINDOW, "Device's current screen orientation angle: %d\n", angle); m_screenOrientation = angle; - return TRUE; + return true; } -BOOL MarmaladeGameWindow::DestroyEGL() +bool MarmaladeGameWindow::DestroyEGL() { if (m_eglDisplay != EGL_NO_DISPLAY) { @@ -319,36 +319,36 @@ BOOL MarmaladeGameWindow::DestroyEGL() // Used to check the return value from this call, but it seems that every code sample, // article, book, or whatever doesn't do that ever. And this seems to always fail in - // the Marmalade simulator (return EGL_FALSE). + // the Marmalade simulator (return EGL_false). eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); if (m_eglContext != EGL_NO_CONTEXT) { - if (eglDestroyContext(m_eglDisplay, m_eglContext) == EGL_FALSE) + if (eglDestroyContext(m_eglDisplay, m_eglContext) == EGL_false) { LOG_ERROR(LOGCAT_WINDOW, "Error destroying EGL context.\n"); - return FALSE; + return false; } } if (m_eglSurface != EGL_NO_SURFACE) { - if (eglDestroySurface(m_eglDisplay, m_eglSurface) == EGL_FALSE) + if (eglDestroySurface(m_eglDisplay, m_eglSurface) == EGL_false) { LOG_ERROR(LOGCAT_WINDOW, "Error destroying EGL surface.\n"); - return FALSE; + return false; } } - if (eglTerminate(m_eglDisplay) == EGL_FALSE) + if (eglTerminate(m_eglDisplay) == EGL_false) { LOG_ERROR(LOGCAT_WINDOW, "Error terminating EGL display.\n"); - return FALSE; + return false; } } m_eglDisplay = EGL_NO_DISPLAY; m_eglContext = EGL_NO_CONTEXT; m_eglSurface = EGL_NO_SURFACE; - return TRUE; + return true; } SCREEN_ORIENTATION_ANGLE MarmaladeGameWindow::GetCurrentScreenOrientationAngle() @@ -381,14 +381,14 @@ void MarmaladeGameWindow::Close() if (m_active) { LOG_INFO(LOGCAT_WINDOW, "Window marked inactive.\n"); - m_active = FALSE; - m_focused = FALSE; + m_active = false; + m_focused = false; } else LOG_INFO(LOGCAT_WINDOW, "Window was already marked inactive.\n"); LOG_INFO(LOGCAT_WINDOW, "Closing.\n"); - m_closing = TRUE; + m_closing = true; } void MarmaladeGameWindow::ProcessEvent(const OSEvent *event) @@ -405,8 +405,8 @@ void MarmaladeGameWindow::ProcessEvent(const OSEvent *event) if (m_active) { LOG_INFO(LOGCAT_WINDOW, "Window marked inactive.\n"); - m_active = FALSE; - m_focused = FALSE; + m_active = false; + m_focused = false; LOG_INFO(LOGCAT_WINDOW, "Lost input device focus.\n"); GetGameApp()->OnAppLostFocus(); LOG_INFO(LOGCAT_WINDOW, "Pausing app.\n"); @@ -421,8 +421,8 @@ void MarmaladeGameWindow::ProcessEvent(const OSEvent *event) if (!m_active) { LOG_INFO(LOGCAT_WINDOW, "Window marked active.\n"); - m_active = TRUE; - m_focused = TRUE; + m_active = true; + m_focused = true; LOG_INFO(LOGCAT_WINDOW, "Resuming app.\n"); GetGameApp()->OnAppResume(); LOG_INFO(LOGCAT_WINDOW, "Gained input device focus.\n"); diff --git a/src/framework/marmaladegamewindow.h b/src/framework/marmaladegamewindow.h index f4cca8d..c29b99b 100644 --- a/src/framework/marmaladegamewindow.h +++ b/src/framework/marmaladegamewindow.h @@ -20,44 +20,44 @@ public: MarmaladeGameWindow(BaseGameApp *gameApp, MarmaladeSystem *system); virtual ~MarmaladeGameWindow(); - BOOL Create(GameWindowParams *params); - BOOL Resize(uint width = IGNORE_DIMENSIONS, uint height = IGNORE_DIMENSIONS); - BOOL ToggleFullscreen(); + bool Create(GameWindowParams *params); + bool Resize(uint width = IGNORE_DIMENSIONS, uint height = IGNORE_DIMENSIONS); + bool ToggleFullscreen(); void Close(); uint GetWidth() const { return m_rect.GetWidth(); } uint GetHeight() const { return m_rect.GetHeight(); } const Rect& GetRect() const { return m_rect; } uint GetBPP() const { return m_bpp; } - BOOL IsWindowed() const { return !m_fullscreen; } + bool IsWindowed() const { return !m_fullscreen; } SCREEN_ORIENTATION_ANGLE GetScreenOrientation() const { return m_screenOrientation; } - BOOL IsActive() const { return m_active; } - BOOL IsFocused() const { return m_focused; } - BOOL IsClosing() const { return m_closing; } - BOOL HasGLContext() const { return eglGetCurrentContext() != EGL_NO_CONTEXT; } + bool IsActive() const { return m_active; } + bool IsFocused() const { return m_focused; } + bool IsClosing() const { return m_closing; } + bool HasGLContext() const { return eglGetCurrentContext() != EGL_NO_CONTEXT; } void ProcessEvent(const OSEvent *event); void Flip() { eglSwapBuffers(m_eglDisplay, m_eglSurface); } private: - BOOL SetUpWindow(); - BOOL DestroyWindow(); + bool SetUpWindow(); + bool DestroyWindow(); - BOOL SetUpEGL(); - BOOL DestroyEGL(); + bool SetUpEGL(); + bool DestroyEGL(); SCREEN_ORIENTATION_ANGLE GetCurrentScreenOrientationAngle(); MarmaladeSystem *m_system; - BOOL m_active; - BOOL m_focused; - BOOL m_closing; + bool m_active; + bool m_focused; + bool m_closing; Rect m_rect; uint m_bpp; - BOOL m_fullscreen; + bool m_fullscreen; SCREEN_ORIENTATION_ANGLE m_screenOrientation; EGLDisplay m_eglDisplay; diff --git a/src/framework/marmaladesystem.cpp b/src/framework/marmaladesystem.cpp index 9dbb4d0..02ec581 100644 --- a/src/framework/marmaladesystem.cpp +++ b/src/framework/marmaladesystem.cpp @@ -37,13 +37,13 @@ int _MarmaladeEvent_PassToSystem(MARMALADE_EVENT event, void *systemData, void * MarmaladeSystem::MarmaladeSystem() { - m_isQuitting = FALSE; + m_isQuitting = false; m_window = NULL; m_filesystem = NULL; m_keyboard = NULL; m_mouse = NULL; m_touchscreen = NULL; - m_hasShaderSupport = FALSE; + m_hasShaderSupport = false; m_supportedShaderVersion = 0.0f; } @@ -65,7 +65,7 @@ MarmaladeSystem::~MarmaladeSystem() SAFE_DELETE(m_touchscreen); } -BOOL MarmaladeSystem::Initialize() +bool MarmaladeSystem::Initialize() { LOG_INFO(LOGCAT_SYSTEM, "MarmaladeSystem initialization starting.\n"); @@ -95,24 +95,24 @@ BOOL MarmaladeSystem::Initialize() LOG_INFO(LOGCAT_SYSTEM, "Device Memory: %dKB free, %dKB total\n", deviceFreeMemKB, deviceTotalMemKB); LOG_INFO(LOGCAT_SYSTEM, "S3E Memory Heap Size: %d bytes\n", heapSize); - BOOL keyboardHasAlpha = FALSE; - BOOL keyboardHasDirection = FALSE; + bool keyboardHasAlpha = false; + bool keyboardHasDirection = false; if (s3eKeyboardGetInt(S3E_KEYBOARD_HAS_ALPHA)) { - keyboardHasAlpha = TRUE; + keyboardHasAlpha = true; LOG_INFO(LOGCAT_SYSTEM, "Keyboard property: S3E_KEYBOARD_HAS_ALPHA\n"); } if (s3eKeyboardGetInt(S3E_KEYBOARD_HAS_NUMPAD)) LOG_INFO(LOGCAT_SYSTEM, "Keyboard property: S3E_KEYBOARD_HAS_NUMPAD\n"); if (s3eKeyboardGetInt(S3E_KEYBOARD_HAS_DIRECTION)) { - keyboardHasDirection = TRUE; + keyboardHasDirection = true; LOG_INFO(LOGCAT_SYSTEM, "Keyboard property: S3E_KEYBOARD_HAS_DIRECTION\n"); } // Android Xperia Play device detection // TODO: any other device ID's we need to worry about? - BOOL isXperiaPlay = FALSE; + bool isXperiaPlay = false; if (s3eDeviceGetInt(S3E_DEVICE_OS) == S3E_OS_ID_ANDROID) { LOG_INFO(LOGCAT_SYSTEM, "Detected Android as host OS.\n"); @@ -123,16 +123,16 @@ BOOL MarmaladeSystem::Initialize() if (strncmp(deviceID, "R800", 4) == 0) { LOG_INFO(LOGCAT_SYSTEM, "Device is an Xperia Play.\n"); - isXperiaPlay = TRUE; + isXperiaPlay = true; } else LOG_INFO(LOGCAT_SYSTEM, "Device is not an Xperia Play.\n"); } } - BOOL keyboardHasPhysicalGameControls = FALSE; + bool keyboardHasPhysicalGameControls = false; if ((keyboardHasAlpha && keyboardHasDirection) || isXperiaPlay) - keyboardHasPhysicalGameControls = TRUE; + keyboardHasPhysicalGameControls = true; if (keyboardHasPhysicalGameControls) LOG_INFO(LOGCAT_SYSTEM, "Keyboard device has enough physical keys for full game controls.\n"); @@ -143,7 +143,7 @@ BOOL MarmaladeSystem::Initialize() ASSERT(m_keyboard != NULL); LOG_INFO(LOGCAT_SYSTEM, "Keyboard input device ready.\n"); - BOOL isMultitouchAvailable = FALSE; + bool isMultitouchAvailable = false; if (s3ePointerGetInt(S3E_POINTER_AVAILABLE)) { s3ePointerType pointerType = (s3ePointerType)s3ePointerGetInt(S3E_POINTER_TYPE); @@ -172,7 +172,7 @@ BOOL MarmaladeSystem::Initialize() if (s3ePointerGetInt(S3E_POINTER_MULTI_TOUCH_AVAILABLE)) { LOG_INFO(LOGCAT_SYSTEM, "Pointer device supports multitouch.\n"); - isMultitouchAvailable = TRUE; + isMultitouchAvailable = true; } else LOG_INFO(LOGCAT_SYSTEM, "Pointer device does not support multitouch.\n"); @@ -218,10 +218,10 @@ BOOL MarmaladeSystem::Initialize() LOG_INFO(LOGCAT_SYSTEM, "Finished initialization.\n"); - return TRUE; + return true; } -BOOL MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) +bool MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) { ASSERT(m_window == NULL); @@ -231,7 +231,7 @@ BOOL MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *p if (!window->Create(params)) { LOG_ERROR(LOGCAT_SYSTEM, "Failed to create a GameWindow.\n"); - return FALSE; + return false; } m_window = window; @@ -260,7 +260,7 @@ BOOL MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *p #ifdef GL_ES_VERSION_2_0 if (glVersionMajor >= 2) { - m_hasShaderSupport = TRUE; + m_hasShaderSupport = true; // TOD: shader version detection? (who cares?) m_supportedShaderVersion = 0.0f; @@ -270,7 +270,7 @@ BOOL MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *p } else { - m_hasShaderSupport = FALSE; + m_hasShaderSupport = false; m_supportedShaderVersion = 0.0f; LOG_INFO(LOGCAT_SYSTEM, "Version of OpenGL supports fixed function pipeline only.\n"); @@ -279,7 +279,7 @@ BOOL MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *p LOG_INFO(LOGCAT_SYSTEM, "GameWindow instance is ready.\n"); - return TRUE; + return true; } void MarmaladeSystem::ProcessEvents() @@ -385,7 +385,7 @@ int MarmaladeSystem::OnEvent(const MarmaladeSystemEvent *eventArgs) void MarmaladeSystem::Quit() { LOG_INFO(LOGCAT_SYSTEM, "Quit requested.\n"); - m_isQuitting = TRUE; + m_isQuitting = true; if (m_window != NULL && !m_window->IsClosing()) { diff --git a/src/framework/marmaladesystem.h b/src/framework/marmaladesystem.h index fedb079..cfc2664 100644 --- a/src/framework/marmaladesystem.h +++ b/src/framework/marmaladesystem.h @@ -27,15 +27,15 @@ public: MarmaladeSystem(); virtual ~MarmaladeSystem(); - BOOL Initialize(); - BOOL CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params); + bool Initialize(); + bool CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params); void ProcessEvents(); int OnEvent(const MarmaladeSystemEvent *eventArgs); void Quit(); - BOOL IsQuitting() const { return m_isQuitting; } + bool IsQuitting() const { return m_isQuitting; } - BOOL HasShaderSupport() const { return m_hasShaderSupport; } + bool HasShaderSupport() const { return m_hasShaderSupport; } float GetSupportedShaderVersion() const { return m_supportedShaderVersion; } GameWindow* GetWindow() const { return (GameWindow*)m_window; } @@ -48,7 +48,7 @@ public: void Delay(uint milliseconds) const; private: - BOOL m_isQuitting; + bool m_isQuitting; MarmaladeGameWindow *m_window; MarmaladeFileSystem *m_filesystem; @@ -56,7 +56,7 @@ private: MarmaladeMouse *m_mouse; MarmaladeTouchscreen *m_touchscreen; - BOOL m_hasShaderSupport; + bool m_hasShaderSupport; float m_supportedShaderVersion; }; diff --git a/src/framework/math/collisionpacket.h b/src/framework/math/collisionpacket.h index ee0aa2c..27ba9eb 100644 --- a/src/framework/math/collisionpacket.h +++ b/src/framework/math/collisionpacket.h @@ -9,7 +9,7 @@ struct CollisionPacket // defines the x/y/z radius of the entity being checked Vector3 ellipsoidRadius; - BOOL foundCollision; + bool foundCollision; float nearestDistance; // the below fields are all in "ellipsoid space" @@ -23,7 +23,7 @@ struct CollisionPacket CollisionPacket() { ellipsoidRadius = ZERO_VECTOR; - foundCollision = FALSE; + foundCollision = false; nearestDistance = 0.0f; esVelocity = ZERO_VECTOR; esNormalizedVelocity = ZERO_VECTOR; diff --git a/src/framework/math/frustum.cpp b/src/framework/math/frustum.cpp index 0d750d6..04dbecf 100644 --- a/src/framework/math/frustum.cpp +++ b/src/framework/math/frustum.cpp @@ -64,80 +64,80 @@ void Frustum::Calculate() m_planes[FRUSTUM_FRONT] = Plane::Normalize(m_planes[FRUSTUM_FRONT]); } -BOOL Frustum::Test(const Vector3 &point) const +bool Frustum::Test(const Vector3 &point) const { for (int p = 0; p < NUM_FRUSTUM_SIDES; ++p) { if (Plane::ClassifyPoint(m_planes[p], point) == BEHIND) - return FALSE; + return false; } - return TRUE; + return true; } -BOOL Frustum::Test(const BoundingBox &box) const +bool Frustum::Test(const BoundingBox &box) const { if (!TestPlaneAgainstBox(m_planes[FRUSTUM_RIGHT], box.min.x, box.min.y, box.min.z, box.GetWidth(), box.GetHeight(), box.GetDepth())) - return FALSE; + return false; if (!TestPlaneAgainstBox(m_planes[FRUSTUM_LEFT], box.min.x, box.min.y, box.min.z, box.GetWidth(), box.GetHeight(), box.GetDepth())) - return FALSE; + return false; if (!TestPlaneAgainstBox(m_planes[FRUSTUM_BOTTOM], box.min.x, box.min.y, box.min.z, box.GetWidth(), box.GetHeight(), box.GetDepth())) - return FALSE; + return false; if (!TestPlaneAgainstBox(m_planes[FRUSTUM_TOP], box.min.x, box.min.y, box.min.z, box.GetWidth(), box.GetHeight(), box.GetDepth())) - return FALSE; + return false; if (!TestPlaneAgainstBox(m_planes[FRUSTUM_BACK], box.min.x, box.min.y, box.min.z, box.GetWidth(), box.GetHeight(), box.GetDepth())) - return FALSE; + return false; if (!TestPlaneAgainstBox(m_planes[FRUSTUM_FRONT], box.min.x, box.min.y, box.min.z, box.GetWidth(), box.GetHeight(), box.GetDepth())) - return FALSE; + return false; - return TRUE; + return true; } -BOOL Frustum::Test(const BoundingSphere &sphere) const +bool Frustum::Test(const BoundingSphere &sphere) const { if (!TestPlaneAgainstSphere(m_planes[FRUSTUM_RIGHT], sphere.center, sphere.radius)) - return FALSE; + return false; if (!TestPlaneAgainstSphere(m_planes[FRUSTUM_LEFT], sphere.center, sphere.radius)) - return FALSE; + return false; if (!TestPlaneAgainstSphere(m_planes[FRUSTUM_BOTTOM], sphere.center, sphere.radius)) - return FALSE; + return false; if (!TestPlaneAgainstSphere(m_planes[FRUSTUM_TOP], sphere.center, sphere.radius)) - return FALSE; + return false; if (!TestPlaneAgainstSphere(m_planes[FRUSTUM_BACK], sphere.center, sphere.radius)) - return FALSE; + return false; if (!TestPlaneAgainstSphere(m_planes[FRUSTUM_FRONT], sphere.center, sphere.radius)) - return FALSE; + return false; - return TRUE; + return true; } -BOOL Frustum::TestPlaneAgainstBox(const Plane &plane, float minX, float minY, float minZ, float width, float height, float depth) const +bool Frustum::TestPlaneAgainstBox(const Plane &plane, float minX, float minY, float minZ, float width, float height, float depth) const { if (Plane::ClassifyPoint(plane, Vector3(minX, minY, minZ)) != BEHIND) - return TRUE; + return true; if (Plane::ClassifyPoint(plane, Vector3(minX, minY, minZ + depth)) != BEHIND) - return TRUE; + return true; if (Plane::ClassifyPoint(plane, Vector3(minX + width, minY, minZ + depth)) != BEHIND) - return TRUE; + return true; if (Plane::ClassifyPoint(plane, Vector3(minX + width, minY, minZ)) != BEHIND) - return TRUE; + return true; if (Plane::ClassifyPoint(plane, Vector3(minX, minY + height, minZ)) != BEHIND) - return TRUE; + return true; if (Plane::ClassifyPoint(plane, Vector3(minX, minY + height, minZ + depth)) != BEHIND) - return TRUE; + return true; if (Plane::ClassifyPoint(plane, Vector3(minX + width, minY + height, minZ + depth)) != BEHIND) - return TRUE; + return true; if (Plane::ClassifyPoint(plane, Vector3(minX + width, minY + height, minZ)) != BEHIND) - return TRUE; + return true; - return FALSE; + return false; } -BOOL Frustum::TestPlaneAgainstSphere(const Plane &plane, const Vector3 ¢er, float radius) const +bool Frustum::TestPlaneAgainstSphere(const Plane &plane, const Vector3 ¢er, float radius) const { float distance = Plane::DistanceBetween(plane, center); if (distance <= -radius) - return FALSE; + return false; else - return TRUE; + return true; } diff --git a/src/framework/math/frustum.h b/src/framework/math/frustum.h index 5c3cd3c..0685b74 100644 --- a/src/framework/math/frustum.h +++ b/src/framework/math/frustum.h @@ -43,29 +43,29 @@ public: /** * Tests a point for visibility. * @param point the point to be tested - * @return BOOL TRUE if visible, FALSE if not + * @return bool true if visible, false if not */ - BOOL Test(const Vector3 &point) const; + bool Test(const Vector3 &point) const; /** * Tests a box for visibility. * @param box the box to be tested - * @return BOOL TRUE if at least partially visible, FALSE if entirely + * @return bool true if at least partially visible, false if entirely * outside the viewing frustum */ - BOOL Test(const BoundingBox &box) const; + bool Test(const BoundingBox &box) const; /** * Tests a sphere for visibility. * @param sphere the sphere to be tested - * @return BOOL TRUE if at least partially visible, FALSE if entirely + * @return bool true if at least partially visible, false if entirely * outside the viewing frustum */ - BOOL Test(const BoundingSphere &sphere) const; + bool Test(const BoundingSphere &sphere) const; private: - BOOL TestPlaneAgainstBox(const Plane &plane, float minX, float minY, float minZ, float width, float height, float depth) const; - BOOL TestPlaneAgainstSphere(const Plane &plane, const Vector3 ¢er, float radius) const; + bool TestPlaneAgainstBox(const Plane &plane, float minX, float minY, float minZ, float width, float height, float depth) const; + bool TestPlaneAgainstSphere(const Plane &plane, const Vector3 ¢er, float radius) const; ViewContext *m_viewContext; Plane m_planes[NUM_FRUSTUM_SIDES]; diff --git a/src/framework/math/intersectiontester.cpp b/src/framework/math/intersectiontester.cpp index 6251464..72bd7ee 100644 --- a/src/framework/math/intersectiontester.cpp +++ b/src/framework/math/intersectiontester.cpp @@ -11,25 +11,25 @@ #include "ray.h" #include "vector3.h" -BOOL IntersectionTester::Test(const BoundingBox &box, const Vector3 &point) +bool IntersectionTester::Test(const BoundingBox &box, const Vector3 &point) { if ((point.x >= box.min.x && point.x <= box.max.x) && (point.y >= box.min.y && point.y <= box.max.y) && (point.z >= box.min.z && point.z <= box.max.z)) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL IntersectionTester::Test(const BoundingSphere &sphere, const Vector3 &point) +bool IntersectionTester::Test(const BoundingSphere &sphere, const Vector3 &point) { if (fabsf(Vector3::Distance(point, sphere.center)) < sphere.radius) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL IntersectionTester::Test(const BoundingBox &box, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection) +bool IntersectionTester::Test(const BoundingBox &box, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection) { for (uint i = 0; i < numVertices; ++i) { @@ -39,14 +39,14 @@ BOOL IntersectionTester::Test(const BoundingBox &box, const Vector3 *vertices, u { if (firstIntersection) *firstIntersection = vertices[i]; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL IntersectionTester::Test(const BoundingSphere &sphere, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection) +bool IntersectionTester::Test(const BoundingSphere &sphere, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection) { for (uint i = 0; i < numVertices; ++i) { @@ -54,47 +54,47 @@ BOOL IntersectionTester::Test(const BoundingSphere &sphere, const Vector3 *verti { if (firstIntersection) *firstIntersection = vertices[i]; - return TRUE; + return true; } } - return FALSE; + return false; } -BOOL IntersectionTester::Test(const BoundingBox &a, const BoundingBox &b) +bool IntersectionTester::Test(const BoundingBox &a, const BoundingBox &b) { if (a.max.x < b.min.x || a.min.x > b.max.x) - return FALSE; + return false; if (a.max.y < b.min.y || a.min.y > b.max.y) - return FALSE; + return false; if (a.max.z < b.min.z || a.min.z > b.max.z) - return FALSE; + return false; - return TRUE; + return true; } -BOOL IntersectionTester::Test(const BoundingSphere &a, const BoundingSphere &b) +bool IntersectionTester::Test(const BoundingSphere &a, const BoundingSphere &b) { Vector3 temp = a.center - b.center; float distanceSquared = Vector3::Dot(temp, temp); float radiusSum = a.radius + b.radius; if (distanceSquared <= radiusSum * radiusSum) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL IntersectionTester::Test(const BoundingSphere &sphere, const Plane &plane) +bool IntersectionTester::Test(const BoundingSphere &sphere, const Plane &plane) { float distance = Vector3::Dot(sphere.center, plane.normal) - plane.d; if (fabsf(distance) <= sphere.radius) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL IntersectionTester::Test(const BoundingBox &box, const Plane &plane) +bool IntersectionTester::Test(const BoundingBox &box, const Plane &plane) { Vector3 temp1 = (box.max + box.min) / 2.0f; Vector3 temp2 = box.max - temp1; @@ -104,20 +104,20 @@ BOOL IntersectionTester::Test(const BoundingBox &box, const Plane &plane) float distance = Vector3::Dot(plane.normal, temp1) - plane.d; if (fabsf(distance) <= radius) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL IntersectionTester::Test(const Ray &ray, const Plane &plane, Vector3 *intersection) +bool IntersectionTester::Test(const Ray &ray, const Plane &plane, Vector3 *intersection) { float denominator = Vector3::Dot(ray.direction, plane.normal); if (denominator == 0.0f) - return FALSE; + return false; float t = ((-plane.d - Vector3::Dot(ray.position, plane.normal)) / denominator); if (t < 0.0f) - return FALSE; + return false; if (intersection) { @@ -127,10 +127,10 @@ BOOL IntersectionTester::Test(const Ray &ray, const Plane &plane, Vector3 *inter intersection->z = temp1.z; } - return TRUE; + return true; } -BOOL IntersectionTester::Test(const Ray &ray, const BoundingSphere &sphere, Vector3 *intersection) +bool IntersectionTester::Test(const Ray &ray, const BoundingSphere &sphere, Vector3 *intersection) { Vector3 temp1 = ray.position - sphere.center; @@ -138,11 +138,11 @@ BOOL IntersectionTester::Test(const Ray &ray, const BoundingSphere &sphere, Vect float c = Vector3::Dot(temp1, temp1) - (sphere.radius * sphere.radius); if (c > 0.0f && b > 0.0f) - return FALSE; + return false; float discriminant = b * b - c; if (discriminant < 0.0f) - return FALSE; + return false; float t = -b - sqrtf(discriminant); if (t < 0.0f) @@ -156,10 +156,10 @@ BOOL IntersectionTester::Test(const Ray &ray, const BoundingSphere &sphere, Vect intersection->z = temp2.z; } - return TRUE; + return true; } -BOOL IntersectionTester::Test(const Ray &ray, const BoundingBox &box, Vector3 *intersection) +bool IntersectionTester::Test(const Ray &ray, const BoundingBox &box, Vector3 *intersection) { float tmin = 0.0f; float tmax = FLT_MAX; @@ -167,7 +167,7 @@ BOOL IntersectionTester::Test(const Ray &ray, const BoundingBox &box, Vector3 *i if (fabsf(ray.direction.x) < EPSILON) { if (ray.position.x < box.min.x || ray.position.x > box.max.x) - return FALSE; + return false; } else { @@ -186,13 +186,13 @@ BOOL IntersectionTester::Test(const Ray &ray, const BoundingBox &box, Vector3 *i tmax = Min(tmax, t2); if (tmin > tmax) - return FALSE; + return false; } if (fabsf(ray.direction.y) < EPSILON) { if (ray.position.y < box.min.y || ray.position.y > box.max.y) - return FALSE; + return false; } else { @@ -211,13 +211,13 @@ BOOL IntersectionTester::Test(const Ray &ray, const BoundingBox &box, Vector3 *i tmax = Min(tmax, t2); if (tmin > tmax) - return FALSE; + return false; } if (fabsf(ray.direction.z) < EPSILON) { if (ray.position.z < box.min.z || ray.position.z > box.max.z) - return FALSE; + return false; } else { @@ -236,7 +236,7 @@ BOOL IntersectionTester::Test(const Ray &ray, const BoundingBox &box, Vector3 *i tmax = Min(tmax, t2); if (tmin > tmax) - return FALSE; + return false; } if (intersection) @@ -247,26 +247,26 @@ BOOL IntersectionTester::Test(const Ray &ray, const BoundingBox &box, Vector3 *i intersection->z = temp1.z; } - return TRUE; + return true; } -BOOL IntersectionTester::Test(const BoundingBox &box, const BoundingSphere &sphere) +bool IntersectionTester::Test(const BoundingBox &box, const BoundingSphere &sphere) { float distanceSq = BoundingBox::GetSquaredDistanceFromPointToBox(sphere.center, box); if (distanceSq <= (sphere.radius * sphere.radius)) - return TRUE; + return true; else - return FALSE; + return false; } -BOOL IntersectionTester::Test(const Ray &ray, const Vector3 &a, const Vector3 &b, const Vector3 &c, Vector3 *intersection) +bool IntersectionTester::Test(const Ray &ray, const Vector3 &a, const Vector3 &b, const Vector3 &c, Vector3 *intersection) { float r, num1, num2; Vector3 temp1 = Vector3::Cross(b - a, c - a); if (temp1.x == 0.0f && temp1.y == 0.0f && temp1.z == 0.0f) - return FALSE; + return false; Vector3 temp2 = ray.position - a; num1 = -Vector3::Dot(temp1, temp2); @@ -277,30 +277,30 @@ BOOL IntersectionTester::Test(const Ray &ray, const Vector3 &a, const Vector3 &b { if (intersection) *intersection = ray.position; - return TRUE; + return true; } else - return FALSE; + return false; } r = num1 / num2; if (r < 0.0f) - return FALSE; + return false; Vector3 temp3 = ray.GetPositionAt(r); if (Vector3::IsPointInTriangle(temp3, a, b, c)) { if (intersection) *intersection = temp3; - return TRUE; + return true; } else - return FALSE; + return false; } -BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3) +bool IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3) { - BOOL foundCollision = FALSE; + bool foundCollision = false; Vector3 p1 = v1 / packet.ellipsoidRadius; Vector3 p2 = v2 / packet.ellipsoidRadius; @@ -313,7 +313,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const { float t0; float t1; - BOOL embeddedInPlane = FALSE; + bool embeddedInPlane = false; float distToTrianglePlane = Plane::DistanceBetween(trianglePlane, packet.esPosition); float normalDotVelocity = Vector3::Dot(trianglePlane.normal, packet.esVelocity); @@ -323,12 +323,12 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const if (fabsf(distToTrianglePlane) >= 1.0f) { // Sphere is not embedded in the plane, no collision possible - return FALSE; + return false; } else { // Sphere is embedded in the plane, it intersects throughout the whole time period - embeddedInPlane = TRUE; + embeddedInPlane = true; t0 = 0.0f; t1 = 1.0f; } @@ -351,7 +351,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const if (t0 > 1.0f || t1 < 0.0f) { // Both values outside the range [0,1], no collision possible - return FALSE; + return false; } t0 = Clamp(t0, 0.0f, 1.0f); @@ -372,7 +372,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const if (Vector3::IsPointInTriangle(planeIntersectionPoint, p1, p2, p3)) { - foundCollision = TRUE; + foundCollision = true; t = t0; collisionPoint = planeIntersectionPoint; } @@ -380,7 +380,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const // If we haven't found a collision at this point, we need to check the // points and edges of the triangle - if (foundCollision == FALSE) + if (foundCollision == false) { Vector3 velocity = packet.esVelocity; Vector3 base = packet.esPosition; @@ -399,7 +399,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const if (GetLowestQuadraticRoot(a, b, c, t, newT)) { t = newT; - foundCollision = TRUE; + foundCollision = true; collisionPoint = p1; } @@ -409,7 +409,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const if (GetLowestQuadraticRoot(a, b, c, t, newT)) { t = newT; - foundCollision = TRUE; + foundCollision = true; collisionPoint = p2; } @@ -419,7 +419,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const if (GetLowestQuadraticRoot(a, b, c, t, newT)) { t = newT; - foundCollision = TRUE; + foundCollision = true; collisionPoint = p3; } @@ -444,7 +444,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const { // Intersection took place within the segment t = newT; - foundCollision = TRUE; + foundCollision = true; collisionPoint = p1 + edge * f; } } @@ -468,7 +468,7 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const { // Intersection took place within the segment t = newT; - foundCollision = TRUE; + foundCollision = true; collisionPoint = p2 + edge * f; } } @@ -492,23 +492,23 @@ BOOL IntersectionTester::Test(CollisionPacket &packet, const Vector3 &v1, const { // Intersection took place within the segment t = newT; - foundCollision = TRUE; + foundCollision = true; collisionPoint = p3 + edge * f; } } } // Set result of test - if (foundCollision == TRUE) + if (foundCollision == true) { float distanceToCollision = t * Vector3::Length(packet.esVelocity); // Does this triangle qualify for the closest collision? - if (packet.foundCollision == FALSE || distanceToCollision < packet.nearestDistance) + if (packet.foundCollision == false || distanceToCollision < packet.nearestDistance) { packet.nearestDistance = distanceToCollision; packet.esIntersectionPoint = collisionPoint; - packet.foundCollision = TRUE; + packet.foundCollision = true; } } } diff --git a/src/framework/math/intersectiontester.h b/src/framework/math/intersectiontester.h index 0e0e43a..e5f2c76 100644 --- a/src/framework/math/intersectiontester.h +++ b/src/framework/math/intersectiontester.h @@ -21,17 +21,17 @@ public: * Tests for a collision between a box and a point. * @param box the box to test * @param point the point to test - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingBox &box, const Vector3 &point); + static bool Test(const BoundingBox &box, const Vector3 &point); /** * Tests for a collision between a sphere and a point. * @param sphere the sphere to test * @param point the point to test - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingSphere &sphere, const Vector3 &point); + static bool Test(const BoundingSphere &sphere, const Vector3 &point); /** * Tests for a collision between a box and a set of points. @@ -40,9 +40,9 @@ public: * @param numVertices the number of points in the array * @param firstIntersection if not NULL, will contain the first intersection * point if an intersection is found at all - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingBox &box, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection); + static bool Test(const BoundingBox &box, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection); /** * Tests for a collision between a sphere and a set of points. @@ -51,41 +51,41 @@ public: * @param numVertices the number of points in the array * @param firstIntersection if not NULL, will contain the first intersection * point if an intersection is found at all - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingSphere &sphere, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection); + static bool Test(const BoundingSphere &sphere, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection); /** * Tests for a collision between two boxes. * @param a the first box to test * @param b the second box to test - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingBox &a, const BoundingBox &b); + static bool Test(const BoundingBox &a, const BoundingBox &b); /** * Tests for a collision between two spheres. * @param a the first sphere to test * @param b the second sphere to test - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingSphere &a, const BoundingSphere &b); + static bool Test(const BoundingSphere &a, const BoundingSphere &b); /** * Tests for a collision between a sphere and a plane. * @param sphere the sphere to test * @param plane the plane to test - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingSphere &sphere, const Plane &plane); + static bool Test(const BoundingSphere &sphere, const Plane &plane); /** * Tests for a collision between a box and a plane. * @param box the box to test * @param plane the plane to test - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingBox &box, const Plane &plane); + static bool Test(const BoundingBox &box, const Plane &plane); /** * Tests for a collision between a ray and a plane. @@ -93,9 +93,9 @@ public: * @param plane the plane to test * @param intersection if not NULL, will contain the point of intersection * if found at all - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const Ray &ray, const Plane &plane, Vector3 *intersection); + static bool Test(const Ray &ray, const Plane &plane, Vector3 *intersection); /** * Tests for a collision between a ray and a sphere. @@ -103,9 +103,9 @@ public: * @param sphere the sphere to test * @param intersection if not NULL, will contain the first point of intersection * if found at all - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const Ray &ray, const BoundingSphere &sphere, Vector3 *intersection); + static bool Test(const Ray &ray, const BoundingSphere &sphere, Vector3 *intersection); /** * Tests for a collision between a ray and a box. @@ -113,17 +113,17 @@ public: * @param box the box to test * @param intersection if not NULL, will contain the point of intersection * if found at all - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const Ray &ray, const BoundingBox &box, Vector3 *intersection); + static bool Test(const Ray &ray, const BoundingBox &box, Vector3 *intersection); /** * Tests for a collision between a box and a sphere. * @param box the box to test * @param sphere the sphere to test - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const BoundingBox &box, const BoundingSphere &sphere); + static bool Test(const BoundingBox &box, const BoundingSphere &sphere); /** * Tests for a collision between a ray and a triangle. @@ -133,9 +133,9 @@ public: * @param c third point of the triangle to test * @param intersection if not NULL, will contain the point of interestion * if found at all - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(const Ray &ray, const Vector3 &a, const Vector3 &b, const Vector3 &c, Vector3 *intersection); + static bool Test(const Ray &ray, const Vector3 &a, const Vector3 &b, const Vector3 &c, Vector3 *intersection); /** * Tests for collision between a "swept sphere" and a triangle. @@ -143,9 +143,9 @@ public: * @param v1 first point of the triangle to test * @param v2 second point of the triangle to test * @param v3 third point of the triangle to test - * @return BOOL TRUE if a collision is found, FALSE if not + * @return bool true if a collision is found, false if not */ - static BOOL Test(CollisionPacket &packet, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3); + static bool Test(CollisionPacket &packet, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3); }; #endif diff --git a/src/framework/math/mathhelpers.cpp b/src/framework/math/mathhelpers.cpp index 5418730..8b52274 100644 --- a/src/framework/math/mathhelpers.cpp +++ b/src/framework/math/mathhelpers.cpp @@ -49,13 +49,13 @@ float GetAngleBetweenPoints(float x1, float y1, float x2, float y2) return angle - RADIANS_90; } -BOOL GetLowestQuadraticRoot(float a, float b, float c, float maxR, float &root) +bool GetLowestQuadraticRoot(float a, float b, float c, float maxR, float &root) { float determinant = (b * b) - (4.0f * a * c); // If the determinant is negative, there is no solution (can't square root a negative) if (determinant < 0.0f) - return FALSE; + return false; float sqrtDeterminant = sqrtf(determinant); float root1 = (-b - sqrtDeterminant) / (2 * a); @@ -72,17 +72,17 @@ BOOL GetLowestQuadraticRoot(float a, float b, float c, float maxR, float &root) if (root1 > 0 && root1 < maxR) { root = root1; - return TRUE; + return true; } if (root2 > 0 && root2 < maxR) { root = root2; - return TRUE; + return true; } // No valid solutions found - return FALSE; + return false; } void GetPointOnCircle(float radius, float angle, float &x, float &y) diff --git a/src/framework/math/mathhelpers.h b/src/framework/math/mathhelpers.h index d51196b..765f55a 100644 --- a/src/framework/math/mathhelpers.h +++ b/src/framework/math/mathhelpers.h @@ -75,9 +75,9 @@ float GetAngleBetweenPoints(float x1, float y1, float x2, float y2); * @param maxR the maximum root value we will accept as an answer. anything that is higher will not be accepted as a solution * @param root the variable to hold the lowest root value if one is found - * @return BOOL TRUE if the quadratic could be solved, FALSE if not + * @return bool true if the quadratic could be solved, false if not */ -BOOL GetLowestQuadraticRoot(float a, float b, float c, float maxR, float &root); +bool GetLowestQuadraticRoot(float a, float b, float c, float maxR, float &root); /** * Gets the power of two value that comes after the given value. @@ -129,9 +129,9 @@ inline float DegreesToRadians(float degrees) * @param a first value to check * @param b second value to check * @param tolerance tolerance value to use (e.g. FLT_EPSILON) - * @return BOOL TRUE if equal, FALSE if not + * @return bool true if equal, false if not */ -inline BOOL IsCloseEnough(float a, float b, float tolerance = TOLERANCE) +inline bool IsCloseEnough(float a, float b, float tolerance = TOLERANCE) { return fabsf((a - b) / ((b == 0.0f) ? 1.0f : b)) < tolerance; } @@ -139,9 +139,9 @@ inline BOOL IsCloseEnough(float a, float b, float tolerance = TOLERANCE) /** * Determines if a given number is a power of two. * @param n number to check - * @return BOOL TRUE if a power of two, FALSE if not + * @return bool true if a power of two, false if not */ -inline BOOL IsPowerOf2(int n) +inline bool IsPowerOf2(int n) { return (n != 0) && !(n & (n - 1)); } diff --git a/src/framework/math/plane.h b/src/framework/math/plane.h index 6375018..2336b40 100644 --- a/src/framework/math/plane.h +++ b/src/framework/math/plane.h @@ -80,7 +80,7 @@ struct Plane * @return true if the direction is pointing towards the front side of the * plane */ - static BOOL IsFrontFacingTo(const Plane &plane, const Vector3 &direction); + static bool IsFrontFacingTo(const Plane &plane, const Vector3 &direction); /** * Normalize a plane. @@ -150,7 +150,7 @@ inline float Plane::DistanceBetween(const Plane &plane, const Vector3 &point) return Vector3::Dot(point, plane.normal) + plane.d; } -inline BOOL Plane::IsFrontFacingTo(const Plane &plane, const Vector3 &direction) +inline bool Plane::IsFrontFacingTo(const Plane &plane, const Vector3 &direction) { if (Vector3::Dot(plane.normal, direction) <= 0.0f) return true; diff --git a/src/framework/math/rect.h b/src/framework/math/rect.h index 53391d1..7232719 100644 --- a/src/framework/math/rect.h +++ b/src/framework/math/rect.h @@ -35,9 +35,9 @@ struct Rect * Tests if a point is contained inside this rectangle. * @param x x coordinate of the point to test * @param y y coordinate of the point to test - * @return TRUE if the point is contained, FALSE if not + * @return true if the point is contained, false if not */ - BOOL Contains(int x, int y) const; + bool Contains(int x, int y) const; /** * @return the rect's width @@ -75,12 +75,12 @@ inline void Rect::Set(int left, int top, int right, int bottom) this->bottom = bottom; } -inline BOOL Rect::Contains(int x, int y) const +inline bool Rect::Contains(int x, int y) const { if (x >= left && y >= top && x <= right && y <= bottom) - return TRUE; + return true; else - return FALSE; + return false; } inline int Rect::GetWidth() const diff --git a/src/framework/math/rectf.h b/src/framework/math/rectf.h index e860600..03c3440 100644 --- a/src/framework/math/rectf.h +++ b/src/framework/math/rectf.h @@ -33,9 +33,9 @@ struct RectF * Tests if a point is contained inside this rectangle. * @param x x coordinate of the point to test * @param y y coordinate of the point to test - * @return BOOL TRUE if the point is contained, FALSE if not + * @return bool true if the point is contained, false if not */ - BOOL Contains(float x, float y) const; + bool Contains(float x, float y) const; /** * @return the rect's width @@ -73,12 +73,12 @@ inline void RectF::Set(float left, float top, float right, float bottom) this->bottom = bottom; } -inline BOOL RectF::Contains(float x, float y) const +inline bool RectF::Contains(float x, float y) const { if (x >= left && y >= top && x <= right && y <= bottom) - return TRUE; + return true; else - return FALSE; + return false; } inline float RectF::GetWidth() const diff --git a/src/framework/math/vector3.h b/src/framework/math/vector3.h index 174a26e..a25e43d 100644 --- a/src/framework/math/vector3.h +++ b/src/framework/math/vector3.h @@ -87,9 +87,9 @@ struct Vector3 * @param a first vector of the triangle * @param b second vector of the triangle * @param c third vector of the triangle - * @return TRUE if the point lies inside the triangle + * @return true if the point lies inside the triangle */ - static BOOL IsPointInTriangle(const Vector3 &point, const Vector3 &a, const Vector3 &b, const Vector3 &c); + static bool IsPointInTriangle(const Vector3 &point, const Vector3 &a, const Vector3 &b, const Vector3 &c); /** * Returns the length (magnitude) of a vector. @@ -239,7 +239,7 @@ inline float Vector3::Dot(const Vector3 &a, const Vector3 &b) (a.z * b.z); } -inline BOOL Vector3::IsPointInTriangle(const Vector3 &point, const Vector3 &a, const Vector3 &b, const Vector3 &c) +inline bool Vector3::IsPointInTriangle(const Vector3 &point, const Vector3 &a, const Vector3 &b, const Vector3 &c) { Vector3 v0 = c - a; Vector3 v1 = b - a; @@ -253,15 +253,15 @@ inline BOOL Vector3::IsPointInTriangle(const Vector3 &point, const Vector3 &a, c float denom = dot00 * dot11 - dot01 * dot01; if (denom == 0) - return FALSE; + return false; float u = (dot11 * dot02 - dot01 * dot12) / denom; float v = (dot00 * dot12 - dot01 * dot02) / denom; if (u >= 0 && v >= 0 && u + v <= 1) - return TRUE; + return true; else - return FALSE; + return false; } inline float Vector3::Length(const Vector3 &v) diff --git a/src/framework/operatingsystem.h b/src/framework/operatingsystem.h index 8bd7747..9f7573a 100644 --- a/src/framework/operatingsystem.h +++ b/src/framework/operatingsystem.h @@ -26,17 +26,17 @@ public: * Initializes internal platform specific objects that wrap access * to various operating system features so the game application class * can make use of them. - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - virtual BOOL Initialize() = 0; + virtual bool Initialize() = 0; /** * Creates a game window object for the given game application object. * @param gameApp the game application object to create the window for * @param params platform-specific window creation parameters - * @return TRUE if successful, FALSE if not + * @return true if successful, false if not */ - virtual BOOL CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) = 0; + virtual bool CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) = 0; /** * Checks for and handles any events raised by the operating system. @@ -50,14 +50,14 @@ public: virtual void Quit() = 0; /** - * @return TRUE if the system has been signaled to quit + * @return true if the system has been signaled to quit */ - virtual BOOL IsQuitting() const = 0; + virtual bool IsQuitting() const = 0; /** - * @return TRUE if hardware support for OpenGL shaders was detected + * @return true if hardware support for OpenGL shaders was detected */ - virtual BOOL HasShaderSupport() const = 0; + virtual bool HasShaderSupport() const = 0; /** * @return the version of shader support that the OpenGL hardware has diff --git a/src/framework/sdlgamewindow.cpp b/src/framework/sdlgamewindow.cpp index 5a0c5ab..44079db 100644 --- a/src/framework/sdlgamewindow.cpp +++ b/src/framework/sdlgamewindow.cpp @@ -13,10 +13,10 @@ SDLGameWindow::SDLGameWindow(BaseGameApp *gameApp) : GameWindow(gameApp) { - m_active = FALSE; - m_focused = FALSE; - m_closing = FALSE; - m_hasCurrentGLContext = FALSE; + m_active = false; + m_focused = false; + m_closing = false; + m_hasCurrentGLContext = false; m_screenOrientation = SCREEN_ANGLE_0; m_SDLflags = 0; m_originalWidth = 0; @@ -28,7 +28,7 @@ SDLGameWindow::SDLGameWindow(BaseGameApp *gameApp) m_rect.right = 0; m_rect.bottom = 0; m_bpp = 0; - m_fullscreen = FALSE; + m_fullscreen = false; m_screen = NULL; } @@ -37,7 +37,7 @@ SDLGameWindow::~SDLGameWindow() LOG_INFO(LOGCAT_WINDOW, "Releasing.\n"); } -BOOL SDLGameWindow::Create(GameWindowParams *params) +bool SDLGameWindow::Create(GameWindowParams *params) { LOG_INFO(LOGCAT_WINDOW, "Creating a window.\n"); @@ -69,7 +69,7 @@ BOOL SDLGameWindow::Create(GameWindowParams *params) // Set the video mode if (!SetUpWindow(sdlParams->width, sdlParams->height)) - return FALSE; + return false; SDL_WM_SetCaption(sdlParams->title.c_str(), sdlParams->title.c_str()); LOG_INFO(LOGCAT_WINDOW, "Application window caption set: \"%s\"\n", sdlParams->title.c_str()); @@ -77,43 +77,43 @@ BOOL SDLGameWindow::Create(GameWindowParams *params) LOG_INFO(LOGCAT_WINDOW, "Finished initialization.\n"); LOG_INFO(LOGCAT_WINDOW, "Window marked active.\n"); - m_active = TRUE; - m_focused = TRUE; + m_active = true; + m_focused = true; - return TRUE; + return true; } -BOOL SDLGameWindow::Resize(uint width, uint height) +bool SDLGameWindow::Resize(uint width, uint height) { - BOOL result = SetUpWindow(width, height); + bool result = SetUpWindow(width, height); GetGameApp()->OnNewContext(); GetGameApp()->OnResize(); return result; } -BOOL SDLGameWindow::ToggleFullscreen() +bool SDLGameWindow::ToggleFullscreen() { - BOOL screenToggleResult; + bool screenToggleResult; if (m_fullscreen) LOG_INFO(LOGCAT_WINDOW, "Beginning switch to windowed mode...\n"); else LOG_INFO(LOGCAT_WINDOW, "Beginning switch to fullscreen mode...\n"); GetGameApp()->OnLostContext(); - m_hasCurrentGLContext = FALSE; + m_hasCurrentGLContext = false; m_SDLflags ^= SDL_FULLSCREEN; if (m_SDLflags & SDL_FULLSCREEN) - m_fullscreen = TRUE; + m_fullscreen = true; else - m_fullscreen = FALSE; + m_fullscreen = false; screenToggleResult = Resize(m_width, m_height); if (!screenToggleResult) { LOG_ERROR(LOGCAT_WINDOW, "Failed to toggle fullscreen/windowed mode (%dx%dx%d, fullscreen = %d).\n", m_width, m_height, m_bpp, m_fullscreen); - ASSERT(screenToggleResult == TRUE); - return FALSE; + ASSERT(screenToggleResult == true); + return false; } if (m_fullscreen) @@ -121,7 +121,7 @@ BOOL SDLGameWindow::ToggleFullscreen() else LOG_INFO(LOGCAT_WINDOW, "Finished switch to windowed mode.\n"); - return TRUE; + return true; } void SDLGameWindow::DisplaySdlHardwareInfo() @@ -182,7 +182,7 @@ void SDLGameWindow::DisplaySdlHardwareInfo() } } -BOOL SDLGameWindow::SetUpWindow(uint width, uint height) +bool SDLGameWindow::SetUpWindow(uint width, uint height) { int ret; const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); @@ -197,7 +197,7 @@ BOOL SDLGameWindow::SetUpWindow(uint width, uint height) if (!ret) { LOG_WARN(LOGCAT_WINDOW, "Video mode %dx%d @ %d bpp not supported.\n", width, height, m_bpp); - return FALSE; + return false; } width = m_originalWidth; @@ -217,7 +217,7 @@ BOOL SDLGameWindow::SetUpWindow(uint width, uint height) if ((m_screen = SDL_SetVideoMode(width, height, m_bpp, m_SDLflags)) == NULL) { LOG_ERROR(LOGCAT_WINDOW, "Could not set video mode %dx%dx%d (flags = %ld): %s\n", width, height, m_bpp, m_SDLflags, SDL_GetError()); - return FALSE; + return false; } LOG_INFO(LOGCAT_WINDOW, "Video mode %dx%d @ %d bpp set.\n", width, height, m_bpp); @@ -252,9 +252,9 @@ BOOL SDLGameWindow::SetUpWindow(uint width, uint height) m_rect.bottom = m_rect.top + height; } - m_hasCurrentGLContext = TRUE; + m_hasCurrentGLContext = true; - return TRUE; + return true; } void SDLGameWindow::ProcessEvent(const OSEvent *event) @@ -263,7 +263,7 @@ void SDLGameWindow::ProcessEvent(const OSEvent *event) return; const SDLSystemEvent *evt = (SDLSystemEvent*)event; - BOOL resizeResult; + bool resizeResult; switch (evt->event->type) { @@ -276,7 +276,7 @@ void SDLGameWindow::ProcessEvent(const OSEvent *event) { LOG_INFO(LOGCAT_WINDOW, "Window focus gained.\n"); LOG_INFO(LOGCAT_WINDOW, "Window marked active.\n"); - m_active = TRUE; + m_active = true; // ensure we render again now that rendering has been resumed // (the window might have been minimized or covered up) @@ -286,7 +286,7 @@ void SDLGameWindow::ProcessEvent(const OSEvent *event) { LOG_INFO(LOGCAT_WINDOW, "Window focus lost.\n"); LOG_INFO(LOGCAT_WINDOW, "Window marked inactive.\n"); - m_active = FALSE; + m_active = false; } } if (evt->event->active.state & SDL_APPMOUSEFOCUS) @@ -301,13 +301,13 @@ void SDLGameWindow::ProcessEvent(const OSEvent *event) if (evt->event->active.gain) { LOG_INFO(LOGCAT_WINDOW, "Gained input device focus.\n"); - m_focused = TRUE; + m_focused = true; GetGameApp()->OnAppGainFocus(); } else { LOG_INFO(LOGCAT_WINDOW, "Lost input device focus.\n"); - m_focused = FALSE; + m_focused = false; GetGameApp()->OnAppLostFocus(); } } @@ -319,14 +319,14 @@ void SDLGameWindow::ProcessEvent(const OSEvent *event) // re-initializing OpenGL LOG_INFO(LOGCAT_WINDOW, "Window resized to %dx%d.\n", evt->event->resize.w, evt->event->resize.h); GetGameApp()->OnLostContext(); - m_hasCurrentGLContext = FALSE; + m_hasCurrentGLContext = false; resizeResult = SetUpWindow(evt->event->resize.w, evt->event->resize.h); GetGameApp()->OnNewContext(); GetGameApp()->OnResize(); if (!resizeResult) { LOG_ERROR(LOGCAT_WINDOW, "Window resize to %dx%d failed!\n", evt->event->resize.w, evt->event->resize.h); - ASSERT(resizeResult == TRUE); + ASSERT(resizeResult == true); Close(); return; } @@ -339,14 +339,14 @@ void SDLGameWindow::Close() if (m_active) { LOG_INFO(LOGCAT_WINDOW, "Window marked inactive.\n"); - m_active = FALSE; - m_focused = FALSE; + m_active = false; + m_focused = false; } else LOG_INFO(LOGCAT_WINDOW, "Window was already marked inactive.\n"); LOG_INFO(LOGCAT_WINDOW, "Closing.\n"); - m_closing = TRUE; + m_closing = true; } #endif diff --git a/src/framework/sdlgamewindow.h b/src/framework/sdlgamewindow.h index 2d89218..0714d02 100644 --- a/src/framework/sdlgamewindow.h +++ b/src/framework/sdlgamewindow.h @@ -18,7 +18,7 @@ struct SDLGameWindowParams : GameWindowParams uint width; uint height; uint bpp; - BOOL resizable; + bool resizable; }; class SDLGameWindow : public GameWindow @@ -27,34 +27,34 @@ public: SDLGameWindow(BaseGameApp *gameApp); virtual ~SDLGameWindow(); - BOOL Create(GameWindowParams *params); - BOOL Resize(uint width, uint height); - BOOL ToggleFullscreen(); + bool Create(GameWindowParams *params); + bool Resize(uint width, uint height); + bool ToggleFullscreen(); void Close(); uint GetWidth() const { return m_width; } uint GetHeight() const { return m_height; } const Rect& GetRect() const { return m_rect; } uint GetBPP() const { return m_bpp; } - BOOL IsWindowed() const { return m_fullscreen; } + bool IsWindowed() const { return m_fullscreen; } SCREEN_ORIENTATION_ANGLE GetScreenOrientation() const { return m_screenOrientation; } - BOOL IsActive() const { return m_active; } - BOOL IsFocused() const { return m_focused; } - BOOL IsClosing() const { return m_closing; } - BOOL HasGLContext() const { return m_hasCurrentGLContext; } + bool IsActive() const { return m_active; } + bool IsFocused() const { return m_focused; } + bool IsClosing() const { return m_closing; } + bool HasGLContext() const { return m_hasCurrentGLContext; } void ProcessEvent(const OSEvent *event); void Flip() { SDL_GL_SwapBuffers(); } private: void DisplaySdlHardwareInfo(); - BOOL SetUpWindow(uint width, uint height); + bool SetUpWindow(uint width, uint height); - BOOL m_active; - BOOL m_focused; - BOOL m_closing; - BOOL m_hasCurrentGLContext; + bool m_active; + bool m_focused; + bool m_closing; + bool m_hasCurrentGLContext; SCREEN_ORIENTATION_ANGLE m_screenOrientation; uint m_SDLflags; @@ -64,7 +64,7 @@ private: uint m_height; Rect m_rect; uint m_bpp; - BOOL m_fullscreen; + bool m_fullscreen; SDL_Surface *m_screen; }; diff --git a/src/framework/sdlsystem.cpp b/src/framework/sdlsystem.cpp index c83f578..58af95b 100644 --- a/src/framework/sdlsystem.cpp +++ b/src/framework/sdlsystem.cpp @@ -20,8 +20,8 @@ SDLSystem::SDLSystem() { - m_isQuitting = FALSE; - m_hasShaderSupport = FALSE; + m_isQuitting = false; + m_hasShaderSupport = false; m_window = NULL; m_filesystem = NULL; m_mouse = NULL; @@ -48,7 +48,7 @@ SDLSystem::~SDLSystem() SDL_Quit(); } -BOOL SDLSystem::Initialize() +bool SDLSystem::Initialize() { LOG_INFO(LOGCAT_SYSTEM, "SDLSystem initialization starting.\n"); @@ -58,7 +58,7 @@ BOOL SDLSystem::Initialize() if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_TIMER) == -1) { LOG_ERROR(LOGCAT_SYSTEM, "SDL_Init() failed: %s\n", SDL_GetError()); - return FALSE; + return false; } LOG_INFO(LOGCAT_SYSTEM, "SDL_Init() passed.\n"); @@ -66,7 +66,7 @@ BOOL SDLSystem::Initialize() ASSERT(m_mouse != NULL); LOG_INFO(LOGCAT_SYSTEM, "Mouse input device available.\n"); - m_keyboard = new SDLKeyboard(this, TRUE); + m_keyboard = new SDLKeyboard(this, true); ASSERT(m_keyboard != NULL); LOG_INFO(LOGCAT_SYSTEM, "Keyboard input device available.\n"); @@ -99,10 +99,10 @@ BOOL SDLSystem::Initialize() LOG_INFO(LOGCAT_SYSTEM, "Finished SDLSystem initialization.\n"); - return TRUE; + return true; } -BOOL SDLSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) +bool SDLSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) { ASSERT(m_window == NULL); @@ -112,7 +112,7 @@ BOOL SDLSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) if (!window->Create(params)) { LOG_ERROR(LOGCAT_SYSTEM, "Failed to create a GameWindow.\n"); - return FALSE; + return false; } m_window = window; @@ -123,14 +123,14 @@ BOOL SDLSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) if (GLEW_OK != err) { LOG_ERROR(LOGCAT_SYSTEM, "GLEW failed to initialize: %s\n", glewGetErrorString(err)); - return FALSE; + return false; } LOG_INFO(LOGCAT_SYSTEM, "GLEW %s initialized. OpenGL extensions loaded.\n", glewGetString(GLEW_VERSION)); // Determine if shaders are supported by the video card if (GLEW_ARB_vertex_shader || GLEW_ARB_vertex_program) { - m_hasShaderSupport = TRUE; + m_hasShaderSupport = true; // Since shaders are supported, try to determine what the exact shader version that // is supported is by the presence of the different extensions @@ -148,7 +148,7 @@ BOOL SDLSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) m_supportedShaderVersion = 4.0f; } else - m_hasShaderSupport = FALSE; + m_hasShaderSupport = false; // display opengl hardware/support information // TODO: probably should just look at the GL_VERSION string since that's @@ -198,7 +198,7 @@ BOOL SDLSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params) LOG_INFO(LOGCAT_SYSTEM, "GameWindow instance is ready.\n"); - return TRUE; + return true; } void SDLSystem::ProcessEvents() @@ -256,7 +256,7 @@ void SDLSystem::ProcessEvents() void SDLSystem::Quit() { LOG_INFO(LOGCAT_SYSTEM, "Quit requested.\n"); - m_isQuitting = TRUE; + m_isQuitting = true; if (m_window != NULL && !m_window->IsClosing()) { diff --git a/src/framework/sdlsystem.h b/src/framework/sdlsystem.h index 230c06b..8e5da37 100644 --- a/src/framework/sdlsystem.h +++ b/src/framework/sdlsystem.h @@ -27,14 +27,14 @@ public: SDLSystem(); virtual ~SDLSystem(); - BOOL Initialize(); - BOOL CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params); + bool Initialize(); + bool CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params); void ProcessEvents(); void Quit(); - BOOL IsQuitting() const { return m_isQuitting; } + bool IsQuitting() const { return m_isQuitting; } - BOOL HasShaderSupport() const { return m_hasShaderSupport; } + bool HasShaderSupport() const { return m_hasShaderSupport; } float GetSupportedShaderVersion() const { return m_supportedShaderVersion; } GameWindow* GetWindow() const { return m_window; } @@ -47,14 +47,14 @@ public: void Delay(uint milliseconds) const { return SDL_Delay(milliseconds); } private: - BOOL m_isQuitting; + bool m_isQuitting; SDLGameWindow *m_window; SDLFileSystem *m_filesystem; SDLMouse *m_mouse; SDLKeyboard *m_keyboard; - BOOL m_hasShaderSupport; + bool m_hasShaderSupport; float m_supportedShaderVersion; }; diff --git a/src/framework/support/animationsequence.h b/src/framework/support/animationsequence.h index 2727847..660d6d7 100644 --- a/src/framework/support/animationsequence.h +++ b/src/framework/support/animationsequence.h @@ -10,11 +10,11 @@ struct AnimationSequence uint start; uint stop; float delay; - BOOL tileIsMultiDirectional; + bool tileIsMultiDirectional; uint tileDirectionFrameOffset; AnimationSequence(); - AnimationSequence(uint start, uint stop, float delay = 1.0f, BOOL tileIsMultiDirectional = FALSE, uint tileDirectionFrameOffset = 0); + AnimationSequence(uint start, uint stop, float delay = 1.0f, bool tileIsMultiDirectional = false, uint tileDirectionFrameOffset = 0); }; typedef stl::map AnimationList; @@ -25,11 +25,11 @@ inline AnimationSequence::AnimationSequence() this->start = 0; this->stop = 0; this->delay = 0.0f; - this->tileIsMultiDirectional = FALSE; + this->tileIsMultiDirectional = false; this->tileDirectionFrameOffset = 0; } -inline AnimationSequence::AnimationSequence(uint start, uint stop, float delay, BOOL tileIsMultiDirectional, uint tileDirectionFrameOffset) +inline AnimationSequence::AnimationSequence(uint start, uint stop, float delay, bool tileIsMultiDirectional, uint tileDirectionFrameOffset) { this->start = start; this->stop = stop; diff --git a/src/framework/util/typesystem.h b/src/framework/util/typesystem.h index 483d23d..5c8c76e 100644 --- a/src/framework/util/typesystem.h +++ b/src/framework/util/typesystem.h @@ -15,8 +15,8 @@ typedef const char* TYPE_IDENT; // // - comparison of two types using either template methods (static) or // variables containing type identifiers -// BOOL result = object.Is() or -// BOOL result = object.Is(objectTypeId) +// bool result = object.Is() or +// bool result = object.Is(objectTypeId) // // - "safe" casting - if the type doesn't match, NULL is returned // ObjectType* type = object.As() @@ -30,11 +30,11 @@ typedef const char* TYPE_IDENT; */ #define TYPE_BASE(type) \ virtual type GetTypeOf() const = 0; \ - template BOOL Is() const \ + template bool Is() const \ { \ return (GetTypeOf() == T::GetType()); \ } \ - BOOL Is(type otherType) const \ + bool Is(type otherType) const \ { \ return (GetTypeOf() == otherType); \ } \ diff --git a/src/game/testingstate.cpp b/src/game/testingstate.cpp index fcee8c8..a6b734c 100644 --- a/src/game/testingstate.cpp +++ b/src/game/testingstate.cpp @@ -47,12 +47,12 @@ void TestingState::OnPop() SAFE_DELETE(m_camera); } -void TestingState::OnPause(BOOL dueToOverlay) +void TestingState::OnPause(bool dueToOverlay) { GameState::OnPause(dueToOverlay); } -void TestingState::OnResume(BOOL fromOverlay) +void TestingState::OnResume(bool fromOverlay) { GameState::OnResume(fromOverlay); } @@ -108,7 +108,7 @@ void TestingState::OnUpdate(float delta) GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetCamera()->OnUpdate(delta); } -BOOL TestingState::OnTransition(float delta, BOOL isTransitioningOut, BOOL started) +bool TestingState::OnTransition(float delta, bool isTransitioningOut, bool started) { - return TRUE; + return true; } diff --git a/src/game/testingstate.h b/src/game/testingstate.h index 89b1b3b..96a3a8c 100644 --- a/src/game/testingstate.h +++ b/src/game/testingstate.h @@ -20,8 +20,8 @@ public: void OnPush(); void OnPop(); - void OnPause(BOOL dueToOverlay); - void OnResume(BOOL fromOverlay); + void OnPause(bool dueToOverlay); + void OnResume(bool fromOverlay); void OnAppGainFocus(); void OnAppLostFocus(); void OnLostContext(); @@ -29,7 +29,7 @@ public: void OnRender(RenderContext *renderContext); void OnResize(); void OnUpdate(float delta); - BOOL OnTransition(float delta, BOOL isTransitioningOut, BOOL started); + bool OnTransition(float delta, bool isTransitioningOut, bool started); private: Grid *m_grid; diff --git a/src/gameapp.cpp b/src/gameapp.cpp index b979fea..eadd40c 100644 --- a/src/gameapp.cpp +++ b/src/gameapp.cpp @@ -61,7 +61,7 @@ void GameApp::OnAppResume() m_stateManager->OnAppResume(); } -BOOL GameApp::OnInit() +bool GameApp::OnInit() { #if defined(DESKTOP) && defined(SDL) SDLGameWindowParams windowParams; @@ -69,17 +69,17 @@ BOOL GameApp::OnInit() windowParams.width = 854; windowParams.height = 480; windowParams.bpp = 0; - windowParams.windowed = TRUE; - windowParams.resizable = TRUE; + windowParams.windowed = true; + windowParams.resizable = true; #elif MOBILE GameWindowParams windowParams; - windowParams.windowed = FALSE; + windowParams.windowed = false; #else #error Undefined platform. #endif if (!Initialize(&windowParams)) - return FALSE; + return false; SeedRnd(GetOperatingSystem()->GetTicks()); @@ -96,7 +96,7 @@ BOOL GameApp::OnInit() m_renderContext = new RenderContext(GetGraphicsDevice(), GetContentManager()); m_contentCache = new ContentCache(GetContentManager()); - return TRUE; + return true; } void GameApp::OnLoadGame() diff --git a/src/gameapp.h b/src/gameapp.h index 70bee8f..8dc0f6e 100644 --- a/src/gameapp.h +++ b/src/gameapp.h @@ -19,7 +19,7 @@ public: void OnAppLostFocus(); void OnAppPause(); void OnAppResume(); - BOOL OnInit(); + bool OnInit(); void OnLoadGame(); void OnLostContext(); void OnNewContext(); diff --git a/src/graphics/textureanimator.cpp b/src/graphics/textureanimator.cpp index 428be12..14e9d68 100644 --- a/src/graphics/textureanimator.cpp +++ b/src/graphics/textureanimator.cpp @@ -43,19 +43,19 @@ void TextureAnimator::ResetAll() m_textureAtlasAnimations.clear(); } -void TextureAnimator::AddTileSequence(TextureAtlas *atlas, uint tileToBeAnimated, uint start, uint stop, float delay, BOOL loop) +void TextureAnimator::AddTileSequence(TextureAtlas *atlas, uint tileToBeAnimated, uint start, uint stop, float delay, bool loop) { AddTileSequence("", atlas, tileToBeAnimated, start, stop, delay, loop); } -void TextureAnimator::AddTileSequence(const stl::string &name, TextureAtlas *atlas, uint tileToBeAnimated, uint start, uint stop, float delay, BOOL loop) +void TextureAnimator::AddTileSequence(const stl::string &name, TextureAtlas *atlas, uint tileToBeAnimated, uint start, uint stop, float delay, bool loop) { ASSERT(atlas != NULL); ASSERT(tileToBeAnimated < atlas->GetNumTextures()); ASSERT(start < atlas->GetNumTextures()); ASSERT(stop < atlas->GetNumTextures()); ASSERT(start < stop); - ASSERT((tileToBeAnimated >= start && tileToBeAnimated <= stop) == FALSE); + ASSERT((tileToBeAnimated >= start && tileToBeAnimated <= stop) == false); TextureAtlasAnimationSequence *existingSequence = FindTileSequenceByName(name); ASSERT(existingSequence == NULL); @@ -68,7 +68,7 @@ void TextureAnimator::AddTileSequence(const stl::string &name, TextureAtlas *atl sequence.start = start; sequence.stop = stop; sequence.delay = delay; - sequence.isAnimating = TRUE; + sequence.isAnimating = true; sequence.loop = loop; sequence.frames = new Image*[sequence.GetNumFrames()]; sequence.name = name; @@ -106,21 +106,21 @@ void TextureAnimator::ResetTileSequence(const stl::string &name) TextureAtlasAnimationSequence *existingSequence = FindTileSequenceByName(name); ASSERT(existingSequence != NULL); - existingSequence->isAnimating = TRUE; + existingSequence->isAnimating = true; existingSequence->current = existingSequence->start; existingSequence->currentFrameTime = 0.0f; UpdateTextureWithCurrentTileFrame(*existingSequence); } -void TextureAnimator::StopTileSequence(const stl::string &name, BOOL restoreOriginalTile) +void TextureAnimator::StopTileSequence(const stl::string &name, bool restoreOriginalTile) { ASSERT(name.length() != 0); TextureAtlasAnimationSequence *existingSequence = FindTileSequenceByName(name); ASSERT(existingSequence != NULL); - existingSequence->isAnimating = FALSE; + existingSequence->isAnimating = false; existingSequence->current = existingSequence->stop; existingSequence->currentFrameTime = 0.0f; @@ -130,7 +130,7 @@ void TextureAnimator::StopTileSequence(const stl::string &name, BOOL restoreOrig UpdateTextureWithCurrentTileFrame(*existingSequence); } -void TextureAnimator::EnableTileSequence(const stl::string &name, BOOL enable) +void TextureAnimator::EnableTileSequence(const stl::string &name, bool enable) { ASSERT(name.length() != 0); diff --git a/src/graphics/textureanimator.h b/src/graphics/textureanimator.h index ff4edbc..2162728 100644 --- a/src/graphics/textureanimator.h +++ b/src/graphics/textureanimator.h @@ -22,11 +22,11 @@ public: void ResetAll(); - void AddTileSequence(TextureAtlas *atlas, uint tileToBeAnimated, uint start, uint stop, float delay, BOOL loop = TRUE); - void AddTileSequence(const stl::string &name, TextureAtlas *atlas, uint tileToBeAnimated, uint start, uint stop, float delay, BOOL loop = TRUE); + void AddTileSequence(TextureAtlas *atlas, uint tileToBeAnimated, uint start, uint stop, float delay, bool loop = true); + void AddTileSequence(const stl::string &name, TextureAtlas *atlas, uint tileToBeAnimated, uint start, uint stop, float delay, bool loop = true); void ResetTileSequence(const stl::string &name); - void StopTileSequence(const stl::string &name, BOOL restoreOriginalTile = FALSE); - void EnableTileSequence(const stl::string &name, BOOL enable); + void StopTileSequence(const stl::string &name, bool restoreOriginalTile = false); + void EnableTileSequence(const stl::string &name, bool enable); void OnUpdate(float delta); void OnNewContext(); diff --git a/src/graphics/textureatlasanimationsequence.h b/src/graphics/textureatlasanimationsequence.h index ed66feb..7854da7 100644 --- a/src/graphics/textureatlasanimationsequence.h +++ b/src/graphics/textureatlasanimationsequence.h @@ -16,8 +16,8 @@ struct TextureAtlasAnimationSequence uint current; float delay; float currentFrameTime; - BOOL isAnimating; - BOOL loop; + bool isAnimating; + bool loop; Image *originalAnimatingTile; Image **frames; stl::string name; @@ -25,7 +25,7 @@ struct TextureAtlasAnimationSequence TextureAtlasAnimationSequence(); uint GetNumFrames() const; - BOOL IsAnimationFinished() const; + bool IsAnimationFinished() const; }; inline TextureAtlasAnimationSequence::TextureAtlasAnimationSequence() @@ -37,8 +37,8 @@ inline TextureAtlasAnimationSequence::TextureAtlasAnimationSequence() current = 0; delay = 0.0f; currentFrameTime = 0.0f; - isAnimating = FALSE; - loop = FALSE; + isAnimating = false; + loop = false; originalAnimatingTile = NULL; frames = NULL; } @@ -48,12 +48,12 @@ inline uint TextureAtlasAnimationSequence::GetNumFrames() const return stop - start + 1; } -inline BOOL TextureAtlasAnimationSequence::IsAnimationFinished() const +inline bool TextureAtlasAnimationSequence::IsAnimationFinished() const { if (isAnimating && !loop && current == stop) - return TRUE; + return true; else - return FALSE; + return false; } #endif diff --git a/src/processes/gameprocess.cpp b/src/processes/gameprocess.cpp index a11efd9..249835f 100644 --- a/src/processes/gameprocess.cpp +++ b/src/processes/gameprocess.cpp @@ -14,7 +14,7 @@ GameProcess::GameProcess(GameState *gameState, ProcessManager *processManager) m_gameState = gameState; m_processManager = processManager; - m_finished = FALSE; + m_finished = false; } GameProcess::~GameProcess() @@ -29,11 +29,11 @@ void GameProcess::OnRemove() { } -void GameProcess::OnPause(BOOL dueToOverlay) +void GameProcess::OnPause(bool dueToOverlay) { } -void GameProcess::OnResume(BOOL fromOverlay) +void GameProcess::OnResume(bool fromOverlay) { } @@ -73,23 +73,23 @@ void GameProcess::OnUpdate(float delta) { } -BOOL GameProcess::OnTransition(float delta, BOOL isTransitioningOut, BOOL started) +bool GameProcess::OnTransition(float delta, bool isTransitioningOut, bool started) { - return TRUE; + return true; } -BOOL GameProcess::Handle(const Event *event) +bool GameProcess::Handle(const Event *event) { - return FALSE; + return false; } -BOOL GameProcess::IsTransitioning() const +bool GameProcess::IsTransitioning() const { return m_processManager->IsTransitioning(this); } void GameProcess::SetFinished() { - m_finished = TRUE; + m_finished = true; } diff --git a/src/processes/gameprocess.h b/src/processes/gameprocess.h index 1c608cd..49aede0 100644 --- a/src/processes/gameprocess.h +++ b/src/processes/gameprocess.h @@ -24,8 +24,8 @@ public: virtual void OnAdd(); virtual void OnRemove(); - virtual void OnPause(BOOL dueToOverlay); - virtual void OnResume(BOOL fromOverlay); + virtual void OnPause(bool dueToOverlay); + virtual void OnResume(bool fromOverlay); virtual void OnAppGainFocus(); virtual void OnAppLostFocus(); virtual void OnAppPause(); @@ -35,14 +35,14 @@ public: virtual void OnRender(RenderContext *renderContext); virtual void OnResize(); virtual void OnUpdate(float delta); - virtual BOOL OnTransition(float delta, BOOL isTransitioningOut, BOOL started); + virtual bool OnTransition(float delta, bool isTransitioningOut, bool started); - virtual BOOL Handle(const Event *event); + virtual bool Handle(const Event *event); GameApp* GetGameApp() const { return m_gameState->GetGameApp(); } - BOOL IsFinished() const { return m_finished; } - BOOL IsTransitioning() const; + bool IsFinished() const { return m_finished; } + bool IsTransitioning() const; protected: GameState* GetGameState() const { return m_gameState; } @@ -53,7 +53,7 @@ protected: private: GameState* m_gameState; ProcessManager *m_processManager; - BOOL m_finished; + bool m_finished; }; #endif diff --git a/src/processes/gwengameprocess.cpp b/src/processes/gwengameprocess.cpp index b6bf6d7..8dda772 100644 --- a/src/processes/gwengameprocess.cpp +++ b/src/processes/gwengameprocess.cpp @@ -25,12 +25,12 @@ void GwenGameProcess::OnRemove() m_gwenController->OnRemove(); } -void GwenGameProcess::OnPause(BOOL dueToOverlay) +void GwenGameProcess::OnPause(bool dueToOverlay) { m_gwenController->OnPause(dueToOverlay); } -void GwenGameProcess::OnResume(BOOL fromOverlay) +void GwenGameProcess::OnResume(bool fromOverlay) { m_gwenController->OnResume(fromOverlay); } @@ -60,12 +60,12 @@ void GwenGameProcess::OnUpdate(float delta) m_gwenController->OnUpdate(delta); } -BOOL GwenGameProcess::OnTransition(float delta, BOOL isTransitioningOut, BOOL started) +bool GwenGameProcess::OnTransition(float delta, bool isTransitioningOut, bool started) { return m_gwenController->OnTransition(delta, isTransitioningOut, started); } -BOOL GwenGameProcess::Handle(const Event *event) +bool GwenGameProcess::Handle(const Event *event) { // handle events... diff --git a/src/processes/gwengameprocess.h b/src/processes/gwengameprocess.h index 53483cf..083e1d6 100644 --- a/src/processes/gwengameprocess.h +++ b/src/processes/gwengameprocess.h @@ -24,16 +24,16 @@ public: virtual void OnAdd(); virtual void OnRemove(); - virtual void OnPause(BOOL dueToOverlay); - virtual void OnResume(BOOL fromOverlay); + virtual void OnPause(bool dueToOverlay); + virtual void OnResume(bool fromOverlay); virtual void OnLostContext(); virtual void OnNewContext(); virtual void OnRender(RenderContext *renderContext); virtual void OnResize(); virtual void OnUpdate(float delta); - virtual BOOL OnTransition(float delta, BOOL isTransitioningOut, BOOL started); + virtual bool OnTransition(float delta, bool isTransitioningOut, bool started); - virtual BOOL Handle(const Event *event); + virtual bool Handle(const Event *event); private: GwenGameProcessUIController *m_gwenController; diff --git a/src/processes/gwengameprocessuicontroller.cpp b/src/processes/gwengameprocessuicontroller.cpp index f3dafaf..9fc5b12 100644 --- a/src/processes/gwengameprocessuicontroller.cpp +++ b/src/processes/gwengameprocessuicontroller.cpp @@ -39,14 +39,14 @@ void GwenGameProcessUIController::OnRemove() { } -void GwenGameProcessUIController::OnPause(BOOL dueToOverlay) +void GwenGameProcessUIController::OnPause(bool dueToOverlay) { - EnableGwenInput(FALSE); + EnableGwenInput(false); } -void GwenGameProcessUIController::OnResume(BOOL fromOverlay) +void GwenGameProcessUIController::OnResume(bool fromOverlay) { - EnableGwenInput(TRUE); + EnableGwenInput(true); } void GwenGameProcessUIController::OnLostContext() @@ -77,14 +77,14 @@ void GwenGameProcessUIController::OnUpdate(float delta) m_canvas->DoThink(); } -BOOL GwenGameProcessUIController::OnTransition(float delta, BOOL isTransitioningOut, BOOL started) +bool GwenGameProcessUIController::OnTransition(float delta, bool isTransitioningOut, bool started) { - return TRUE; + return true; } -BOOL GwenGameProcessUIController::Handle(const Event *event) +bool GwenGameProcessUIController::Handle(const Event *event) { - return FALSE; + return false; } Gwen::Controls::Canvas* GwenGameProcessUIController::InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint fontSize) @@ -126,7 +126,7 @@ void GwenGameProcessUIController::ResizeAndScaleCanvas() } } -void GwenGameProcessUIController::EnableGwenInput(BOOL enable) +void GwenGameProcessUIController::EnableGwenInput(bool enable) { if (m_inputProcessor != NULL) m_inputProcessor->Enable(enable); diff --git a/src/processes/gwengameprocessuicontroller.h b/src/processes/gwengameprocessuicontroller.h index e2a5b88..b501e8b 100644 --- a/src/processes/gwengameprocessuicontroller.h +++ b/src/processes/gwengameprocessuicontroller.h @@ -39,21 +39,21 @@ public: virtual void OnAdd(); virtual void OnRemove(); - virtual void OnPause(BOOL dueToOverlay); - virtual void OnResume(BOOL fromOverlay); + virtual void OnPause(bool dueToOverlay); + virtual void OnResume(bool fromOverlay); virtual void OnLostContext(); virtual void OnNewContext(); virtual void OnRender(RenderContext *renderContext); virtual void OnResize(); virtual void OnUpdate(float delta); - virtual BOOL OnTransition(float delta, BOOL isTransitioningOut, BOOL started); + virtual bool OnTransition(float delta, bool isTransitioningOut, bool started); - template BOOL ListenFor(); - template BOOL StopListeningFor(); - BOOL ListenFor(EVENT_TYPE type); - BOOL StopListeningFor(EVENT_TYPE type); + template bool ListenFor(); + template bool StopListeningFor(); + bool ListenFor(EVENT_TYPE type); + bool StopListeningFor(EVENT_TYPE type); - virtual BOOL Handle(const Event *event); + virtual bool Handle(const Event *event); protected: Gwen::Controls::Canvas* InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint fontSize); @@ -62,7 +62,7 @@ protected: GwenGameProcess* GetGameProcess() const { return m_gameProcess; } Gwen::Controls::Canvas* GetCanvas() const { return m_canvas; } - void EnableGwenInput(BOOL enable); + void EnableGwenInput(bool enable); float GetAlpha() const { return m_alpha; } float GetScale() const { return m_scale; } @@ -90,23 +90,23 @@ private: }; template -BOOL GwenGameProcessUIController::ListenFor() +bool GwenGameProcessUIController::ListenFor() { return m_gameProcess->ListenFor(); } template -BOOL GwenGameProcessUIController::StopListeningFor() +bool GwenGameProcessUIController::StopListeningFor() { return m_gameProcess->StopListeningFor(); } -inline BOOL GwenGameProcessUIController::ListenFor(EVENT_TYPE type) +inline bool GwenGameProcessUIController::ListenFor(EVENT_TYPE type) { return m_gameProcess->ListenFor(type); } -inline BOOL GwenGameProcessUIController::StopListeningFor(EVENT_TYPE type) +inline bool GwenGameProcessUIController::StopListeningFor(EVENT_TYPE type) { return m_gameProcess->StopListeningFor(type); } diff --git a/src/processes/processinfo.cpp b/src/processes/processinfo.cpp index bba91d6..e77dfe5 100644 --- a/src/processes/processinfo.cpp +++ b/src/processes/processinfo.cpp @@ -10,11 +10,11 @@ ProcessInfo::ProcessInfo(GameProcess *process) ASSERT(process != NULL); this->process = process; name = ""; - isTransitioning = FALSE; - isTransitioningOut = FALSE; - isTransitionStarting = FALSE; - isInactive = FALSE; - isBeingRemoved = FALSE; + isTransitioning = false; + isTransitioningOut = false; + isTransitionStarting = false; + isInactive = false; + isBeingRemoved = false; SetDescriptor(); } @@ -24,11 +24,11 @@ ProcessInfo::ProcessInfo(GameProcess *process, const stl::string &name) ASSERT(process != NULL); this->process = process; this->name = name; - isTransitioning = FALSE; - isTransitioningOut = FALSE; - isTransitionStarting = FALSE; - isInactive = FALSE; - isBeingRemoved = FALSE; + isTransitioning = false; + isTransitioningOut = false; + isTransitionStarting = false; + isInactive = false; + isBeingRemoved = false; SetDescriptor(); } diff --git a/src/processes/processinfo.h b/src/processes/processinfo.h index bd55ded..419f404 100644 --- a/src/processes/processinfo.h +++ b/src/processes/processinfo.h @@ -13,11 +13,11 @@ struct ProcessInfo GameProcess *process; stl::string name; - BOOL isTransitioning; - BOOL isTransitioningOut; - BOOL isTransitionStarting; - BOOL isInactive; - BOOL isBeingRemoved; + bool isTransitioning; + bool isTransitioningOut; + bool isTransitionStarting; + bool isInactive; + bool isBeingRemoved; const stl::string& GetDescriptor() const { return m_descriptor; } diff --git a/src/processes/processmanager.cpp b/src/processes/processmanager.cpp index e4125e8..cc19279 100644 --- a/src/processes/processmanager.cpp +++ b/src/processes/processmanager.cpp @@ -42,22 +42,22 @@ ProcessManager::~ProcessManager() void ProcessManager::Remove(const stl::string &name) { ProcessInfoList::iterator itor = GetProcessItorFor(name); - StartTransitionOut(itor, TRUE); + StartTransitionOut(itor, true); } -BOOL ProcessManager::HasProcess(const stl::string &name) const +bool ProcessManager::HasProcess(const stl::string &name) const { for (ProcessInfoList::const_iterator i = m_processes.begin(); i != m_processes.end(); ++i) { ProcessInfo *processInfo = *i; if (processInfo->name.length() > 0 && name == processInfo->name) - return TRUE; + return true; } - return FALSE; + return false; } -void ProcessManager::OnPause(BOOL dueToOverlay) +void ProcessManager::OnPause(bool dueToOverlay) { if (IsEmpty()) return; @@ -71,7 +71,7 @@ void ProcessManager::OnPause(BOOL dueToOverlay) if (!processInfo->isInactive) { LOG_INFO(LOGCAT_PROCESSMANAGER, "Pausing process %s due to parent state overlay.\n", processInfo->GetDescriptor().c_str()); - processInfo->process->OnPause(TRUE); + processInfo->process->OnPause(true); } } } @@ -82,12 +82,12 @@ void ProcessManager::OnPause(BOOL dueToOverlay) { ProcessInfo *processInfo = *i; if (!processInfo->isInactive) - StartTransitionOut(i, FALSE); + StartTransitionOut(i, false); } } } -void ProcessManager::OnResume(BOOL fromOverlay) +void ProcessManager::OnResume(bool fromOverlay) { if (IsEmpty()) return; @@ -101,7 +101,7 @@ void ProcessManager::OnResume(BOOL fromOverlay) if (!processInfo->isInactive) { LOG_INFO(LOGCAT_PROCESSMANAGER, "Resuming process %s due to overlay state removal.\n", processInfo->GetDescriptor().c_str()); - processInfo->process->OnResume(TRUE); + processInfo->process->OnResume(true); } } } @@ -114,12 +114,12 @@ void ProcessManager::OnResume(BOOL fromOverlay) if (processInfo->isInactive && !processInfo->isBeingRemoved) { LOG_INFO(LOGCAT_PROCESSMANAGER, "Resuming process %s.\n", processInfo->GetDescriptor().c_str()); - processInfo->process->OnResume(FALSE); + processInfo->process->OnResume(false); - processInfo->isInactive = FALSE; - processInfo->isTransitioning = TRUE; - processInfo->isTransitioningOut = FALSE; - processInfo->isTransitionStarting = TRUE; + processInfo->isInactive = false; + processInfo->isTransitioning = true; + processInfo->isTransitioningOut = false; + processInfo->isTransitionStarting = true; LOG_INFO(LOGCAT_PROCESSMANAGER, "Transition into process %s started.\n", processInfo->GetDescriptor().c_str()); } } @@ -254,10 +254,10 @@ void ProcessManager::CheckForFinishedProcesses() if (!processInfo->isInactive && processInfo->process->IsFinished() && !processInfo->isTransitioning) { LOG_INFO(LOGCAT_PROCESSMANAGER, "Process %s marked as finished.\n", processInfo->GetDescriptor().c_str()); - processInfo->isTransitioning = TRUE; - processInfo->isTransitioningOut = TRUE; - processInfo->isTransitionStarting = TRUE; - processInfo->isBeingRemoved = TRUE; + processInfo->isTransitioning = true; + processInfo->isTransitioningOut = true; + processInfo->isTransitionStarting = true; + processInfo->isBeingRemoved = true; LOG_INFO(LOGCAT_PROCESSMANAGER, "Transition out of process %s started.\n", processInfo->GetDescriptor().c_str()); } } @@ -268,9 +268,9 @@ void ProcessManager::ProcessQueue() while (!m_queue.empty()) { ProcessInfo *processInfo = m_queue.front(); - processInfo->isTransitioning = TRUE; - processInfo->isTransitioningOut = FALSE; - processInfo->isTransitionStarting = TRUE; + processInfo->isTransitioning = true; + processInfo->isTransitioningOut = false; + processInfo->isTransitionStarting = true; LOG_INFO(LOGCAT_PROCESSMANAGER, "Adding process %s from queue.\n", processInfo->GetDescriptor().c_str()); processInfo->process->OnAdd(); @@ -291,7 +291,7 @@ void ProcessManager::UpdateTransitions(float delta) ProcessInfo *processInfo = *i; if (processInfo->isTransitioning) { - BOOL isDone = processInfo->process->OnTransition(delta, processInfo->isTransitioningOut, processInfo->isTransitionStarting); + bool isDone = processInfo->process->OnTransition(delta, processInfo->isTransitioningOut, processInfo->isTransitionStarting); if (isDone) { LOG_INFO(LOGCAT_PROCESSMANAGER, "Transition %s process %s finished.\n", (processInfo->isTransitioningOut ? "out of" : "into"), processInfo->GetDescriptor().c_str()); @@ -308,16 +308,16 @@ void ProcessManager::UpdateTransitions(float delta) else { LOG_INFO(LOGCAT_PROCESSMANAGER, "Pausing process %s.\n", processInfo->GetDescriptor().c_str()); - processInfo->process->OnPause(FALSE); + processInfo->process->OnPause(false); } - processInfo->isInactive = TRUE; + processInfo->isInactive = true; } // done transitioning - processInfo->isTransitioning = FALSE; - processInfo->isTransitioningOut = FALSE; + processInfo->isTransitioning = false; + processInfo->isTransitioningOut = false; } - processInfo->isTransitionStarting = FALSE; + processInfo->isTransitionStarting = false; } } } @@ -329,7 +329,7 @@ void ProcessManager::RemoveAll() { ProcessInfo *processInfo = *i; if (!processInfo->isTransitioning && !processInfo->isInactive) - StartTransitionOut(i, TRUE); + StartTransitionOut(i, true); } } @@ -342,29 +342,29 @@ void ProcessManager::Queue(ProcessInfo *newProcessInfo) m_queue.push_back(newProcessInfo); } -void ProcessManager::StartTransitionOut(ProcessInfoList::iterator itor, BOOL forRemoval) +void ProcessManager::StartTransitionOut(ProcessInfoList::iterator itor, bool forRemoval) { ASSERT(itor != m_processes.end()); ProcessInfo *processInfo = *itor; - ASSERT(processInfo->isInactive == FALSE); - ASSERT(processInfo->isTransitioning == FALSE); - processInfo->isTransitioning = TRUE; - processInfo->isTransitioningOut = TRUE; - processInfo->isTransitionStarting = TRUE; + ASSERT(processInfo->isInactive == false); + ASSERT(processInfo->isTransitioning == false); + processInfo->isTransitioning = true; + processInfo->isTransitioningOut = true; + processInfo->isTransitionStarting = true; processInfo->isBeingRemoved = forRemoval; LOG_INFO(LOGCAT_PROCESSMANAGER, "Transition out of process %s started pending %s.\n", processInfo->GetDescriptor().c_str(), (forRemoval ? "removal" : "pause")); } -BOOL ProcessManager::IsTransitioning() const +bool ProcessManager::IsTransitioning() const { for (ProcessInfoList::const_iterator i = m_processes.begin(); i != m_processes.end(); ++i) { const ProcessInfo *processInfo = *i; if (processInfo->isTransitioning) - return TRUE; + return true; } - return FALSE; + return false; } ProcessInfoList::iterator ProcessManager::GetProcessItorFor(const stl::string &name) diff --git a/src/processes/processmanager.h b/src/processes/processmanager.h index bca9fdc..9ea06ad 100644 --- a/src/processes/processmanager.h +++ b/src/processes/processmanager.h @@ -25,10 +25,10 @@ public: template void RemoveFirst(); void RemoveAll(); - BOOL HasProcess(const stl::string &name) const; + bool HasProcess(const stl::string &name) const; - void OnPause(BOOL dueToOverlay); - void OnResume(BOOL fromOverlay); + void OnPause(bool dueToOverlay); + void OnResume(bool fromOverlay); void OnAppGainFocus(); void OnAppLostFocus(); void OnAppPause(); @@ -39,13 +39,13 @@ public: void OnResize(); void OnUpdate(float delta); - BOOL IsTransitioning() const; - BOOL IsEmpty() const; - BOOL IsTransitioning(const GameProcess *process) const; + bool IsTransitioning() const; + bool IsEmpty() const; + bool IsTransitioning(const GameProcess *process) const; private: void Queue(ProcessInfo *newProcessInfo); - void StartTransitionOut(ProcessInfoList::iterator itor, BOOL forRemoval); + void StartTransitionOut(ProcessInfoList::iterator itor, bool forRemoval); ProcessInfoList::iterator GetProcessItorFor(const stl::string &name); ProcessInfoList::iterator GetProcessItorForFirstOf(GAMEPROCESS_TYPE processType); @@ -80,15 +80,15 @@ template void ProcessManager::RemoveFirst() { ProcessInfoList::iterator itor = GetProcessItorForFirstOf(T::GetType()); - StartTransitionOut(itor, TRUE); + StartTransitionOut(itor, true); } -inline BOOL ProcessManager::IsEmpty() const +inline bool ProcessManager::IsEmpty() const { return (m_processes.empty() && m_queue.empty()); } -inline BOOL ProcessManager::IsTransitioning(const GameProcess *process) const +inline bool ProcessManager::IsTransitioning(const GameProcess *process) const { return GetProcessInfoFor(process)->isTransitioning; } diff --git a/src/states/gamestate.cpp b/src/states/gamestate.cpp index 3a40845..c35ad18 100644 --- a/src/states/gamestate.cpp +++ b/src/states/gamestate.cpp @@ -19,9 +19,9 @@ GameState::GameState(GameApp *gameApp, StateManager *stateManager) m_effectManager = new EffectManager(); m_processManager = new ProcessManager(this); - m_isFinished = FALSE; + m_isFinished = false; m_returnValue = 0; - m_hasReturnValue = FALSE; + m_hasReturnValue = false; } GameState::~GameState() @@ -38,12 +38,12 @@ void GameState::OnPop() { } -void GameState::OnPause(BOOL dueToOverlay) +void GameState::OnPause(bool dueToOverlay) { m_processManager->OnPause(dueToOverlay); } -void GameState::OnResume(BOOL fromOverlay) +void GameState::OnResume(bool fromOverlay) { m_processManager->OnResume(fromOverlay); } @@ -105,36 +105,36 @@ void GameState::OnUpdate(float delta) m_effectManager->OnUpdate(delta); } -BOOL GameState::OnTransition(float delta, BOOL isTransitioningOut, BOOL started) +bool GameState::OnTransition(float delta, bool isTransitioningOut, bool started) { - return TRUE; + return true; } -BOOL GameState::Handle(const Event *event) +bool GameState::Handle(const Event *event) { - return FALSE; + return false; } -BOOL GameState::IsTransitioning() const +bool GameState::IsTransitioning() const { return m_stateManager->IsTransitioning(this); } -BOOL GameState::IsTopState() const +bool GameState::IsTopState() const { return m_stateManager->IsTop(this); } void GameState::SetFinished() { - m_isFinished = TRUE; + m_isFinished = true; m_returnValue = 0; - m_hasReturnValue = FALSE; + m_hasReturnValue = false; } void GameState::SetFinished(int returnValue) { - m_isFinished = TRUE; + m_isFinished = true; m_returnValue = returnValue; - m_hasReturnValue = TRUE; + m_hasReturnValue = true; } diff --git a/src/states/gamestate.h b/src/states/gamestate.h index a5c972a..c7913fe 100644 --- a/src/states/gamestate.h +++ b/src/states/gamestate.h @@ -24,8 +24,8 @@ public: virtual void OnPush(); virtual void OnPop(); - virtual void OnPause(BOOL dueToOverlay); - virtual void OnResume(BOOL fromOverlay); + virtual void OnPause(bool dueToOverlay); + virtual void OnResume(bool fromOverlay); virtual void OnAppGainFocus(); virtual void OnAppLostFocus(); virtual void OnAppPause(); @@ -35,18 +35,18 @@ public: virtual void OnRender(RenderContext *renderContext); virtual void OnResize(); virtual void OnUpdate(float delta); - virtual BOOL OnTransition(float delta, BOOL isTransitioningOut, BOOL started); + virtual bool OnTransition(float delta, bool isTransitioningOut, bool started); - virtual BOOL Handle(const Event *event); + virtual bool Handle(const Event *event); GameApp* GetGameApp() const { return m_gameApp; } ProcessManager* GetProcessManager() const { return m_processManager; } EffectManager* GetEffectManager() const { return m_effectManager; } - BOOL IsTransitioning() const; - BOOL IsTopState() const; - BOOL IsFinished() const { return m_isFinished; } - BOOL HasReturnValue() const { return m_hasReturnValue; } + bool IsTransitioning() const; + bool IsTopState() const; + bool IsFinished() const { return m_isFinished; } + bool HasReturnValue() const { return m_hasReturnValue; } int GetReturnValue() const { return m_returnValue; } protected: @@ -60,9 +60,9 @@ private: StateManager *m_stateManager; ProcessManager *m_processManager; EffectManager *m_effectManager; - BOOL m_isFinished; + bool m_isFinished; int m_returnValue; - BOOL m_hasReturnValue; + bool m_hasReturnValue; }; #endif diff --git a/src/states/gwengamestate.cpp b/src/states/gwengamestate.cpp index e39a734..fbeffb5 100644 --- a/src/states/gwengamestate.cpp +++ b/src/states/gwengamestate.cpp @@ -25,13 +25,13 @@ void GwenGameState::OnPop() m_gwenController->OnPop(); } -void GwenGameState::OnPause(BOOL dueToOverlay) +void GwenGameState::OnPause(bool dueToOverlay) { GameState::OnPause(dueToOverlay); m_gwenController->OnPause(dueToOverlay); } -void GwenGameState::OnResume(BOOL fromOverlay) +void GwenGameState::OnResume(bool fromOverlay) { GameState::OnResume(fromOverlay); m_gwenController->OnResume(fromOverlay); @@ -67,12 +67,12 @@ void GwenGameState::OnUpdate(float delta) m_gwenController->OnUpdate(delta); } -BOOL GwenGameState::OnTransition(float delta, BOOL isTransitioningOut, BOOL started) +bool GwenGameState::OnTransition(float delta, bool isTransitioningOut, bool started) { return m_gwenController->OnTransition(delta, isTransitioningOut, started); } -BOOL GwenGameState::Handle(const Event *event) +bool GwenGameState::Handle(const Event *event) { // handle events... diff --git a/src/states/gwengamestate.h b/src/states/gwengamestate.h index dd88903..33347d1 100644 --- a/src/states/gwengamestate.h +++ b/src/states/gwengamestate.h @@ -24,16 +24,16 @@ public: virtual void OnPush(); virtual void OnPop(); - virtual void OnPause(BOOL dueToOverlay); - virtual void OnResume(BOOL fromOverlay); + virtual void OnPause(bool dueToOverlay); + virtual void OnResume(bool fromOverlay); virtual void OnLostContext(); virtual void OnNewContext(); virtual void OnRender(RenderContext *renderContext); virtual void OnResize(); virtual void OnUpdate(float delta); - virtual BOOL OnTransition(float delta, BOOL isTransitioningOut, BOOL started); + virtual bool OnTransition(float delta, bool isTransitioningOut, bool started); - virtual BOOL Handle(const Event *event); + virtual bool Handle(const Event *event); private: GwenGameStateUIController *m_gwenController; diff --git a/src/states/gwengamestateuicontroller.cpp b/src/states/gwengamestateuicontroller.cpp index 5e70a62..8a1ded9 100644 --- a/src/states/gwengamestateuicontroller.cpp +++ b/src/states/gwengamestateuicontroller.cpp @@ -40,14 +40,14 @@ void GwenGameStateUIController::OnPop() { } -void GwenGameStateUIController::OnPause(BOOL dueToOverlay) +void GwenGameStateUIController::OnPause(bool dueToOverlay) { - EnableGwenInput(FALSE); + EnableGwenInput(false); } -void GwenGameStateUIController::OnResume(BOOL fromOverlay) +void GwenGameStateUIController::OnResume(bool fromOverlay) { - EnableGwenInput(TRUE); + EnableGwenInput(true); } void GwenGameStateUIController::OnLostContext() @@ -78,14 +78,14 @@ void GwenGameStateUIController::OnUpdate(float delta) m_canvas->DoThink(); } -BOOL GwenGameStateUIController::OnTransition(float delta, BOOL isTransitioningOut, BOOL started) +bool GwenGameStateUIController::OnTransition(float delta, bool isTransitioningOut, bool started) { - return TRUE; + return true; } -BOOL GwenGameStateUIController::Handle(const Event *event) +bool GwenGameStateUIController::Handle(const Event *event) { - return FALSE; + return false; } Gwen::Controls::Canvas* GwenGameStateUIController::InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint fontSize) @@ -128,7 +128,7 @@ void GwenGameStateUIController::ResizeAndScaleCanvas() } } -void GwenGameStateUIController::EnableGwenInput(BOOL enable) +void GwenGameStateUIController::EnableGwenInput(bool enable) { if (m_inputProcessor != NULL) m_inputProcessor->Enable(enable); diff --git a/src/states/gwengamestateuicontroller.h b/src/states/gwengamestateuicontroller.h index cccb7f0..537e20d 100644 --- a/src/states/gwengamestateuicontroller.h +++ b/src/states/gwengamestateuicontroller.h @@ -38,21 +38,21 @@ public: virtual void OnPush(); virtual void OnPop(); - virtual void OnPause(BOOL dueToOverlay); - virtual void OnResume(BOOL fromOverlay); + virtual void OnPause(bool dueToOverlay); + virtual void OnResume(bool fromOverlay); virtual void OnLostContext(); virtual void OnNewContext(); virtual void OnRender(RenderContext *renderContext); virtual void OnResize(); virtual void OnUpdate(float delta); - virtual BOOL OnTransition(float delta, BOOL isTransitioningOut, BOOL started); + virtual bool OnTransition(float delta, bool isTransitioningOut, bool started); - template BOOL ListenFor(); - template BOOL StopListeningFor(); - BOOL ListenFor(EVENT_TYPE type); - BOOL StopListeningFor(EVENT_TYPE type); + template bool ListenFor(); + template bool StopListeningFor(); + bool ListenFor(EVENT_TYPE type); + bool StopListeningFor(EVENT_TYPE type); - virtual BOOL Handle(const Event *event); + virtual bool Handle(const Event *event); protected: Gwen::Controls::Canvas* InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint fontSize); @@ -61,7 +61,7 @@ protected: GwenGameState* GetGameState() const { return m_gameState; } Gwen::Controls::Canvas* GetCanvas() const { return m_canvas; } - void EnableGwenInput(BOOL enable); + void EnableGwenInput(bool enable); float GetAlpha() const { return m_alpha; } float GetScale() const { return m_scale; } @@ -89,23 +89,23 @@ private: }; template -BOOL GwenGameStateUIController::ListenFor() +bool GwenGameStateUIController::ListenFor() { return m_gameState->ListenFor(); } template -BOOL GwenGameStateUIController::StopListeningFor() +bool GwenGameStateUIController::StopListeningFor() { return m_gameState->StopListeningFor(); } -inline BOOL GwenGameStateUIController::ListenFor(EVENT_TYPE type) +inline bool GwenGameStateUIController::ListenFor(EVENT_TYPE type) { return m_gameState->ListenFor(type); } -inline BOOL GwenGameStateUIController::StopListeningFor(EVENT_TYPE type) +inline bool GwenGameStateUIController::StopListeningFor(EVENT_TYPE type) { return m_gameState->StopListeningFor(type); } diff --git a/src/states/stateinfo.cpp b/src/states/stateinfo.cpp index 6527c83..67d48a5 100644 --- a/src/states/stateinfo.cpp +++ b/src/states/stateinfo.cpp @@ -10,13 +10,13 @@ StateInfo::StateInfo(GameState *gameState) ASSERT(gameState != NULL); this->gameState = gameState; name = ""; - isOverlay = FALSE; - isOverlayed = FALSE; - isTransitioning = FALSE; - isTransitioningOut = FALSE; - isTransitionStarting = FALSE; - isInactive = FALSE; - isBeingPopped = FALSE; + isOverlay = false; + isOverlayed = false; + isTransitioning = false; + isTransitioningOut = false; + isTransitionStarting = false; + isInactive = false; + isBeingPopped = false; SetDescriptor(); } @@ -26,13 +26,13 @@ StateInfo::StateInfo(GameState *gameState, const stl::string &name) ASSERT(gameState != NULL); this->gameState = gameState; this->name = name; - isOverlay = FALSE; - isOverlayed = FALSE; - isTransitioning = FALSE; - isTransitioningOut = FALSE; - isTransitionStarting = FALSE; - isInactive = FALSE; - isBeingPopped = FALSE; + isOverlay = false; + isOverlayed = false; + isTransitioning = false; + isTransitioningOut = false; + isTransitionStarting = false; + isInactive = false; + isBeingPopped = false; SetDescriptor(); } diff --git a/src/states/stateinfo.h b/src/states/stateinfo.h index adeb61d..fee79f9 100644 --- a/src/states/stateinfo.h +++ b/src/states/stateinfo.h @@ -13,13 +13,13 @@ struct StateInfo GameState *gameState; stl::string name; - BOOL isOverlay; - BOOL isOverlayed; - BOOL isTransitioning; - BOOL isTransitioningOut; - BOOL isTransitionStarting; - BOOL isInactive; - BOOL isBeingPopped; + bool isOverlay; + bool isOverlayed; + bool isTransitioning; + bool isTransitioningOut; + bool isTransitionStarting; + bool isInactive; + bool isBeingPopped; const stl::string& GetDescriptor() const { return m_descriptor; } diff --git a/src/states/statemanager.cpp b/src/states/statemanager.cpp index d6ebfbf..b612963 100644 --- a/src/states/statemanager.cpp +++ b/src/states/statemanager.cpp @@ -15,10 +15,10 @@ StateManager::StateManager(GameApp *gameApp) ASSERT(gameApp != NULL); m_gameApp = gameApp; m_stateReturnValue = 0; - m_hasStateReturnValue = FALSE; - m_pushQueueHasOverlay = FALSE; - m_swapQueueHasOverlay = FALSE; - m_lastCleanedStatesWereAllOverlays = FALSE; + m_hasStateReturnValue = false; + m_pushQueueHasOverlay = false; + m_swapQueueHasOverlay = false; + m_lastCleanedStatesWereAllOverlays = false; } StateManager::~StateManager() @@ -56,28 +56,28 @@ StateManager::~StateManager() void StateManager::Pop() { - ASSERT(IsTransitioning() == FALSE); + ASSERT(IsTransitioning() == false); LOG_INFO(LOGCAT_STATEMANAGER, "Pop initiated for top-most state only.\n"); - StartOnlyTopStateTransitioningOut(FALSE); + StartOnlyTopStateTransitioningOut(false); } void StateManager::PopTopNonOverlay() { - ASSERT(IsTransitioning() == FALSE); + ASSERT(IsTransitioning() == false); LOG_INFO(LOGCAT_STATEMANAGER, "Pop initiated for all top active states.\n"); - StartTopStatesTransitioningOut(FALSE); + StartTopStatesTransitioningOut(false); } -BOOL StateManager::HasState(const stl::string &name) const +bool StateManager::HasState(const stl::string &name) const { for (StateInfoList::const_iterator i = m_states.begin(); i != m_states.end(); ++i) { StateInfo *stateInfo = *i; if (stateInfo->name.length() > 0 && name == stateInfo->name) - return TRUE; + return true; } - return FALSE; + return false; } void StateManager::OnAppGainFocus() @@ -167,8 +167,8 @@ void StateManager::OnUpdate(float delta) { // clear return values (ensuring they're only accessible for 1 tick) m_stateReturnValue = 0; - m_hasStateReturnValue = FALSE; - m_lastCleanedStatesWereAllOverlays = FALSE; + m_hasStateReturnValue = false; + m_lastCleanedStatesWereAllOverlays = false; CleanupInactiveStates(); CheckForFinishedStates(); @@ -190,7 +190,7 @@ void StateManager::ProcessQueues() if (IsTransitioning()) return; - ASSERT(m_pushQueue.empty() == TRUE || m_swapQueue.empty() == TRUE); + ASSERT(m_pushQueue.empty() == true || m_swapQueue.empty() == true); // for each state in the queue, add it to the main list and start it // transitioning in @@ -207,17 +207,17 @@ void StateManager::ProcessQueues() if (stateInfo->isOverlay && !currentTopStateInfo->isInactive && !currentTopStateInfo->isOverlayed) { LOG_INFO(LOGCAT_STATEMANAGER, "Pausing %sstate %s due to overlay.\n", (currentTopStateInfo->isOverlay ? "overlay " : ""), currentTopStateInfo->GetDescriptor().c_str()); - currentTopStateInfo->gameState->OnPause(TRUE); + currentTopStateInfo->gameState->OnPause(true); // also mark the current top state as being overlay-ed - currentTopStateInfo->isOverlayed = TRUE; + currentTopStateInfo->isOverlayed = true; } } LOG_INFO(LOGCAT_STATEMANAGER, "Pushing %sstate %s from push-queue.\n", (stateInfo->isOverlay ? "overlay " : ""), stateInfo->GetDescriptor().c_str()); stateInfo->gameState->OnPush(); - TransitionIn(stateInfo, FALSE); + TransitionIn(stateInfo, false); m_states.push_back(stateInfo); @@ -234,24 +234,24 @@ void StateManager::ProcessQueues() if (stateInfo->isOverlay && !currentTopStateInfo->isInactive && !currentTopStateInfo->isOverlayed) { LOG_INFO(LOGCAT_STATEMANAGER, "Pausing %sstate %s due to overlay.\n", (currentTopStateInfo->isOverlay ? "overlay " : ""), currentTopStateInfo->GetDescriptor().c_str()); - currentTopStateInfo->gameState->OnPause(TRUE); + currentTopStateInfo->gameState->OnPause(true); // also mark the current top state as being overlay-ed - currentTopStateInfo->isOverlayed = TRUE; + currentTopStateInfo->isOverlayed = true; } LOG_INFO(LOGCAT_STATEMANAGER, "Pushing %sstate %s from swap-queue.\n", (stateInfo->isOverlay ? "overlay " : ""), stateInfo->GetDescriptor().c_str()); stateInfo->gameState->OnPush(); - TransitionIn(stateInfo, FALSE); + TransitionIn(stateInfo, false); m_states.push_back(stateInfo); m_swapQueue.pop_front(); } - m_pushQueueHasOverlay = FALSE; - m_swapQueueHasOverlay = FALSE; + m_pushQueueHasOverlay = false; + m_swapQueueHasOverlay = false; } void StateManager::ResumeStatesIfNeeded() @@ -268,13 +268,13 @@ void StateManager::ResumeStatesIfNeeded() { // then we need to resume the current top state (flagged as "from an overlay") StateInfo *stateInfo = GetTop(); - ASSERT(stateInfo->isInactive == FALSE); - ASSERT(stateInfo->isOverlayed == TRUE); + ASSERT(stateInfo->isInactive == false); + ASSERT(stateInfo->isOverlayed == true); LOG_INFO(LOGCAT_STATEMANAGER, "Resuming %sstate %s due to overlay removal.\n", (stateInfo->isOverlay ? "overlay " : ""), stateInfo->GetDescriptor().c_str()); - stateInfo->gameState->OnResume(TRUE); + stateInfo->gameState->OnResume(true); - stateInfo->isOverlayed = FALSE; + stateInfo->isOverlayed = false; return; } @@ -293,9 +293,9 @@ void StateManager::ResumeStatesIfNeeded() StateInfo *stateInfo = *i; LOG_INFO(LOGCAT_STATEMANAGER, "Resuming %sstate %s.\n", (stateInfo->isOverlay ? "overlay " : ""), stateInfo->GetDescriptor().c_str()); - stateInfo->gameState->OnResume(FALSE); + stateInfo->gameState->OnResume(false); - TransitionIn(stateInfo, TRUE); + TransitionIn(stateInfo, true); } } @@ -309,7 +309,7 @@ void StateManager::UpdateTransitions(float delta) StateInfo *stateInfo = *i; if (stateInfo->isTransitioning) { - BOOL isDone = stateInfo->gameState->OnTransition(delta, stateInfo->isTransitioningOut, stateInfo->isTransitionStarting); + bool isDone = stateInfo->gameState->OnTransition(delta, stateInfo->isTransitioningOut, stateInfo->isTransitionStarting); if (isDone) { LOG_INFO(LOGCAT_STATEMANAGER, "Transition %s %sstate %s finished.\n", (stateInfo->isTransitioningOut ? "out of" : "into"), (stateInfo->isOverlay ? "overlay " : ""), stateInfo->GetDescriptor().c_str()); @@ -326,91 +326,91 @@ void StateManager::UpdateTransitions(float delta) if (stateInfo->gameState->HasReturnValue()) { m_stateReturnValue = stateInfo->gameState->GetReturnValue(); - m_hasStateReturnValue = TRUE; + m_hasStateReturnValue = true; LOG_INFO(LOGCAT_STATEMANAGER, "Return value of %d retrieved from %s.\n", m_stateReturnValue, stateInfo->GetDescriptor().c_str()); } } else { LOG_INFO(LOGCAT_STATEMANAGER, "Pausing %sstate %s.\n", (stateInfo->isOverlay ? "overlay " : ""), stateInfo->GetDescriptor().c_str()); - stateInfo->gameState->OnPause(FALSE); + stateInfo->gameState->OnPause(false); } - stateInfo->isInactive = TRUE; + stateInfo->isInactive = true; } // done transitioning - stateInfo->isTransitioning = FALSE; - stateInfo->isTransitioningOut = FALSE; + stateInfo->isTransitioning = false; + stateInfo->isTransitioningOut = false; } - stateInfo->isTransitionStarting = FALSE; + stateInfo->isTransitionStarting = false; } } } -void StateManager::TransitionOut(StateInfo *stateInfo, BOOL forPopping) +void StateManager::TransitionOut(StateInfo *stateInfo, bool forPopping) { - stateInfo->isTransitioning = TRUE; - stateInfo->isTransitioningOut = TRUE; - stateInfo->isTransitionStarting = TRUE; + stateInfo->isTransitioning = true; + stateInfo->isTransitioningOut = true; + stateInfo->isTransitionStarting = true; stateInfo->isBeingPopped = forPopping; LOG_INFO(LOGCAT_STATEMANAGER, "Transition out of %sstate %s started.\n", (stateInfo->isOverlay ? "overlay " : ""), stateInfo->GetDescriptor().c_str()); if (forPopping) stateInfo->gameState->GetProcessManager()->RemoveAll(); else - stateInfo->gameState->GetProcessManager()->OnPause(FALSE); + stateInfo->gameState->GetProcessManager()->OnPause(false); } -void StateManager::TransitionIn(StateInfo *stateInfo, BOOL forResuming) +void StateManager::TransitionIn(StateInfo *stateInfo, bool forResuming) { - stateInfo->isInactive = FALSE; - stateInfo->isTransitioning = TRUE; - stateInfo->isTransitioningOut = FALSE; - stateInfo->isTransitionStarting = TRUE; + stateInfo->isInactive = false; + stateInfo->isTransitioning = true; + stateInfo->isTransitioningOut = false; + stateInfo->isTransitionStarting = true; LOG_INFO(LOGCAT_STATEMANAGER, "Transition into %sstate %s started.\n", (stateInfo->isOverlay ? "overlay " : ""), stateInfo->GetDescriptor().c_str()); if (forResuming) - stateInfo->gameState->GetProcessManager()->OnResume(FALSE); + stateInfo->gameState->GetProcessManager()->OnResume(false); } void StateManager::QueueForPush(StateInfo *newStateInfo) { - //ASSERT(IsTransitioning() == FALSE); - //ASSERT(m_swapQueue.empty() == TRUE); + //ASSERT(IsTransitioning() == false); + //ASSERT(m_swapQueue.empty() == true); ASSERT(newStateInfo != NULL); ASSERT(newStateInfo->gameState != NULL); - ASSERT(m_pushQueueHasOverlay == FALSE || (m_pushQueueHasOverlay == TRUE && newStateInfo->isOverlay == TRUE)); + ASSERT(m_pushQueueHasOverlay == false || (m_pushQueueHasOverlay == true && newStateInfo->isOverlay == true)); LOG_INFO(LOGCAT_STATEMANAGER, "Queueing state %s for pushing.\n", newStateInfo->GetDescriptor().c_str()); if (!newStateInfo->isOverlay) - StartTopStatesTransitioningOut(TRUE); + StartTopStatesTransitioningOut(true); m_pushQueue.push_back(newStateInfo); if (newStateInfo->isOverlay) - m_pushQueueHasOverlay = TRUE; + m_pushQueueHasOverlay = true; } -void StateManager::QueueForSwap(StateInfo *newStateInfo, BOOL swapTopNonOverlay) +void StateManager::QueueForSwap(StateInfo *newStateInfo, bool swapTopNonOverlay) { - //ASSERT(IsTransitioning() == FALSE); - //ASSERT(m_pushQueue.empty() == TRUE); + //ASSERT(IsTransitioning() == false); + //ASSERT(m_pushQueue.empty() == true); ASSERT(newStateInfo != NULL); ASSERT(newStateInfo->gameState != NULL); - ASSERT(m_swapQueueHasOverlay == FALSE || (m_swapQueueHasOverlay == TRUE && newStateInfo->isOverlay == TRUE)); + ASSERT(m_swapQueueHasOverlay == false || (m_swapQueueHasOverlay == true && newStateInfo->isOverlay == true)); LOG_INFO(LOGCAT_STATEMANAGER, "Queueing state %s for swapping with %s.\n", newStateInfo->GetDescriptor().c_str(), (swapTopNonOverlay ? "all top active states" : "only top-most active state.")); if (swapTopNonOverlay) - StartTopStatesTransitioningOut(FALSE); + StartTopStatesTransitioningOut(false); else - StartOnlyTopStateTransitioningOut(FALSE); + StartOnlyTopStateTransitioningOut(false); m_swapQueue.push_back(newStateInfo); if (newStateInfo->isOverlay) - m_swapQueueHasOverlay = TRUE; + m_swapQueueHasOverlay = true; } StateInfo* StateManager::GetTopNonOverlay() const @@ -428,7 +428,7 @@ StateInfoList::iterator StateManager::GetTopNonOverlayItor() StateInfoList::iterator result = m_states.end(); for (StateInfoList::iterator i = m_states.begin(); i != m_states.end(); ++i) { - if ((*i)->isOverlay == FALSE) + if ((*i)->isOverlay == false) result = i; } @@ -448,19 +448,19 @@ StateInfo* StateManager::GetStateInfoFor(const GameState *state) const return NULL; } -BOOL StateManager::IsTransitioning() const +bool StateManager::IsTransitioning() const { for (StateInfoList::const_iterator i = m_states.begin(); i != m_states.end(); ++i) { const StateInfo *stateInfo = *i; if (stateInfo->isTransitioning) - return TRUE; + return true; } - return FALSE; + return false; } -void StateManager::StartTopStatesTransitioningOut(BOOL pausing) +void StateManager::StartTopStatesTransitioningOut(bool pausing) { for (StateInfoList::iterator i = GetTopNonOverlayItor(); i != m_states.end(); ++i) { @@ -472,7 +472,7 @@ void StateManager::StartTopStatesTransitioningOut(BOOL pausing) } } -void StateManager::StartOnlyTopStateTransitioningOut(BOOL pausing) +void StateManager::StartOnlyTopStateTransitioningOut(bool pausing) { StateInfo *stateInfo = GetTop(); // if it's not active, then it's just been transitioned out and will be @@ -494,8 +494,8 @@ void StateManager::CleanupInactiveStates() if (IsTransitioning()) return; - BOOL cleanedUpSomething = FALSE; - BOOL cleanedUpNonOverlay = FALSE; + bool cleanedUpSomething = false; + bool cleanedUpNonOverlay = false; StateInfoList::iterator i = m_states.begin(); while (i != m_states.end()) @@ -503,9 +503,9 @@ void StateManager::CleanupInactiveStates() StateInfo *stateInfo = *i; if (stateInfo->isInactive && stateInfo->isBeingPopped) { - cleanedUpSomething = TRUE; + cleanedUpSomething = true; if (!stateInfo->isOverlay) - cleanedUpNonOverlay = TRUE; + cleanedUpNonOverlay = true; m_states.erase(i++); @@ -518,7 +518,7 @@ void StateManager::CleanupInactiveStates() } if (cleanedUpSomething && !cleanedUpNonOverlay) - m_lastCleanedStatesWereAllOverlays = TRUE; + m_lastCleanedStatesWereAllOverlays = true; } void StateManager::CheckForFinishedStates() @@ -530,7 +530,7 @@ void StateManager::CheckForFinishedStates() if (IsTransitioning()) return; - BOOL needToAlsoTransitionOutOverlays = FALSE; + bool needToAlsoTransitionOutOverlays = false; // check the top non-overlay state first to see if it's finished and // should be transitioned out @@ -538,9 +538,9 @@ void StateManager::CheckForFinishedStates() if (!topNonOverlayStateInfo->isInactive && topNonOverlayStateInfo->gameState->IsFinished()) { LOG_INFO(LOGCAT_STATEMANAGER, "State %s marked as finished.\n", topNonOverlayStateInfo->GetDescriptor().c_str()); - TransitionOut(topNonOverlayStateInfo, TRUE); + TransitionOut(topNonOverlayStateInfo, true); - needToAlsoTransitionOutOverlays = TRUE; + needToAlsoTransitionOutOverlays = true; } // now also check the overlay states (if there were any). we force them to @@ -556,7 +556,7 @@ void StateManager::CheckForFinishedStates() if (!stateInfo->isInactive && (stateInfo->gameState->IsFinished() || needToAlsoTransitionOutOverlays)) { LOG_INFO(LOGCAT_STATEMANAGER, "State %s marked as finished.\n", stateInfo->GetDescriptor().c_str()); - TransitionOut(stateInfo, TRUE); + TransitionOut(stateInfo, true); } } } diff --git a/src/states/statemanager.h b/src/states/statemanager.h index 9183e55..eec8743 100644 --- a/src/states/statemanager.h +++ b/src/states/statemanager.h @@ -30,7 +30,7 @@ public: void Pop(); void PopTopNonOverlay(); - BOOL HasState(const stl::string &name) const; + bool HasState(const stl::string &name) const; void OnAppGainFocus(); void OnAppLostFocus(); @@ -42,46 +42,46 @@ public: void OnResize(); void OnUpdate(float delta); - BOOL IsTransitioning() const; - BOOL IsEmpty() const; - BOOL IsTop(const GameState *state) const; - BOOL IsTransitioning(const GameState *state) const; + bool IsTransitioning() const; + bool IsEmpty() const; + bool IsTop(const GameState *state) const; + bool IsTransitioning(const GameState *state) const; GameState* GetTopState() const; GameState* GetTopNonOverlayState() const; int GetLastReturnValue() const { return m_stateReturnValue; } - BOOL HasLastReturnValue() const { return m_hasStateReturnValue; } + bool HasLastReturnValue() const { return m_hasStateReturnValue; } private: void QueueForPush(StateInfo *newStateInfo); - void QueueForSwap(StateInfo *newStateInfo, BOOL swapTopNonOverlay); + void QueueForSwap(StateInfo *newStateInfo, bool swapTopNonOverlay); StateInfo* GetTop() const; StateInfo* GetTopNonOverlay() const; StateInfoList::iterator GetTopNonOverlayItor(); StateInfo* GetStateInfoFor(const GameState *state) const; - void StartTopStatesTransitioningOut(BOOL pausing); - void StartOnlyTopStateTransitioningOut(BOOL pausing); + void StartTopStatesTransitioningOut(bool pausing); + void StartOnlyTopStateTransitioningOut(bool pausing); void CleanupInactiveStates(); void CheckForFinishedStates(); void ProcessQueues(); void ResumeStatesIfNeeded(); void UpdateTransitions(float delta); - void TransitionOut(StateInfo *stateInfo, BOOL forPopping); - void TransitionIn(StateInfo *stateInfo, BOOL forResuming); + void TransitionOut(StateInfo *stateInfo, bool forPopping); + void TransitionIn(StateInfo *stateInfo, bool forResuming); GameApp *m_gameApp; StateInfoList m_states; StateInfoQueue m_pushQueue; StateInfoQueue m_swapQueue; int m_stateReturnValue; - BOOL m_hasStateReturnValue; - BOOL m_pushQueueHasOverlay; - BOOL m_swapQueueHasOverlay; - BOOL m_lastCleanedStatesWereAllOverlays; + bool m_hasStateReturnValue; + bool m_pushQueueHasOverlay; + bool m_swapQueueHasOverlay; + bool m_lastCleanedStatesWereAllOverlays; }; template @@ -110,7 +110,7 @@ T* StateManager::Overlay(const stl::string &name) { T* newState = new T(m_gameApp, this); StateInfo *newStateInfo = new StateInfo(newState, name); - newStateInfo->isOverlay = TRUE; + newStateInfo->isOverlay = true; QueueForPush(newStateInfo); return newState; } @@ -127,12 +127,12 @@ T* StateManager::SwapTopWith(const stl::string &name) // figure out if the current top state is an overlay or not. use that // same setting for the new state that is to be swapped in StateInfo *currentTopStateInfo = GetTop(); - BOOL isOverlay = currentTopStateInfo->isOverlay; + bool isOverlay = currentTopStateInfo->isOverlay; T* newState = new T(m_gameApp, this); StateInfo *newStateInfo = new StateInfo(newState, name); newStateInfo->isOverlay = isOverlay; - QueueForSwap(newStateInfo, FALSE); + QueueForSwap(newStateInfo, false); return newState; } @@ -147,21 +147,21 @@ T* StateManager::SwapTopNonOverlayWith(const stl::string &name) { T *newState = new T(m_gameApp, this); StateInfo *newStateInfo = new StateInfo(newState, name); - QueueForSwap(newStateInfo, TRUE); + QueueForSwap(newStateInfo, true); return newState; } -inline BOOL StateManager::IsEmpty() const +inline bool StateManager::IsEmpty() const { return (m_states.empty() && m_pushQueue.empty() && m_swapQueue.empty()); } -inline BOOL StateManager::IsTop(const GameState *state) const +inline bool StateManager::IsTop(const GameState *state) const { return GetTop()->gameState == state; } -inline BOOL StateManager::IsTransitioning(const GameState *state) const +inline bool StateManager::IsTransitioning(const GameState *state) const { return GetStateInfoFor(state)->isTransitioning; } diff --git a/src/tilemap/chunkvertexgenerator.cpp b/src/tilemap/chunkvertexgenerator.cpp index c47e521..caeb065 100644 --- a/src/tilemap/chunkvertexgenerator.cpp +++ b/src/tilemap/chunkvertexgenerator.cpp @@ -52,7 +52,7 @@ void ChunkVertexGenerator::Generate(TileChunk *chunk, uint &numVertices, uint &n if (mesh->IsAlpha()) { if (!chunk->IsAlphaEnabled()) - chunk->EnableAlphaVertices(TRUE); + chunk->EnableAlphaVertices(true); } // "tilemap space" position that this tile is at @@ -87,54 +87,54 @@ void ChunkVertexGenerator::Generate(TileChunk *chunk, uint &numVertices, uint &n { // left face is visible if (cubeMesh->IsAlpha()) - numAlphaVertices += AddMesh(cubeMesh, chunk, TRUE, position, transform, color, cubeMesh->GetLeftFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numAlphaVertices += AddMesh(cubeMesh, chunk, true, position, transform, color, cubeMesh->GetLeftFaceVertexOffset(), CUBE_VERTICES_PER_FACE); else - numVertices += AddMesh(cubeMesh, chunk, FALSE, position, transform, color, cubeMesh->GetLeftFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numVertices += AddMesh(cubeMesh, chunk, false, position, transform, color, cubeMesh->GetLeftFaceVertexOffset(), CUBE_VERTICES_PER_FACE); } if ((right == NULL || right->tile == NO_TILE || !tileMap->GetMeshes()->Get(right)->IsOpaque(SIDE_LEFT)) && cubeMesh->HasFace(SIDE_RIGHT)) { // right face is visible if (cubeMesh->IsAlpha()) - numAlphaVertices += AddMesh(cubeMesh, chunk, TRUE, position, transform, color, cubeMesh->GetRightFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numAlphaVertices += AddMesh(cubeMesh, chunk, true, position, transform, color, cubeMesh->GetRightFaceVertexOffset(), CUBE_VERTICES_PER_FACE); else - numVertices += AddMesh(cubeMesh, chunk, FALSE, position, transform, color, cubeMesh->GetRightFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numVertices += AddMesh(cubeMesh, chunk, false, position, transform, color, cubeMesh->GetRightFaceVertexOffset(), CUBE_VERTICES_PER_FACE); } if ((forward == NULL || forward->tile == NO_TILE || !tileMap->GetMeshes()->Get(forward)->IsOpaque(SIDE_BACK)) && cubeMesh->HasFace(SIDE_FRONT)) { // front face is visible if (cubeMesh->IsAlpha()) - numAlphaVertices += AddMesh(cubeMesh, chunk, TRUE, position, transform, color, cubeMesh->GetFrontFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numAlphaVertices += AddMesh(cubeMesh, chunk, true, position, transform, color, cubeMesh->GetFrontFaceVertexOffset(), CUBE_VERTICES_PER_FACE); else - numVertices += AddMesh(cubeMesh, chunk, FALSE, position, transform, color, cubeMesh->GetFrontFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numVertices += AddMesh(cubeMesh, chunk, false, position, transform, color, cubeMesh->GetFrontFaceVertexOffset(), CUBE_VERTICES_PER_FACE); } if ((backward == NULL || backward->tile == NO_TILE || !tileMap->GetMeshes()->Get(backward)->IsOpaque(SIDE_FRONT)) && cubeMesh->HasFace(SIDE_BACK)) { // back face is visible if (cubeMesh->IsAlpha()) - numAlphaVertices += AddMesh(cubeMesh, chunk, TRUE, position, transform, color, cubeMesh->GetBackFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numAlphaVertices += AddMesh(cubeMesh, chunk, true, position, transform, color, cubeMesh->GetBackFaceVertexOffset(), CUBE_VERTICES_PER_FACE); else - numVertices += AddMesh(cubeMesh, chunk, FALSE, position, transform, color, cubeMesh->GetBackFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numVertices += AddMesh(cubeMesh, chunk, false, position, transform, color, cubeMesh->GetBackFaceVertexOffset(), CUBE_VERTICES_PER_FACE); } if ((down == NULL || down->tile == NO_TILE || !tileMap->GetMeshes()->Get(down)->IsOpaque(SIDE_TOP)) && cubeMesh->HasFace(SIDE_BOTTOM)) { // bottom face is visible if (cubeMesh->IsAlpha()) - numAlphaVertices += AddMesh(cubeMesh, chunk, TRUE, position, transform, color, cubeMesh->GetBottomFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numAlphaVertices += AddMesh(cubeMesh, chunk, true, position, transform, color, cubeMesh->GetBottomFaceVertexOffset(), CUBE_VERTICES_PER_FACE); else - numVertices += AddMesh(cubeMesh, chunk, FALSE, position, transform, color, cubeMesh->GetBottomFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numVertices += AddMesh(cubeMesh, chunk, false, position, transform, color, cubeMesh->GetBottomFaceVertexOffset(), CUBE_VERTICES_PER_FACE); } if ((up == NULL || up->tile == NO_TILE || !tileMap->GetMeshes()->Get(up)->IsOpaque(SIDE_BOTTOM)) && cubeMesh->HasFace(SIDE_TOP)) { // top face is visible if (cubeMesh->IsAlpha()) - numAlphaVertices += AddMesh(cubeMesh, chunk, TRUE, position, transform, color, cubeMesh->GetTopFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numAlphaVertices += AddMesh(cubeMesh, chunk, true, position, transform, color, cubeMesh->GetTopFaceVertexOffset(), CUBE_VERTICES_PER_FACE); else - numVertices += AddMesh(cubeMesh, chunk, FALSE, position, transform, color, cubeMesh->GetTopFaceVertexOffset(), CUBE_VERTICES_PER_FACE); + numVertices += AddMesh(cubeMesh, chunk, false, position, transform, color, cubeMesh->GetTopFaceVertexOffset(), CUBE_VERTICES_PER_FACE); } } else { - BOOL visible = FALSE; + bool visible = false; // visibility determination. we check for at least one // adjacent empty space / non-opaque tile @@ -154,14 +154,14 @@ void ChunkVertexGenerator::Generate(TileChunk *chunk, uint &numVertices, uint &n (up == NULL || up->tile == NO_TILE || !tileMap->GetMeshes()->Get(up)->IsOpaque(SIDE_BOTTOM)) || (down == NULL || down->tile == NO_TILE || !tileMap->GetMeshes()->Get(down)->IsOpaque(SIDE_TOP)) ) - visible = TRUE; + visible = true; if (visible) { if (mesh->IsAlpha()) - numAlphaVertices += AddMesh(mesh, chunk, TRUE, position, transform, color, 0, mesh->GetBuffer()->GetNumElements()); + numAlphaVertices += AddMesh(mesh, chunk, true, position, transform, color, 0, mesh->GetBuffer()->GetNumElements()); else - numVertices += AddMesh(mesh, chunk, FALSE, position, transform, color, 0, mesh->GetBuffer()->GetNumElements()); + numVertices += AddMesh(mesh, chunk, false, position, transform, color, 0, mesh->GetBuffer()->GetNumElements()); } } } @@ -169,10 +169,10 @@ void ChunkVertexGenerator::Generate(TileChunk *chunk, uint &numVertices, uint &n } if (numAlphaVertices == 0) - chunk->EnableAlphaVertices(FALSE); + chunk->EnableAlphaVertices(false); } -uint ChunkVertexGenerator::AddMesh(const TileMesh *mesh, TileChunk *chunk, BOOL isAlpha, const Point3 &position, const Matrix4x4 *transform, const Color &color, uint firstVertex, uint numVertices) +uint ChunkVertexGenerator::AddMesh(const TileMesh *mesh, TileChunk *chunk, bool isAlpha, const Point3 &position, const Matrix4x4 *transform, const Color &color, uint firstVertex, uint numVertices) { VertexBuffer *sourceBuffer = mesh->GetBuffer(); sourceBuffer->MoveToStart(); diff --git a/src/tilemap/chunkvertexgenerator.h b/src/tilemap/chunkvertexgenerator.h index 311923f..242f464 100644 --- a/src/tilemap/chunkvertexgenerator.h +++ b/src/tilemap/chunkvertexgenerator.h @@ -23,7 +23,7 @@ public: void Generate(TileChunk *chunk, uint &numVertices, uint &numAlphaVertices); private: - uint AddMesh(const TileMesh *mesh, TileChunk *chunk, BOOL isAlpha, const Point3 &position, const Matrix4x4 *transform, const Color &color, uint firstVertex, uint numVertices); + uint AddMesh(const TileMesh *mesh, TileChunk *chunk, bool isAlpha, const Point3 &position, const Matrix4x4 *transform, const Color &color, uint firstVertex, uint numVertices); virtual void CopyVertex(const TileChunk *chunk, VertexBuffer *sourceBuffer, VertexBuffer *destBuffer, const Vector3 &positionOffset, const Matrix4x4 *transform, const Color &color); }; diff --git a/src/tilemap/cubetilemesh.cpp b/src/tilemap/cubetilemesh.cpp index 9241d1a..5802ea2 100644 --- a/src/tilemap/cubetilemesh.cpp +++ b/src/tilemap/cubetilemesh.cpp @@ -9,7 +9,7 @@ #include "../framework/math/vector2.h" #include "../framework/math/vector3.h" -CubeTileMesh::CubeTileMesh(CUBE_FACES faces, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency, const Color &color) +CubeTileMesh::CubeTileMesh(CUBE_FACES faces, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color) { m_faces = faces; diff --git a/src/tilemap/cubetilemesh.h b/src/tilemap/cubetilemesh.h index de1159d..6e996e5 100644 --- a/src/tilemap/cubetilemesh.h +++ b/src/tilemap/cubetilemesh.h @@ -15,7 +15,7 @@ struct Vector3; class CubeTileMesh : public TileMesh { public: - CubeTileMesh(CUBE_FACES faces, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency = 1.0f, const Color &color = COLOR_WHITE); + CubeTileMesh(CUBE_FACES faces, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency = 1.0f, const Color &color = COLOR_WHITE); virtual ~CubeTileMesh(); VertexBuffer* GetBuffer() const { return m_vertices; } @@ -30,7 +30,7 @@ public: const Vector3* GetCollisionVertices() const { return m_collisionVertices; } CUBE_FACES GetFaces() const { return m_faces; } - BOOL HasFace(CUBE_FACES face) const { return IsBitSet(face, m_faces); } + bool HasFace(CUBE_FACES face) const { return IsBitSet(face, m_faces); } TILEMESH_TYPE GetType() const { return TILEMESH_CUBE; } diff --git a/src/tilemap/positionandskytilemaplighter.cpp b/src/tilemap/positionandskytilemaplighter.cpp index c427b7e..9441428 100644 --- a/src/tilemap/positionandskytilemaplighter.cpp +++ b/src/tilemap/positionandskytilemaplighter.cpp @@ -52,7 +52,7 @@ void PositionAndSkyTileMapLighter::SetupSkyLight(TileMap *tileMap) { for (uint z = 0; z < tileMap->GetDepth(); ++z) { - BOOL stillSkyLit = TRUE; + bool stillSkyLit = true; TILE_LIGHT_VALUE currentSkyLightValue = tileMap->GetSkyLightValue(); for (int y = tileMap->GetHeight() - 1; y >= 0 && stillSkyLit; --y) @@ -73,7 +73,7 @@ void PositionAndSkyTileMapLighter::SetupSkyLight(TileMap *tileMap) { // tile is present and is fully solid, sky lighting stops // at the tile above this one - stillSkyLit = FALSE; + stillSkyLit = false; } } } diff --git a/src/tilemap/simpletilemaplighter.cpp b/src/tilemap/simpletilemaplighter.cpp index 38c4256..1c79bc2 100644 --- a/src/tilemap/simpletilemaplighter.cpp +++ b/src/tilemap/simpletilemaplighter.cpp @@ -51,7 +51,7 @@ void SimpleTileMapLighter::ApplySkyLight(TileMap *tileMap) { for (uint z = 0; z < tileMap->GetDepth(); ++z) { - BOOL stillSkyLit = TRUE; + bool stillSkyLit = true; TILE_LIGHT_VALUE currentSkyLightValue = tileMap->GetSkyLightValue(); for (int y = tileMap->GetHeight() - 1; y >= 0 && stillSkyLit; --y) @@ -72,7 +72,7 @@ void SimpleTileMapLighter::ApplySkyLight(TileMap *tileMap) { // tile is present and is fully solid, sky lighting stops // at the tile above this one - stillSkyLit = FALSE; + stillSkyLit = false; } } } diff --git a/src/tilemap/statictilemesh.cpp b/src/tilemap/statictilemesh.cpp index 22edb55..f1f62e0 100644 --- a/src/tilemap/statictilemesh.cpp +++ b/src/tilemap/statictilemesh.cpp @@ -7,7 +7,7 @@ #include "../framework/math/mathhelpers.h" #include "../framework/math/rectf.h" -StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency, const Color &color, const StaticMesh *collisionMesh) +StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color, const StaticMesh *collisionMesh) { // only work with the first mesh subset StaticMeshSubset *subset = mesh->GetSubset(0); @@ -36,7 +36,7 @@ StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlas SetupCollisionVertices(collisionMesh); } -StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, uint numTiles, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency, const Color &color, const StaticMesh *collisionMesh) +StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, uint numTiles, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color, const StaticMesh *collisionMesh) { ASSERT(numTiles > 0); ASSERT(mesh->GetNumSubsets() >= numTiles); diff --git a/src/tilemap/statictilemesh.h b/src/tilemap/statictilemesh.h index 9fd2726..fd70897 100644 --- a/src/tilemap/statictilemesh.h +++ b/src/tilemap/statictilemesh.h @@ -15,8 +15,8 @@ struct Vector3; class StaticTileMesh : public TileMesh { public: - StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency = 1.0f, const Color &color = COLOR_WHITE, const StaticMesh *collisionMesh = NULL); - StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, uint numTiles, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency = 1.0f, const Color &color = COLOR_WHITE, const StaticMesh *collisionMesh = NULL); + StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency = 1.0f, const Color &color = COLOR_WHITE, const StaticMesh *collisionMesh = NULL); + StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, uint numTiles, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency = 1.0f, const Color &color = COLOR_WHITE, const StaticMesh *collisionMesh = NULL); virtual ~StaticTileMesh(); VertexBuffer* GetBuffer() const { return m_vertices; } diff --git a/src/tilemap/tile.h b/src/tilemap/tile.h index 90d87b4..2be8bad 100644 --- a/src/tilemap/tile.h +++ b/src/tilemap/tile.h @@ -45,11 +45,11 @@ struct Tile static float GetBrightness(TILE_LIGHT_VALUE light); static TILE_LIGHT_VALUE AdjustLightForTranslucency(TILE_LIGHT_VALUE light, float translucency); - BOOL IsEmptySpace() const; - BOOL IsCollideable() const; - BOOL HasCustomColor() const; - BOOL IsSlippery() const; - BOOL IsSkyLit() const; + bool IsEmptySpace() const; + bool IsCollideable() const; + bool HasCustomColor() const; + bool IsSlippery() const; + bool IsSkyLit() const; TILE_INDEX tile; TILE_FLAG_BITS flags; @@ -132,27 +132,27 @@ inline TILE_LIGHT_VALUE Tile::AdjustLightForTranslucency(TILE_LIGHT_VALUE light, return (TILE_LIGHT_VALUE)Round((float)light * translucency); } -inline BOOL Tile::IsEmptySpace() const +inline bool Tile::IsEmptySpace() const { return this->tile == NO_TILE; } -inline BOOL Tile::IsCollideable() const +inline bool Tile::IsCollideable() const { return IsBitSet(TILE_COLLIDABLE, this->flags); } -inline BOOL Tile::HasCustomColor() const +inline bool Tile::HasCustomColor() const { return IsBitSet(TILE_CUSTOM_COLOR, this->flags); } -inline BOOL Tile::IsSlippery() const +inline bool Tile::IsSlippery() const { return IsBitSet(TILE_FRICTION_SLIPPERY, this->flags); } -inline BOOL Tile::IsSkyLit() const +inline bool Tile::IsSkyLit() const { return IsBitSet(TILE_LIGHT_SKY, this->flags); } diff --git a/src/tilemap/tilechunk.cpp b/src/tilemap/tilechunk.cpp index f7629ba..e0f7d5f 100644 --- a/src/tilemap/tilechunk.cpp +++ b/src/tilemap/tilechunk.cpp @@ -95,12 +95,12 @@ BoundingBox TileChunk::GetBoundingBoxFor(uint x, uint y, uint z) const return box; } -BOOL TileChunk::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const +bool TileChunk::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const { // make sure that the ray and this chunk can actually collide in the first place Vector3 position; if (!IntersectionTester::Test(ray, m_bounds, &position)) - return FALSE; + return false; // convert initial chunk collision point to tile coords (this is in "tilemap space") int currentX = (int)position.x; @@ -130,7 +130,7 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) con z = currentZ; // and we're done - return TRUE; + return true; } // no collision initially, continue on with the rest ... @@ -193,8 +193,8 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) con if (isnan(tDelta.z)) tDelta.z = INFINITY; - BOOL collided = FALSE; - BOOL outOfChunk = FALSE; + bool collided = false; + bool outOfChunk = false; while (!outOfChunk) { // step up to the next tile using the lowest step value @@ -228,14 +228,14 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) con currentY < 0 || currentY >= (int)GetHeight() || currentZ < 0 || currentZ >= (int)GetDepth() ) - outOfChunk = TRUE; + outOfChunk = true; else { // still inside and at the next position, test for a solid tile Tile *tile = Get(currentX, currentY, currentZ); if (IsBitSet(TILE_COLLIDABLE, tile->flags)) { - collided = TRUE; + collided = true; // set the tile coords of the collision x = currentX; @@ -250,19 +250,19 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) con return collided; } -BOOL TileChunk::CheckForCollision(const Ray &ray, Vector3 &point, uint &x, uint &y, uint &z) const +bool TileChunk::CheckForCollision(const Ray &ray, Vector3 &point, uint &x, uint &y, uint &z) const { // if the ray doesn't collide with any solid tiles in the first place, then // we can skip this more expensive triangle collision check... if (!CheckForCollision(ray, x, y, z)) - return FALSE; + return false; // now perform the per-triangle collision check against the tile position // where the ray ended up at the end of the above CheckForCollision() call return CheckForCollisionWithTile(ray, point, x, y, z); } -BOOL TileChunk::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, uint y, uint z) const +bool TileChunk::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, uint y, uint z) const { const Tile *tile = Get(x, y, z); const TileMesh *mesh = m_tileMap->GetMeshes()->Get(tile); @@ -275,7 +275,7 @@ BOOL TileChunk::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x Vector3 tileWorldPosition = Vector3((float)x, (float)y, (float)z); float closestSquaredDistance = FLT_MAX; - BOOL collided = FALSE; + bool collided = false; Vector3 collisionPoint = ZERO_VECTOR; for (uint i = 0; i < numVertices; i += 3) @@ -292,7 +292,7 @@ BOOL TileChunk::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x if (IntersectionTester::Test(ray, a, b, c, &collisionPoint)) { - collided = TRUE; + collided = true; // if this is the closest collision yet, then keep the distance // and point of collision @@ -308,11 +308,11 @@ BOOL TileChunk::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x return collided; } -BOOL TileChunk::GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const +bool TileChunk::GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const { // make sure the given box actually intersects with this chunk in the first place if (!IntersectionTester::Test(m_bounds, box)) - return FALSE; + return false; // convert to tile coords (these will be in "tilemap space") // HACK: ceil() calls and "-1"'s keep us from picking up too many/too few @@ -343,7 +343,7 @@ BOOL TileChunk::GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, u y2 = maxY - (int)GetY(); z2 = maxZ - (int)GetZ(); - return TRUE; + return true; } Tile* TileChunk::GetWithinSelfOrNeighbour(int x, int y, int z) const @@ -365,7 +365,7 @@ Tile* TileChunk::GetWithinSelfOrNeighbourSafe(int x, int y, int z) const return m_tileMap->Get(checkX, checkY, checkZ); } -void TileChunk::EnableAlphaVertices(BOOL enable) +void TileChunk::EnableAlphaVertices(bool enable) { if (enable) { diff --git a/src/tilemap/tilechunk.h b/src/tilemap/tilechunk.h index 414d8fb..486d4fb 100644 --- a/src/tilemap/tilechunk.h +++ b/src/tilemap/tilechunk.h @@ -19,8 +19,8 @@ public: TileChunk(uint x, uint y, uint z, uint width, uint height, uint depth, const TileMap *tileMap, GraphicsDevice *graphicsDevice); virtual ~TileChunk(); - void EnableAlphaVertices(BOOL enable); - BOOL IsAlphaEnabled() const { return m_alphaVertices != NULL; } + void EnableAlphaVertices(bool enable); + bool IsAlphaEnabled() const { return m_alphaVertices != NULL; } void UpdateVertices(ChunkVertexGenerator *vertexGenerator); Tile* Get(uint x, uint y, uint z) const; @@ -30,13 +30,13 @@ public: void GetBoundingBoxFor(uint x, uint y, uint z, BoundingBox *box) const; BoundingBox GetBoundingBoxFor(uint x, uint y, uint z) const; - BOOL CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const; - BOOL CheckForCollision(const Ray &ray, Vector3 &point, uint &x, uint &y, uint &z) const; - BOOL CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, uint y, uint z) const; - BOOL GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const; + bool CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const; + bool CheckForCollision(const Ray &ray, Vector3 &point, uint &x, uint &y, uint &z) const; + bool CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, uint y, uint z) const; + bool GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const; - BOOL IsWithinBounds(int x, int y, int z) const; - BOOL IsWithinLocalBounds(int x, int y, int z) const; + bool IsWithinBounds(int x, int y, int z) const; + bool IsWithinLocalBounds(int x, int y, int z) const; uint GetX() const { return m_x; } uint GetY() const { return m_y; } @@ -93,28 +93,28 @@ inline uint TileChunk::GetIndexOf(uint x, uint y, uint z) const return (y * m_width * m_depth) + (z * m_width) + x; } -inline BOOL TileChunk::IsWithinBounds(int x, int y, int z) const +inline bool TileChunk::IsWithinBounds(int x, int y, int z) const { if (x < (int)GetX() || x >= (int)(GetX() + m_width)) - return FALSE; + return false; if (y < (int)GetY() || y >= (int)(GetY() + m_height)) - return FALSE; + return false; if (z < (int)GetZ() || z >= (int)(GetZ() + m_depth)) - return FALSE; + return false; - return TRUE; + return true; } -inline BOOL TileChunk::IsWithinLocalBounds(int x, int y, int z) const +inline bool TileChunk::IsWithinLocalBounds(int x, int y, int z) const { if (x < 0 || x >= (int)m_width) - return FALSE; + return false; if (y < 0 || y >= (int)m_height) - return FALSE; + return false; if (z < 0 || z >= (int)m_depth) - return FALSE; + return false; - return TRUE; + return true; } #endif diff --git a/src/tilemap/tilemap.cpp b/src/tilemap/tilemap.cpp index 5b3acea..fae3bf4 100644 --- a/src/tilemap/tilemap.cpp +++ b/src/tilemap/tilemap.cpp @@ -107,12 +107,12 @@ void TileMap::Clear() m_chunkDepth = 0; } -BOOL TileMap::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const +bool TileMap::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const { // make sure that the ray can actually collide with this map in the first place Vector3 position; if (!IntersectionTester::Test(ray, m_bounds, &position)) - return FALSE; + return false; // convert initial tilemap collision point to tile coords. this is in // "tilemap space" which is how we want it for the rest of this method @@ -137,7 +137,7 @@ BOOL TileMap::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const z = currentZ; // and we're done - return TRUE; + return true; } // no collision initially, continue on with the rest ... @@ -200,8 +200,8 @@ BOOL TileMap::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const if (isnan(tDelta.z)) tDelta.z = INFINITY; - BOOL collided = FALSE; - BOOL outOfMap = FALSE; + bool collided = false; + bool outOfMap = false; while (!outOfMap) { // step up to the next tile using the lowest step value @@ -235,14 +235,14 @@ BOOL TileMap::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const currentY < 0 || currentY >= (int)GetHeight() || currentZ < 0 || currentZ >= (int)GetDepth() ) - outOfMap = TRUE; + outOfMap = true; else { // still inside and at the next position, test for a solid tile Tile *tile = Get(currentX, currentY, currentZ); if (IsBitSet(TILE_COLLIDABLE, tile->flags)) { - collided = TRUE; + collided = true; // set the tile coords of the collision x = currentX; @@ -257,19 +257,19 @@ BOOL TileMap::CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const return collided; } -BOOL TileMap::CheckForCollision(const Ray &ray, Vector3 &point, uint &x, uint &y, uint &z) const +bool TileMap::CheckForCollision(const Ray &ray, Vector3 &point, uint &x, uint &y, uint &z) const { // if the ray doesn't collide with any solid tiles in the first place, then // we can skip this more expensive triangle collision check... if (!CheckForCollision(ray, x, y, z)) - return FALSE; + return false; // now perform the per-triangle collision check against the tile position // where the ray ended up at the end of the above CheckForCollision() call return CheckForCollisionWithTile(ray, point, x, y, z); } -BOOL TileMap::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, uint y, uint z) const +bool TileMap::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, uint y, uint z) const { const Tile *tile = Get(x, y, z); const TileMesh *mesh = m_tileMeshes->Get(tile); @@ -282,7 +282,7 @@ BOOL TileMap::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, Vector3 tileWorldPosition = Vector3((float)x, (float)y, (float)z); float closestSquaredDistance = FLT_MAX; - BOOL collided = FALSE; + bool collided = false; Vector3 collisionPoint = ZERO_VECTOR; for (uint i = 0; i < numVertices; i += 3) @@ -299,7 +299,7 @@ BOOL TileMap::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, if (IntersectionTester::Test(ray, a, b, c, &collisionPoint)) { - collided = TRUE; + collided = true; // if this is the closest collision yet, then keep the distance // and point of collision @@ -315,11 +315,11 @@ BOOL TileMap::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, return collided; } -BOOL TileMap::GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const +bool TileMap::GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const { // make sure the given box actually intersects with the map in the first place if (!IntersectionTester::Test(m_bounds, box)) - return FALSE; + return false; // convert to tile coords. this is in "tilemap space" which is how we want it // HACK: ceil() calls and "-1"'s keep us from picking up too many/too few @@ -350,14 +350,14 @@ BOOL TileMap::GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uin y2 = maxY; z2 = maxZ; - return TRUE; + return true; } -BOOL TileMap::GetOverlappedChunks(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const +bool TileMap::GetOverlappedChunks(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const { // make sure the given box actually intersects with the map in the first place if (!IntersectionTester::Test(m_bounds, box)) - return FALSE; + return false; // convert to tile coords. this is in "tilemap space" which is how we want it // HACK: ceil() calls and "-1"'s keep us from picking up too many/too few @@ -396,7 +396,7 @@ BOOL TileMap::GetOverlappedChunks(const BoundingBox &box, uint &x1, uint &y1, ui y2 = maxChunkY; z2 = maxChunkZ; - return TRUE; + return true; } void TileMap::UpdateVertices() diff --git a/src/tilemap/tilemap.h b/src/tilemap/tilemap.h index 725542e..bc4c064 100644 --- a/src/tilemap/tilemap.h +++ b/src/tilemap/tilemap.h @@ -43,18 +43,18 @@ public: void GetBoundingBoxFor(uint x, uint y, uint z, BoundingBox *box) const; BoundingBox GetBoundingBoxFor(uint x, uint y, uint z) const; - BOOL CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const; - BOOL CheckForCollision(const Ray &ray, Vector3 &point, uint &x, uint &y, uint &z) const; - BOOL CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, uint y, uint z) const; - BOOL GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const; - BOOL GetOverlappedChunks(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const; + bool CheckForCollision(const Ray &ray, uint &x, uint &y, uint &z) const; + bool CheckForCollision(const Ray &ray, Vector3 &point, uint &x, uint &y, uint &z) const; + bool CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint x, uint y, uint z) const; + bool GetOverlappedTiles(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const; + bool GetOverlappedChunks(const BoundingBox &box, uint &x1, uint &y1, uint &z1, uint &x2, uint &y2, uint &z2) const; void UpdateChunkVertices(uint chunkX, uint chunkY, uint chunkZ); void UpdateVertices(); void UpdateLighting(); - BOOL IsWithinBounds(int x, int y, int z) const; + bool IsWithinBounds(int x, int y, int z) const; uint GetWidth() const { return m_widthInChunks * m_chunkWidth; } uint GetHeight() const { return m_heightInChunks * m_chunkHeight; } @@ -197,16 +197,16 @@ inline uint TileMap::GetChunkIndex(uint chunkX, uint chunkY, uint chunkZ) const return (chunkY * m_widthInChunks * m_depthInChunks) + (chunkZ * m_widthInChunks) + chunkX; } -inline BOOL TileMap::IsWithinBounds(int x, int y, int z) const +inline bool TileMap::IsWithinBounds(int x, int y, int z) const { if (x < 0 || x >= (int)GetWidth()) - return FALSE; + return false; if (y < 0 || y >= (int)GetHeight()) - return FALSE; + return false; if (z < 0 || z >= (int)GetDepth()) - return FALSE; + return false; - return TRUE; + return true; } #endif diff --git a/src/tilemap/tilemaprenderer.cpp b/src/tilemap/tilemaprenderer.cpp index dfa107c..9101944 100644 --- a/src/tilemap/tilemaprenderer.cpp +++ b/src/tilemap/tilemaprenderer.cpp @@ -41,7 +41,7 @@ void TileMapRenderer::Render(const TileMap *tileMap, Shader *shader) } else { - ASSERT(shader->IsReadyForUse() == TRUE); + ASSERT(shader->IsReadyForUse() == true); m_graphicsDevice->BindShader(shader); } @@ -77,7 +77,7 @@ void TileMapRenderer::RenderAlpha(const TileMap *tileMap, Shader *shader) } else { - ASSERT(shader->IsReadyForUse() == TRUE); + ASSERT(shader->IsReadyForUse() == true); m_graphicsDevice->BindShader(shader); } diff --git a/src/tilemap/tilemesh.h b/src/tilemap/tilemesh.h index b6c3df7..dffb40e 100644 --- a/src/tilemap/tilemesh.h +++ b/src/tilemap/tilemesh.h @@ -29,24 +29,24 @@ public: virtual TILEMESH_TYPE GetType() const = 0; - BOOL IsCompletelyOpaque() const { return m_opaqueSides == SIDE_ALL; } - BOOL IsOpaque(MESH_SIDES sides) const { return IsBitSet(sides, m_opaqueSides); } - BOOL IsAlpha() const { return m_alpha; } + bool IsCompletelyOpaque() const { return m_opaqueSides == SIDE_ALL; } + bool IsOpaque(MESH_SIDES sides) const { return IsBitSet(sides, m_opaqueSides); } + bool IsAlpha() const { return m_alpha; } const Color& GetColor() const { return m_color; } float GetTranslucency() const { return m_translucency; } - BOOL IsLightSource() const { return m_lightValue > 0; } + bool IsLightSource() const { return m_lightValue > 0; } TILE_LIGHT_VALUE GetLightValue() const { return m_lightValue; } protected: void SetOpaque(MESH_SIDES sides) { m_opaqueSides = sides; } - void SetAlpha(BOOL alpha) { m_alpha = alpha; } + void SetAlpha(bool alpha) { m_alpha = alpha; } void SetColor(const Color &color) { m_color = color; } void SetTranslucency(float translucency) { m_translucency = translucency; } void SetLight(TILE_LIGHT_VALUE lightValue) { m_lightValue = lightValue; } private: MESH_SIDES m_opaqueSides; - BOOL m_alpha; + bool m_alpha; Color m_color; float m_translucency; TILE_LIGHT_VALUE m_lightValue; diff --git a/src/tilemap/tilemeshcollection.cpp b/src/tilemap/tilemeshcollection.cpp index 811a71f..4d229a8 100644 --- a/src/tilemap/tilemeshcollection.cpp +++ b/src/tilemap/tilemeshcollection.cpp @@ -29,12 +29,12 @@ TileMeshCollection::~TileMeshCollection() } } -uint TileMeshCollection::Add(const StaticMesh *mesh, uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency, const Color &color) +uint TileMeshCollection::Add(const StaticMesh *mesh, uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color) { return Add(mesh, (StaticMesh*)NULL, textureIndex, opaqueSides, lightValue, alpha, translucency, color); } -uint TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency, const Color &color) +uint TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color) { StaticTileMesh *tileMesh = new StaticTileMesh(mesh, &m_textureAtlas->GetTile(textureIndex).texCoords, opaqueSides, lightValue, alpha, translucency, color, collisionMesh); ASSERT(tileMesh != NULL); @@ -42,12 +42,12 @@ uint TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *collision return AddMesh(tileMesh); } -uint TileMeshCollection::Add(const StaticMesh *mesh, uint *textureIndexes, uint numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency, const Color &color) +uint TileMeshCollection::Add(const StaticMesh *mesh, uint *textureIndexes, uint numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color) { return Add(mesh, (StaticMesh*)NULL, textureIndexes, numIndexes, opaqueSides, lightValue, alpha, translucency, color); } -uint TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint *textureIndexes, uint numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency, const Color &color) +uint TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint *textureIndexes, uint numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color) { ASSERT(numIndexes > 0); RectF *tileBoundaries = new RectF[numIndexes]; @@ -64,7 +64,7 @@ uint TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *collision return AddMesh(tileMesh); } -uint TileMeshCollection::AddCube(uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, BOOL alpha, float translucency, const Color &color) +uint TileMeshCollection::AddCube(uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue, bool alpha, float translucency, const Color &color) { CubeTileMesh *tileMesh = new CubeTileMesh(SIDE_ALL, &m_textureAtlas->GetTile(textureIndex).texCoords, opaqueSides, lightValue, alpha, translucency, color); ASSERT(tileMesh != NULL); diff --git a/src/tilemap/tilemeshcollection.h b/src/tilemap/tilemeshcollection.h index 5360ffc..87fd404 100644 --- a/src/tilemap/tilemeshcollection.h +++ b/src/tilemap/tilemeshcollection.h @@ -22,11 +22,11 @@ public: const TextureAtlas* GetTextureAtlas() const { return m_textureAtlas; } - uint Add(const StaticMesh *mesh, uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); - uint Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); - uint Add(const StaticMesh *mesh, uint *textureIndexes, uint numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); - uint Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint *textureIndexes, uint numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); - uint AddCube(uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); + uint Add(const StaticMesh *mesh, uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, bool alpha = false, float translucency = 1.0f, const Color &color = COLOR_WHITE); + uint Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, bool alpha = false, float translucency = 1.0f, const Color &color = COLOR_WHITE); + uint Add(const StaticMesh *mesh, uint *textureIndexes, uint numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, bool alpha = false, float translucency = 1.0f, const Color &color = COLOR_WHITE); + uint Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint *textureIndexes, uint numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, bool alpha = false, float translucency = 1.0f, const Color &color = COLOR_WHITE); + uint AddCube(uint textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, bool alpha = false, float translucency = 1.0f, const Color &color = COLOR_WHITE); TileMesh* Get(const Tile *tile) const { return m_meshes[tile->tile]; } TileMesh* Get(uint index) const { return m_meshes[index]; }