diff --git a/src/contexts/contentcache.h b/src/contexts/contentcache.h index a9d8787..5cf10e8 100644 --- a/src/contexts/contentcache.h +++ b/src/contexts/contentcache.h @@ -25,7 +25,7 @@ public: SpriteFont* GetFont() const { return m_standardFont; } SpriteFont* GetUIFont() const { return m_uiFont; } const stl::string& GetUIFontFilename() const { return m_uiFontFilename; } - uint8_t GetUIFontSize() const { return m_uiFontSize; } + uint GetUIFontSize() const { return m_uiFontSize; } private: ContentManager *m_contentManager; @@ -36,7 +36,7 @@ private: SpriteFont *m_standardFont; SpriteFont *m_uiFont; stl::string m_uiFontFilename; - uint8_t m_uiFontSize; + uint m_uiFontSize; }; #endif diff --git a/src/contexts/rendercontext.cpp b/src/contexts/rendercontext.cpp index cddb422..4e5810f 100644 --- a/src/contexts/rendercontext.cpp +++ b/src/contexts/rendercontext.cpp @@ -68,8 +68,8 @@ void RenderContext::OnResize() void RenderContext::CalculateScreenScale() { - uint16_t width = m_graphicsDevice->GetViewContext()->GetViewportWidth(); - uint16_t height = m_graphicsDevice->GetViewContext()->GetViewportHeight(); + uint width = m_graphicsDevice->GetViewContext()->GetViewportWidth(); + uint height = m_graphicsDevice->GetViewContext()->GetViewportHeight(); // TODO: these values may need adjusting diff --git a/src/contexts/rendercontext.h b/src/contexts/rendercontext.h index 11ef0d0..6751a81 100644 --- a/src/contexts/rendercontext.h +++ b/src/contexts/rendercontext.h @@ -32,7 +32,7 @@ public: SkeletalMeshRenderer* GetSkeletalMeshRenderer() const { return m_skeletalMeshRenderer; } StaticMeshRenderer* GetStaticMeshRenderer() const { return m_staticMeshRenderer; } - uint32_t GetScreenScale() const { return m_screenScale; } + uint GetScreenScale() const { return m_screenScale; } private: void CalculateScreenScale(); @@ -45,7 +45,7 @@ private: SkeletalMeshRenderer *m_skeletalMeshRenderer; StaticMeshRenderer *m_staticMeshRenderer; - uint32_t m_screenScale; + uint m_screenScale; }; #endif diff --git a/src/effects/dimeffect.cpp b/src/effects/dimeffect.cpp index 0807629..792ae61 100644 --- a/src/effects/dimeffect.cpp +++ b/src/effects/dimeffect.cpp @@ -20,8 +20,8 @@ DimEffect::~DimEffect() void DimEffect::OnRender(RenderContext *renderContext) { - uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); - uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); + uint width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); + uint height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); m_color.a = m_alpha; renderContext->GetSpriteBatch()->Render( diff --git a/src/effects/effectmanager.h b/src/effects/effectmanager.h index 616f37e..abff7fa 100644 --- a/src/effects/effectmanager.h +++ b/src/effects/effectmanager.h @@ -41,8 +41,8 @@ private: void Remove(EffectListItor itor); EffectList m_effects; - uint32_t m_numLocalEffects; - uint32_t m_numGlobalEffects; + uint m_numLocalEffects; + uint m_numGlobalEffects; }; template diff --git a/src/effects/fadeeffect.cpp b/src/effects/fadeeffect.cpp index 3580190..5d78a55 100644 --- a/src/effects/fadeeffect.cpp +++ b/src/effects/fadeeffect.cpp @@ -25,8 +25,8 @@ FadeEffect::~FadeEffect() void FadeEffect::OnRender(RenderContext *renderContext) { - uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); - uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); + uint width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); + uint height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); m_color.a = m_alpha; renderContext->GetSpriteBatch()->Render( diff --git a/src/effects/flasheffect.cpp b/src/effects/flasheffect.cpp index 43051de..2f1d2e9 100644 --- a/src/effects/flasheffect.cpp +++ b/src/effects/flasheffect.cpp @@ -25,8 +25,8 @@ FlashEffect::~FlashEffect() void FlashEffect::OnRender(RenderContext *renderContext) { - uint16_t width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); - uint16_t height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); + uint width = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); + uint height = renderContext->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); m_color.a = m_alpha; renderContext->GetSpriteBatch()->Render( diff --git a/src/entities/entitymanager.h b/src/entities/entitymanager.h index b511589..31e5f87 100644 --- a/src/entities/entitymanager.h +++ b/src/entities/entitymanager.h @@ -52,7 +52,7 @@ public: void Remove(Entity *entity); void RemoveAll(); BOOL IsValid(const Entity *entity) const; - uint32_t GetNumEntities() const { return m_entities.size(); } + uint GetNumEntities() const { return m_entities.size(); } template T* AddComponent(Entity *entity); template T* GetComponent(const Entity *entity) const; diff --git a/src/events/eventmanager.cpp b/src/events/eventmanager.cpp index 4460657..e8ee8d1 100644 --- a/src/events/eventmanager.cpp +++ b/src/events/eventmanager.cpp @@ -175,7 +175,7 @@ BOOL EventManager::ProcessQueue() EventListenerMap::const_iterator wildcardItor = m_registry.find(EVENT_TYPE_WILDCARD); // swap active queues and empty the new queue - int queueToProcess = m_activeQueue; + uint queueToProcess = m_activeQueue; m_activeQueue = (m_activeQueue + 1) % NUM_EVENT_QUEUES; m_queues[m_activeQueue].clear(); diff --git a/src/events/eventmanager.h b/src/events/eventmanager.h index 3b1c734..f0c701e 100644 --- a/src/events/eventmanager.h +++ b/src/events/eventmanager.h @@ -51,7 +51,7 @@ private: EventTypeSet m_typeList; EventListenerMap m_registry; EventQueue m_queues[NUM_EVENT_QUEUES]; - int m_activeQueue; + uint m_activeQueue; }; template diff --git a/src/framework/assets/animation/joint.h b/src/framework/assets/animation/joint.h index 760258d..0aaa03f 100644 --- a/src/framework/assets/animation/joint.h +++ b/src/framework/assets/animation/joint.h @@ -6,7 +6,7 @@ #include "../../math/matrix4x4.h" #include -const int32_t NO_JOINT = -1; +const int NO_JOINT = -1; struct Joint { @@ -15,7 +15,7 @@ struct Joint stl::string name; Joint *parent; - int32_t parentIndex; + int parentIndex; Matrix4x4 relative; Matrix4x4 absolute; JointKeyFrame *frames; diff --git a/src/framework/assets/animation/jointvertexmapping.h b/src/framework/assets/animation/jointvertexmapping.h index f7257fb..7fd3cc2 100644 --- a/src/framework/assets/animation/jointvertexmapping.h +++ b/src/framework/assets/animation/jointvertexmapping.h @@ -5,7 +5,7 @@ struct JointVertexMapping { - int32_t jointIndex; + int jointIndex; float weight; }; diff --git a/src/framework/assets/animation/keyframe.cpp b/src/framework/assets/animation/keyframe.cpp index e859340..c921af9 100644 --- a/src/framework/assets/animation/keyframe.cpp +++ b/src/framework/assets/animation/keyframe.cpp @@ -4,18 +4,18 @@ #include "../../math/vector3.h" -Keyframe::Keyframe(uint32_t numVertices) +Keyframe::Keyframe(uint numVertices) { AllocateMemory(numVertices); } -Keyframe::Keyframe(const stl::string &name, uint32_t numVertices) +Keyframe::Keyframe(const stl::string &name, uint numVertices) { m_name = name; AllocateMemory(numVertices); } -void Keyframe::AllocateMemory(uint32_t numVertices) +void Keyframe::AllocateMemory(uint numVertices) { m_numVertices = numVertices; m_vertices = new Vector3[m_numVertices]; diff --git a/src/framework/assets/animation/keyframe.h b/src/framework/assets/animation/keyframe.h index 3ca5541..73531e6 100644 --- a/src/framework/assets/animation/keyframe.h +++ b/src/framework/assets/animation/keyframe.h @@ -16,14 +16,14 @@ public: * Creates a new keyframe. * @param numVertices the number of vertices in this keyframe */ - Keyframe(uint32_t numVertices); + Keyframe(uint numVertices); /** * Creates a new keyframe. * @param name the unique name for this keyframe * @param numVertices the number of vertices in this keyframe */ - Keyframe(const stl::string &name, uint32_t numVertices); + Keyframe(const stl::string &name, uint numVertices); virtual ~Keyframe(); @@ -35,7 +35,7 @@ public: /** * @return the number of vertices in this keyframe */ - uint32_t GetNumVertices() const { return m_numVertices; } + uint GetNumVertices() const { return m_numVertices; } /** * @return pointer to the vertices in this keyframe @@ -48,10 +48,10 @@ public: Vector3* GetNormals() { return m_normals; } private: - void AllocateMemory(uint32_t numVertices); + void AllocateMemory(uint numVertices); stl::string m_name; - uint32_t m_numVertices; + uint m_numVertices; Vector3 *m_vertices; Vector3 *m_normals; }; diff --git a/src/framework/assets/animation/keyframemesh.cpp b/src/framework/assets/animation/keyframemesh.cpp index 5375085..dc28c91 100644 --- a/src/framework/assets/animation/keyframemesh.cpp +++ b/src/framework/assets/animation/keyframemesh.cpp @@ -16,10 +16,10 @@ KeyframeMesh::KeyframeMesh(const KeyframeMeshFile *file) m_numFrames = file->GetNumFrames(); m_frames = new Keyframe*[m_numFrames]; ASSERT(m_frames != NULL); - for (uint32_t i = 0; i < m_numFrames; ++i) + for (uint i = 0; i < m_numFrames; ++i) { Keyframe *srcFrame = file->GetFrames()[i]; - uint32_t numVertices = srcFrame->GetNumVertices(); + uint numVertices = srcFrame->GetNumVertices(); Keyframe *frame = new Keyframe(srcFrame->GetName(), numVertices); ASSERT(frame != NULL); @@ -66,7 +66,7 @@ KeyframeMesh::KeyframeMesh(const KeyframeMeshFile *file) KeyframeMesh::~KeyframeMesh() { - for (uint32_t i = 0; i < m_numFrames; ++i) + for (uint i = 0; i < m_numFrames; ++i) SAFE_DELETE(m_frames[i]); SAFE_DELETE_ARRAY(m_frames); SAFE_DELETE_ARRAY(m_texCoords); diff --git a/src/framework/assets/animation/keyframemesh.h b/src/framework/assets/animation/keyframemesh.h index 181e3c2..3f76fa1 100644 --- a/src/framework/assets/animation/keyframemesh.h +++ b/src/framework/assets/animation/keyframemesh.h @@ -33,7 +33,7 @@ public: /** * @return the total number of keyframes contained in this mesh */ - uint32_t GetNumFrames() const { return m_numFrames; } + uint GetNumFrames() const { return m_numFrames; } /** * @return pointer to the mesh's keyframes @@ -43,7 +43,7 @@ public: /** * @return the total number of texture coordinates contained in this mesh */ - uint32_t GetNumTexCoords() const { return m_numTexCoords; } + uint GetNumTexCoords() const { return m_numTexCoords; } /** * @return pointer to the mesh's texture coordinates @@ -53,7 +53,7 @@ public: /** * @return the total number of triangles contained in this mesh */ - uint32_t GetNumTriangles() const { return m_numTriangles; } + uint GetNumTriangles() const { return m_numTriangles; } /** * @return pointer to the mesh's triangles @@ -63,7 +63,7 @@ public: /** * @return the number of vertices per keyframe in this mesh */ - uint32_t GetNumVerticesPerFrame() const { return m_numVerticesPerFrame; } + uint GetNumVerticesPerFrame() const { return m_numVerticesPerFrame; } /** * Retrieves an animation sequence. @@ -83,14 +83,14 @@ public: VertexBuffer* GetVertices() const { return m_vertices; } private: - uint32_t m_numFrames; + uint m_numFrames; Keyframe **m_frames; - uint32_t m_numTexCoords; + uint m_numTexCoords; Vector2 *m_texCoords; - uint32_t m_numTriangles; + uint m_numTriangles; KeyframeMeshTriangle *m_triangles; AnimationList m_animations; - uint32_t m_numVerticesPerFrame; + uint m_numVerticesPerFrame; VertexBuffer *m_vertices; }; diff --git a/src/framework/assets/animation/keyframemeshfile.cpp b/src/framework/assets/animation/keyframemeshfile.cpp index 9d1c1c8..97161d0 100644 --- a/src/framework/assets/animation/keyframemeshfile.cpp +++ b/src/framework/assets/animation/keyframemeshfile.cpp @@ -25,7 +25,7 @@ KeyframeMeshFile::KeyframeMeshFile(File *file) KeyframeMeshFile::~KeyframeMeshFile() { - for (uint32_t i = 0; i < m_numFrames; ++i) + for (uint i = 0; i < m_numFrames; ++i) SAFE_DELETE(m_frames[i]); SAFE_DELETE_ARRAY(m_frames); SAFE_DELETE_ARRAY(m_texCoords); @@ -48,10 +48,10 @@ void KeyframeMeshFile::Load() // keyframes file->Seek(keyframesDesc->start, FILESEEK_BEGINNING); m_numFrames = file->ReadInt(); - uint32_t numVertices = file->ReadInt(); + uint numVertices = file->ReadInt(); m_frames = new Keyframe*[m_numFrames]; ASSERT(m_frames != NULL); - for (uint32_t i = 0; i < m_numFrames; ++i) + for (uint i = 0; i < m_numFrames; ++i) { Keyframe *frame = new Keyframe(numVertices); ASSERT(frame != NULL); @@ -59,7 +59,7 @@ void KeyframeMeshFile::Load() Vector3 *normals = frame->GetNormals(); // vertices - for (uint32_t j = 0; j < numVertices; ++j) + for (uint j = 0; j < numVertices; ++j) { vertices[j].x = file->ReadFloat(); vertices[j].y = file->ReadFloat(); @@ -67,7 +67,7 @@ void KeyframeMeshFile::Load() } // normals - for (uint32_t j = 0; j < numVertices; ++j) + for (uint j = 0; j < numVertices; ++j) { normals[j].x = file->ReadFloat(); normals[j].y = file->ReadFloat(); @@ -82,7 +82,7 @@ void KeyframeMeshFile::Load() m_numTexCoords = file->ReadInt(); m_texCoords = new Vector2[m_numTexCoords]; ASSERT(m_texCoords != NULL); - for (uint32_t i = 0; i < m_numTexCoords; ++i) + for (uint i = 0; i < m_numTexCoords; ++i) { m_texCoords[i].x = file->ReadFloat(); m_texCoords[i].y = file->ReadFloat(); @@ -93,7 +93,7 @@ void KeyframeMeshFile::Load() m_numTriangles = file->ReadInt(); m_triangles = new KeyframeMeshTriangle[m_numTriangles]; ASSERT(m_triangles != NULL); - for (uint32_t i = 0; i < m_numTriangles; ++i) + for (uint i = 0; i < m_numTriangles; ++i) { m_triangles[i].vertices[0] = file->ReadInt(); m_triangles[i].vertices[1] = file->ReadInt(); @@ -111,8 +111,8 @@ void KeyframeMeshFile::Load() if (animationsDesc != NULL) { file->Seek(animationsDesc->start, FILESEEK_BEGINNING); - uint32_t numAnimations = file->ReadInt(); - for (uint32_t i = 0; i < numAnimations; ++i) + uint numAnimations = file->ReadInt(); + for (uint i = 0; i < numAnimations; ++i) { AnimationSequence sequence; stl::string name; diff --git a/src/framework/assets/animation/keyframemeshfile.h b/src/framework/assets/animation/keyframemeshfile.h index 082600d..e94f433 100644 --- a/src/framework/assets/animation/keyframemeshfile.h +++ b/src/framework/assets/animation/keyframemeshfile.h @@ -29,7 +29,7 @@ public: /** * @return the total number of keyframes this mesh contains */ - uint32_t GetNumFrames() const { return m_numFrames; } + uint GetNumFrames() const { return m_numFrames; } /** * @return pointer to the mesh's keyframes @@ -39,7 +39,7 @@ public: /** * @return the total number of texture coordinates this mesh contains */ - uint32_t GetNumTexCoords() const { return m_numTexCoords; } + uint GetNumTexCoords() const { return m_numTexCoords; } /** * @return pointer to the mesh's texture coordinates @@ -49,7 +49,7 @@ public: /** * @return the total number of triangles this mesh contains */ - uint32_t GetNumTriangles() const { return m_numTriangles; } + uint GetNumTriangles() const { return m_numTriangles; } /** * @return pointer to the mesh's triangles @@ -64,19 +64,19 @@ public: /** * @return the number of vertices each keyframe contains */ - uint32_t GetNumVerticesPerFrame() const { return m_numVerticesPerFrame; } + uint GetNumVerticesPerFrame() const { return m_numVerticesPerFrame; } private: void Load(); - uint32_t m_numFrames; + uint m_numFrames; Keyframe **m_frames; - uint32_t m_numTexCoords; + uint m_numTexCoords; Vector2 *m_texCoords; - uint32_t m_numTriangles; + uint m_numTriangles; KeyframeMeshTriangle *m_triangles; AnimationList m_animations; - uint32_t m_numVerticesPerFrame; + uint m_numVerticesPerFrame; }; #endif diff --git a/src/framework/assets/animation/keyframemeshinstance.cpp b/src/framework/assets/animation/keyframemeshinstance.cpp index 818c3d4..2d049ac 100644 --- a/src/framework/assets/animation/keyframemeshinstance.cpp +++ b/src/framework/assets/animation/keyframemeshinstance.cpp @@ -71,7 +71,7 @@ void KeyframeMeshInstance::OnUpdate(float delta) } } -void KeyframeMeshInstance::SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop) +void KeyframeMeshInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop) { m_currentSequenceName.clear(); m_currentSequenceStart = startFrame; diff --git a/src/framework/assets/animation/keyframemeshinstance.h b/src/framework/assets/animation/keyframemeshinstance.h index 48aec1f..2dea075 100644 --- a/src/framework/assets/animation/keyframemeshinstance.h +++ b/src/framework/assets/animation/keyframemeshinstance.h @@ -36,7 +36,7 @@ public: * @param loop TRUE to loop the sequence, FALSE to stop when done * and leave the current frame as the end frame */ - void SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop); + void SetSequence(uint startFrame, uint endFrame, BOOL loop); /** * Sets the current animation sequence. @@ -57,12 +57,12 @@ public: /** * @return the current frame */ - uint32_t GetCurrentFrame() const { return m_thisFrame; } + uint GetCurrentFrame() const { return m_thisFrame; } /** * @return the next frame */ - uint32_t GetNextFrame() const { return m_nextFrame; } + uint GetNextFrame() const { return m_nextFrame; } /** * @return the current interpolation amount between the current frame @@ -97,11 +97,11 @@ private: Texture *m_texture; RenderState *m_renderState; stl::string m_currentSequenceName; - uint32_t m_currentSequenceStart; - uint32_t m_currentSequenceEnd; + uint m_currentSequenceStart; + uint m_currentSequenceEnd; BOOL m_currentSequenceLoop; - uint32_t m_thisFrame; - uint32_t m_nextFrame; + uint m_thisFrame; + uint m_nextFrame; float m_interpolation; BOOL m_isRunningTempSequence; stl::string m_oldSequenceName; diff --git a/src/framework/assets/animation/keyframemeshrenderer.cpp b/src/framework/assets/animation/keyframemeshrenderer.cpp index 7b8e760..22abcb9 100644 --- a/src/framework/assets/animation/keyframemeshrenderer.cpp +++ b/src/framework/assets/animation/keyframemeshrenderer.cpp @@ -28,14 +28,14 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshIn Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), instance->GetCurrentFrame(), instance->GetNextFrame(), instance->GetInterpolation(), shader); } -void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t frame, VertexLerpShader *shader) +void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint frame, VertexLerpShader *shader) { ASSERT(shader->IsBound() == TRUE); instance->GetRenderState()->Apply(); Render(graphicsDevice, instance->GetMesh(), instance->GetTexture(), frame, shader); } -void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader) +void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader) { ASSERT(shader->IsBound() == TRUE); instance->GetRenderState()->Apply(); @@ -48,7 +48,7 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh * Render(graphicsDevice, mesh, texture, 0, shader); } -void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t frame, VertexLerpShader *shader) +void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint frame, VertexLerpShader *shader) { ASSERT(shader->IsBound() == TRUE); SetFrameVertices(mesh, frame); @@ -63,7 +63,7 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh * graphicsDevice->UnbindVertexBuffer(); } -void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader) +void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader) { ASSERT(shader->IsBound() == TRUE); SetFrameVertices(mesh, startFrame, endFrame); @@ -78,14 +78,14 @@ void KeyframeMeshRenderer::Render(GraphicsDevice *graphicsDevice, KeyframeMesh * graphicsDevice->UnbindVertexBuffer(); } -void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t frame) +void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint frame) { - int pos; + uint pos; Keyframe *keyframe = mesh->GetFrames()[frame]; KeyframeMeshTriangle *triangle; VertexBuffer *vertices = mesh->GetVertices(); - for (uint32_t i = 0; i < mesh->GetNumTriangles(); ++i) + for (uint i = 0; i < mesh->GetNumTriangles(); ++i) { pos = i * 3; triangle = &mesh->GetTriangles()[i]; @@ -110,15 +110,15 @@ void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t frame) } } -void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint32_t startFrame, uint32_t endFrame) +void KeyframeMeshRenderer::SetFrameVertices(KeyframeMesh *mesh, uint startFrame, uint endFrame) { - uint32_t pos; + uint pos; Keyframe *frame1 = mesh->GetFrames()[startFrame]; Keyframe *frame2 = mesh->GetFrames()[endFrame]; KeyframeMeshTriangle *triangle; VertexBuffer *vertices = mesh->GetVertices(); - for (uint32_t i = 0; i < mesh->GetNumTriangles(); ++i) + for (uint i = 0; i < mesh->GetNumTriangles(); ++i) { pos = i * 3; triangle = &mesh->GetTriangles()[i]; diff --git a/src/framework/assets/animation/keyframemeshrenderer.h b/src/framework/assets/animation/keyframemeshrenderer.h index 415a044..9fa1ea0 100644 --- a/src/framework/assets/animation/keyframemeshrenderer.h +++ b/src/framework/assets/animation/keyframemeshrenderer.h @@ -36,7 +36,7 @@ public: * @param instance the keyframe mesh instance to render * @param frame render this frame instead of the instance's current frame */ - void Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t frame, VertexLerpShader *shader); + void Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint frame, VertexLerpShader *shader); /** * Renders an instance of a keyframe mesh. @@ -49,7 +49,7 @@ public: * @param interpolation the amount to interpolate between the start frame * and end frame */ - void Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader); + void Render(GraphicsDevice *graphicsDevice, KeyframeMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader); /** * Renders a keyframe mesh using the first frame. @@ -66,7 +66,7 @@ public: * @param texture the texture to render the mesh with, or NULL for no texture * @param frame the keyframe to render */ - void Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t frame, VertexLerpShader *shader); + void Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint frame, VertexLerpShader *shader); /** * Renders a keyframe mesh. @@ -78,11 +78,11 @@ public: * @param interpolation the amount to interpolate by between the start * and end frame */ - void Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexLerpShader *shader); + void Render(GraphicsDevice *graphicsDevice, KeyframeMesh *mesh, const Texture *texture, uint startFrame, uint endFrame, float interpolation, VertexLerpShader *shader); private: - void SetFrameVertices(KeyframeMesh *mesh, uint32_t frame); - void SetFrameVertices(KeyframeMesh *mesh, uint32_t startFrame, uint32_t endFrame); + void SetFrameVertices(KeyframeMesh *mesh, uint frame); + void SetFrameVertices(KeyframeMesh *mesh, uint startFrame, uint endFrame); }; #endif diff --git a/src/framework/assets/animation/keyframemeshtriangle.h b/src/framework/assets/animation/keyframemeshtriangle.h index bd416d2..38e59af 100644 --- a/src/framework/assets/animation/keyframemeshtriangle.h +++ b/src/framework/assets/animation/keyframemeshtriangle.h @@ -9,8 +9,8 @@ */ struct KeyframeMeshTriangle { - uint32_t vertices[3]; - uint32_t textureCoords[3]; + uint vertices[3]; + uint textureCoords[3]; }; #endif diff --git a/src/framework/assets/animation/skeletalmesh.cpp b/src/framework/assets/animation/skeletalmesh.cpp index 7350ec3..b3e0944 100644 --- a/src/framework/assets/animation/skeletalmesh.cpp +++ b/src/framework/assets/animation/skeletalmesh.cpp @@ -38,12 +38,12 @@ SkeletalMesh::~SkeletalMesh() m_animations.clear(); } -int32_t SkeletalMesh::GetIndexOfSubset(const stl::string &name) const +int SkeletalMesh::GetIndexOfSubset(const stl::string &name) const { - for (uint32_t i = 0; i < m_numSubsets; ++i) + for (uint i = 0; i < m_numSubsets; ++i) { if (m_subsets[i].GetName() == name) - return (int32_t)i; + return (int)i; } return -1; @@ -51,19 +51,19 @@ int32_t SkeletalMesh::GetIndexOfSubset(const stl::string &name) const Joint* SkeletalMesh::GetJoint(const stl::string &name) const { - int32_t jointIndex = GetIndexOfJoint(name); + int jointIndex = GetIndexOfJoint(name); if (jointIndex == NO_JOINT) return NULL; else return &m_joints[jointIndex]; } -int32_t SkeletalMesh::GetIndexOfJoint(const stl::string &name) const +int SkeletalMesh::GetIndexOfJoint(const stl::string &name) const { - for (uint32_t i = 0; i < m_numJoints; ++i) + for (uint i = 0; i < m_numJoints; ++i) { if (m_joints[i].name == name) - return (int32_t)i; + return (int)i; } return NO_JOINT; @@ -89,18 +89,18 @@ void SkeletalMesh::FindAndSetRootJointIndex() return; } - uint32_t numJointsTried = 0; - int32_t rootIndex = NO_JOINT; + uint numJointsTried = 0; + int rootIndex = NO_JOINT; while (numJointsTried < m_numJoints && rootIndex == NO_JOINT) { - int32_t parentlessJoint = NO_JOINT; + int parentlessJoint = NO_JOINT; // try the next joint without any parents - for (uint32_t i = numJointsTried; i < m_numJoints; ++i) + for (uint i = numJointsTried; i < m_numJoints; ++i) { if (m_joints[i].parent == NULL) { - parentlessJoint = (int32_t)i; + parentlessJoint = (int)i; break; } } @@ -114,9 +114,9 @@ void SkeletalMesh::FindAndSetRootJointIndex() // ensure it has child joints BOOL hasChildJoints = FALSE; - for (uint32_t i = 0; i < m_numJoints; ++i) + for (uint i = 0; i < m_numJoints; ++i) { - int32_t parentIndex = m_joints[i].parentIndex; + int parentIndex = m_joints[i].parentIndex; if (parentIndex == parentlessJoint) { hasChildJoints = TRUE; diff --git a/src/framework/assets/animation/skeletalmesh.h b/src/framework/assets/animation/skeletalmesh.h index 94002a9..d7c15c3 100644 --- a/src/framework/assets/animation/skeletalmesh.h +++ b/src/framework/assets/animation/skeletalmesh.h @@ -23,18 +23,18 @@ public: virtual ~SkeletalMesh(); - uint32_t GetNumVertices() const { return m_numVertices; } + uint GetNumVertices() const { return m_numVertices; } Vector3* GetVertices() const { return m_vertices; } JointVertexMapping* GetJointMappings() const { return m_jointMappings; } - uint32_t GetNumSubsets() const { return m_numSubsets; } + uint GetNumSubsets() const { return m_numSubsets; } SkeletalMeshSubset* GetSubsets() const { return m_subsets; } - int32_t GetIndexOfSubset(const stl::string &name) const; - uint32_t GetNumJoints() const { return m_numJoints; } + int GetIndexOfSubset(const stl::string &name) const; + uint GetNumJoints() const { return m_numJoints; } Joint* GetJoints() const { return m_joints; } Joint* GetJoint(const stl::string &name) const; - int32_t GetIndexOfJoint(const stl::string &name) const; - int32_t GetRootJointIndex() const { return m_rootJointIndex; } - uint32_t GetNumFrames() const { return m_numFrames; } + int GetIndexOfJoint(const stl::string &name) const; + int GetRootJointIndex() const { return m_rootJointIndex; } + uint GetNumFrames() const { return m_numFrames; } const AnimationSequence* GetAnimation(const stl::string &name) const; VertexBuffer* GetVertexBuffer() const { return m_vertexBuffer; } @@ -42,15 +42,15 @@ private: SkeletalMesh(); void FindAndSetRootJointIndex(); - uint32_t m_numVertices; + uint m_numVertices; Vector3 *m_vertices; JointVertexMapping *m_jointMappings; - uint32_t m_numSubsets; + uint m_numSubsets; SkeletalMeshSubset *m_subsets; - uint32_t m_numJoints; + uint m_numJoints; Joint *m_joints; - int32_t m_rootJointIndex; - uint32_t m_numFrames; + int m_rootJointIndex; + uint m_numFrames; AnimationList m_animations; VertexBuffer *m_vertexBuffer; }; diff --git a/src/framework/assets/animation/skeletalmeshanimationinstance.cpp b/src/framework/assets/animation/skeletalmeshanimationinstance.cpp index 1b8717b..c49cd9c 100644 --- a/src/framework/assets/animation/skeletalmeshanimationinstance.cpp +++ b/src/framework/assets/animation/skeletalmeshanimationinstance.cpp @@ -65,7 +65,7 @@ void SkeletalMeshAnimationInstance::OnUpdate(float delta) } } -void SkeletalMeshAnimationInstance::SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop) +void SkeletalMeshAnimationInstance::SetSequence(uint startFrame, uint endFrame, BOOL loop) { m_currentSequenceName.clear(); m_currentSequenceStart = startFrame; diff --git a/src/framework/assets/animation/skeletalmeshanimationinstance.h b/src/framework/assets/animation/skeletalmeshanimationinstance.h index 01fb4ef..381d4f8 100644 --- a/src/framework/assets/animation/skeletalmeshanimationinstance.h +++ b/src/framework/assets/animation/skeletalmeshanimationinstance.h @@ -14,23 +14,23 @@ public: virtual ~SkeletalMeshAnimationInstance(); void OnUpdate(float delta); - void SetSequence(uint32_t startFrame, uint32_t endFrame, BOOL loop); + void SetSequence(uint startFrame, uint endFrame, BOOL loop); void SetSequence(const stl::string &name, BOOL loop); void RunSequenceOnce(const stl::string &name); - uint32_t GetCurrentFrame() const { return m_thisFrame; } - uint32_t GetNextFrame() const { return m_nextFrame; } + uint GetCurrentFrame() const { return m_thisFrame; } + uint GetNextFrame() const { return m_nextFrame; } float GetInterpolation() const { return m_interpolation; } private: void RecoverFromTempSequence(); stl::string m_currentSequenceName; - uint32_t m_currentSequenceStart; - uint32_t m_currentSequenceEnd; + uint m_currentSequenceStart; + uint m_currentSequenceEnd; BOOL m_currentSequenceLoop; - uint32_t m_thisFrame; - uint32_t m_nextFrame; + uint m_thisFrame; + uint m_nextFrame; float m_interpolation; BOOL m_isRunningTempSequence; stl::string m_oldSequenceName; diff --git a/src/framework/assets/animation/skeletalmeshfile.cpp b/src/framework/assets/animation/skeletalmeshfile.cpp index 37cdd05..3f339a9 100644 --- a/src/framework/assets/animation/skeletalmeshfile.cpp +++ b/src/framework/assets/animation/skeletalmeshfile.cpp @@ -69,7 +69,7 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() // read vertices mesh->m_vertices = new Vector3[mesh->m_numVertices]; - for (uint32_t i = 0; i < mesh->m_numVertices; ++i) + for (uint i = 0; i < mesh->m_numVertices; ++i) { mesh->m_vertices[i].x = file->ReadFloat(); mesh->m_vertices[i].y = file->ReadFloat(); @@ -81,9 +81,9 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() if (hasNormals) { file->Seek(normalsDesc->start, FILESEEK_BEGINNING); - uint32_t numNormals = file->ReadUnsignedInt(); + uint numNormals = file->ReadUnsignedInt(); ASSERT(numNormals == mesh->m_numVertices); - for (uint32_t i = 0; i < numNormals; ++i) + for (uint i = 0; i < numNormals; ++i) { Vector3 normal; normal.x = file->ReadFloat(); @@ -97,9 +97,9 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() if (hasTexCoords) { file->Seek(texCoordsDesc->start, FILESEEK_BEGINNING); - uint32_t numTexCoords = file->ReadUnsignedInt(); + uint numTexCoords = file->ReadUnsignedInt(); ASSERT(numTexCoords == mesh->m_numVertices); - for (uint32_t i = 0; i < numTexCoords; ++i) + for (uint i = 0; i < numTexCoords; ++i) { Vector2 texCoord; texCoord.x = file->ReadFloat(); @@ -112,12 +112,12 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() file->Seek(groupsDesc->start, FILESEEK_BEGINNING); mesh->m_numSubsets = file->ReadUnsignedInt(); mesh->m_subsets = new SkeletalMeshSubset[mesh->m_numSubsets]; - for (uint32_t i = 0; i < mesh->m_numSubsets; ++i) + for (uint i = 0; i < mesh->m_numSubsets; ++i) { stl::string name; stl::string texture; BOOL alpha; - uint32_t numTriangles; + uint numTriangles; file->ReadString(name); file->ReadString(texture); @@ -130,20 +130,20 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() // triangles file->Seek(trianglesDesc->start, FILESEEK_BEGINNING); - uint32_t numTriangles = file->ReadUnsignedInt(); - for (uint32_t i = 0; i < numTriangles; ++i) + uint numTriangles = file->ReadUnsignedInt(); + for (uint i = 0; i < numTriangles; ++i) { - uint32_t v1 = file->ReadUnsignedInt(); - uint32_t v2 = file->ReadUnsignedInt(); - uint32_t v3 = file->ReadUnsignedInt(); - uint32_t subsetIndex = file->ReadUnsignedInt(); + uint v1 = file->ReadUnsignedInt(); + uint v2 = file->ReadUnsignedInt(); + uint v3 = file->ReadUnsignedInt(); + uint subsetIndex = file->ReadUnsignedInt(); SkeletalMeshSubset *subset = &mesh->m_subsets[subsetIndex]; - subset->GetIndices()->SetCurrent((uint16_t)v1); + subset->GetIndices()->SetCurrent((ushort)v1); subset->GetIndices()->MoveNext(); - subset->GetIndices()->SetCurrent((uint16_t)v2); + subset->GetIndices()->SetCurrent((ushort)v2); subset->GetIndices()->MoveNext(); - subset->GetIndices()->SetCurrent((uint16_t)v3); + subset->GetIndices()->SetCurrent((ushort)v3); subset->GetIndices()->MoveNext(); } @@ -151,10 +151,10 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() file->Seek(jointsDesc->start, FILESEEK_BEGINNING); mesh->m_numJoints = file->ReadUnsignedInt(); mesh->m_joints = new Joint[mesh->m_numJoints]; - for (uint32_t i = 0; i < mesh->m_numJoints; ++i) + for (uint i = 0; i < mesh->m_numJoints; ++i) { file->ReadString(mesh->m_joints[i].name); - int32_t parentIndex = file->ReadInt(); + int parentIndex = file->ReadInt(); mesh->m_joints[i].parentIndex = parentIndex; if (parentIndex >= 0) mesh->m_joints[i].parent = &mesh->m_joints[parentIndex]; @@ -175,7 +175,7 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() } // build absolute transformation matrices for all the joints we just loaded - for (uint32_t i = 0; i < mesh->m_numJoints; ++i) + for (uint i = 0; i < mesh->m_numJoints; ++i) { Joint *joint = &mesh->m_joints[i]; if (joint->parent != NULL) @@ -190,17 +190,17 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() // set up inverse absolute transforms for each joint in preparation // for transforming all the vertices Matrix4x4 *inverseJointTransforms = new Matrix4x4[mesh->m_numJoints]; - for (uint32_t i = 0; i < mesh->m_numJoints; ++i) + for (uint i = 0; i < mesh->m_numJoints; ++i) inverseJointTransforms[i] = Matrix4x4::Inverse(mesh->m_joints[i].absolute); // joint-to-vertex mappings file->Seek(jointsToVerticesDesc->start, FILESEEK_BEGINNING); - uint32_t numMappings = file->ReadUnsignedInt(); + uint numMappings = file->ReadUnsignedInt(); ASSERT(numMappings == mesh->m_numVertices); mesh->m_jointMappings = new JointVertexMapping[numMappings]; - for (uint32_t i = 0; i < numMappings; ++i) + for (uint i = 0; i < numMappings; ++i) { - uint32_t jointIndex = file->ReadUnsignedInt(); + uint jointIndex = file->ReadUnsignedInt(); mesh->m_jointMappings[i].jointIndex = jointIndex; mesh->m_jointMappings[i].weight = file->ReadFloat(); @@ -228,12 +228,12 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() mesh->m_numFrames = file->ReadUnsignedInt(); // allocate memory for the frames for each joint - for (uint32_t i = 0; i < mesh->m_numJoints; ++i) + for (uint i = 0; i < mesh->m_numJoints; ++i) mesh->m_joints[i].frames = new JointKeyFrame[mesh->m_numFrames]; - for (uint32_t i = 0; i < mesh->m_numFrames; ++i) + for (uint i = 0; i < mesh->m_numFrames; ++i) { - for (uint32_t j = 0; j < mesh->m_numJoints; ++j) + for (uint j = 0; j < mesh->m_numJoints; ++j) { mesh->m_joints[j].frames[i].position.x = file->ReadFloat(); mesh->m_joints[j].frames[i].position.y = file->ReadFloat(); @@ -251,8 +251,8 @@ SkeletalMesh* SkeletalMeshFile::CreateMesh() if (animationsDesc != NULL) { file->Seek(animationsDesc->start, FILESEEK_BEGINNING); - int32_t numAnimations = file->ReadInt(); - for (int32_t i = 0; i < numAnimations; ++i) + int numAnimations = file->ReadInt(); + for (int i = 0; i < numAnimations; ++i) { AnimationSequence sequence; stl::string name; diff --git a/src/framework/assets/animation/skeletalmeshinstance.cpp b/src/framework/assets/animation/skeletalmeshinstance.cpp index 7fb58be..88ca2a7 100644 --- a/src/framework/assets/animation/skeletalmeshinstance.cpp +++ b/src/framework/assets/animation/skeletalmeshinstance.cpp @@ -22,7 +22,7 @@ SkeletalMeshInstance::SkeletalMeshInstance(SkeletalMesh *mesh) m_enabledSubsets = new BOOL[m_numSubsets]; m_textures = new Texture*[m_numSubsets]; - for (uint32_t i = 0; i < m_numSubsets; ++i) + for (uint i = 0; i < m_numSubsets; ++i) { m_enabledSubsets[i] = TRUE; m_textures[i] = NULL; @@ -58,7 +58,7 @@ void SkeletalMeshInstance::OnUpdate(float delta) const Matrix4x4* SkeletalMeshInstance::GetJointTransformation(const stl::string &jointName) const { - int32_t jointIndex = GetMesh()->GetIndexOfJoint(jointName); + int jointIndex = GetMesh()->GetIndexOfJoint(jointName); if (jointIndex == NO_JOINT) return NULL; else @@ -78,11 +78,11 @@ void SkeletalMeshInstance::ClearFixedRootJointTransformation() m_rootJointHasFixedTransform = FALSE; } -void SkeletalMeshInstance::CalculateJointTransformations(uint32_t frame) +void SkeletalMeshInstance::CalculateJointTransformations(uint frame) { - int32_t rootJointIndex = GetMesh()->GetRootJointIndex(); + int rootJointIndex = GetMesh()->GetRootJointIndex(); - for (uint32_t i = 0; i < m_numJoints; ++i) + for (uint i = 0; i < m_numJoints; ++i) { if (!(m_rootJointHasFixedTransform && i == rootJointIndex)) { @@ -115,11 +115,11 @@ void SkeletalMeshInstance::CalculateJointTransformations(uint32_t frame) } } -void SkeletalMeshInstance::CalculateJointTransformations(uint32_t startFrame, uint32_t endFrame, float interpolation) +void SkeletalMeshInstance::CalculateJointTransformations(uint startFrame, uint endFrame, float interpolation) { - int32_t rootJointIndex = GetMesh()->GetRootJointIndex(); + int rootJointIndex = GetMesh()->GetRootJointIndex(); - for (uint32_t i = 0; i < m_numJoints; ++i) + for (uint i = 0; i < m_numJoints; ++i) { if (!(m_rootJointHasFixedTransform && i == rootJointIndex)) { @@ -155,7 +155,7 @@ void SkeletalMeshInstance::CalculateJointTransformations(uint32_t startFrame, ui } } -void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint32_t jointMatrixIndex) +void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint jointMatrixIndex) { const Matrix4x4 *jointMatrix = &m_jointTransformations[jointMatrixIndex]; @@ -165,7 +165,7 @@ void SkeletalMeshInstance::BreakDownJointTransformationMatrix(uint32_t jointMatr void SkeletalMeshInstance::EnableSubset(const stl::string &subset, BOOL enable) { - int32_t index = m_mesh->GetIndexOfSubset(subset); + int index = m_mesh->GetIndexOfSubset(subset); ASSERT(index != -1); if (index == -1) return; @@ -173,7 +173,7 @@ void SkeletalMeshInstance::EnableSubset(const stl::string &subset, BOOL enable) m_enabledSubsets[index] = enable; } -void SkeletalMeshInstance::SetTexture(uint32_t index, Texture *texture) +void SkeletalMeshInstance::SetTexture(uint index, Texture *texture) { ASSERT(index < m_numSubsets); m_textures[index] = texture; @@ -181,7 +181,7 @@ void SkeletalMeshInstance::SetTexture(uint32_t index, Texture *texture) void SkeletalMeshInstance::SetTexture(const stl::string &subset, Texture *texture) { - int32_t index = m_mesh->GetIndexOfSubset(subset); + int index = m_mesh->GetIndexOfSubset(subset); ASSERT(index != -1); if (index == -1) return; diff --git a/src/framework/assets/animation/skeletalmeshinstance.h b/src/framework/assets/animation/skeletalmeshinstance.h index 8b2a723..3cf0f28 100644 --- a/src/framework/assets/animation/skeletalmeshinstance.h +++ b/src/framework/assets/animation/skeletalmeshinstance.h @@ -19,19 +19,19 @@ public: virtual ~SkeletalMeshInstance(); virtual void OnUpdate(float delta); - void CalculateJointTransformations(uint32_t frame); - void CalculateJointTransformations(uint32_t startFrame, uint32_t endFrame, float interpolation); + void CalculateJointTransformations(uint frame); + void CalculateJointTransformations(uint startFrame, uint endFrame, float interpolation); - uint32_t GetNumSubsets() const { return m_numSubsets; } - BOOL IsSubsetEnabled(uint32_t index) const { return m_enabledSubsets[index]; } + 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(uint32_t index, BOOL enable) { m_enabledSubsets[index] = enable; } + void EnableSubset(uint index, BOOL enable) { m_enabledSubsets[index] = enable; } Texture** GetTextures() const { return m_textures; } - void SetTexture(uint32_t index, Texture *texture); + void SetTexture(uint index, Texture *texture); void SetTexture(const stl::string &subset, Texture *texture); - uint32_t GetNumJoints() const { return m_numJoints; } + uint GetNumJoints() const { return m_numJoints; } Matrix4x4* GetJointTransformations() const { return m_jointTransformations; } Vector3* GetJointPositions() const { return m_jointPositions; } Quaternion* GetJointRotations() const { return m_jointRotations; } @@ -49,10 +49,10 @@ public: SkeletalMesh* GetMesh() const { return m_mesh; } private: - void BreakDownJointTransformationMatrix(uint32_t jointMatrixIndex); + void BreakDownJointTransformationMatrix(uint jointMatrixIndex); SkeletalMesh *m_mesh; - uint32_t m_numSubsets; + uint m_numSubsets; BOOL *m_enabledSubsets; Texture **m_textures; RenderState *m_renderState; @@ -60,7 +60,7 @@ private: BlendState *m_alphaBlendState; BOOL m_renderAllSubsetsAlphaBlended; - uint32_t m_numJoints; + uint m_numJoints; Matrix4x4 *m_jointTransformations; Vector3 *m_jointPositions; Quaternion *m_jointRotations; diff --git a/src/framework/assets/animation/skeletalmeshrenderer.cpp b/src/framework/assets/animation/skeletalmeshrenderer.cpp index ccece5d..f340f82 100644 --- a/src/framework/assets/animation/skeletalmeshrenderer.cpp +++ b/src/framework/assets/animation/skeletalmeshrenderer.cpp @@ -26,7 +26,7 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn Render(graphicsDevice, instance, 0, shader); } -void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t frame, VertexSkinningShader *shader) +void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint frame, VertexSkinningShader *shader) { ASSERT(shader->IsBound() == TRUE); instance->CalculateJointTransformations(frame); @@ -35,7 +35,7 @@ void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshIn RenderAllSubsets(graphicsDevice, instance, shader); } -void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexSkinningShader *shader) +void SkeletalMeshRenderer::Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexSkinningShader *shader) { ASSERT(shader->IsBound() == TRUE); instance->CalculateJointTransformations(startFrame, endFrame, interpolation); @@ -68,7 +68,7 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel { // render only non-alpha subsets first instance->GetBlendState()->Apply(); - for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i) + for (uint i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i) { if (!instance->IsSubsetEnabled(i)) continue; @@ -86,7 +86,7 @@ void SkeletalMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, Skel if (hasAlphaSubsets) { instance->GetAlphaBlendState()->Apply(); - for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i) + for (uint i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i) { if (!instance->IsSubsetEnabled(i)) continue; diff --git a/src/framework/assets/animation/skeletalmeshrenderer.h b/src/framework/assets/animation/skeletalmeshrenderer.h index a1aa3d9..f844ace 100644 --- a/src/framework/assets/animation/skeletalmeshrenderer.h +++ b/src/framework/assets/animation/skeletalmeshrenderer.h @@ -19,8 +19,8 @@ public: virtual ~SkeletalMeshRenderer(); void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, VertexSkinningShader *shader); - void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t frame, VertexSkinningShader *shader); - void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint32_t startFrame, uint32_t endFrame, float interpolation, VertexSkinningShader *shader); + void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint frame, VertexSkinningShader *shader); + void Render(GraphicsDevice *graphicsDevice, SkeletalMeshInstance *instance, uint startFrame, uint endFrame, float interpolation, VertexSkinningShader *shader); void Render(GraphicsDevice *graphicsDevice, SkeletalMeshAnimationInstance *instance, VertexSkinningShader *shader); private: diff --git a/src/framework/assets/animation/skeletalmeshsubset.cpp b/src/framework/assets/animation/skeletalmeshsubset.cpp index 5eb85b2..a4ed0ab 100644 --- a/src/framework/assets/animation/skeletalmeshsubset.cpp +++ b/src/framework/assets/animation/skeletalmeshsubset.cpp @@ -16,7 +16,7 @@ SkeletalMeshSubset::~SkeletalMeshSubset() SAFE_DELETE(m_indices); } -void SkeletalMeshSubset::Create(const stl::string &name, uint32_t 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 c84a8d4..3cb929d 100644 --- a/src/framework/assets/animation/skeletalmeshsubset.h +++ b/src/framework/assets/animation/skeletalmeshsubset.h @@ -12,7 +12,7 @@ public: SkeletalMeshSubset(); virtual ~SkeletalMeshSubset(); - void Create(const stl::string &name, uint32_t 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; } diff --git a/src/framework/assets/animation/skeletalmeshtriangle.h b/src/framework/assets/animation/skeletalmeshtriangle.h index b5491d7..c9e3709 100644 --- a/src/framework/assets/animation/skeletalmeshtriangle.h +++ b/src/framework/assets/animation/skeletalmeshtriangle.h @@ -7,8 +7,8 @@ struct SkeletalMeshTriangle { - int32_t vertices[3]; - int32_t subMeshIndex; + int vertices[3]; + int subMeshIndex; }; #endif diff --git a/src/framework/assets/chunkdescriptor.h b/src/framework/assets/chunkdescriptor.h index 9a1d503..39281b4 100644 --- a/src/framework/assets/chunkdescriptor.h +++ b/src/framework/assets/chunkdescriptor.h @@ -7,8 +7,8 @@ struct ChunkDescriptor { - uint32_t start; - uint32_t length; + uint start; + uint length; }; typedef stl::map ChunkMap; diff --git a/src/framework/assets/static/staticmesh.cpp b/src/framework/assets/static/staticmesh.cpp index 847fb46..bc431e7 100644 --- a/src/framework/assets/static/staticmesh.cpp +++ b/src/framework/assets/static/staticmesh.cpp @@ -11,8 +11,7 @@ #include "../../math/vector3.h" #include "../../math/vector2.h" -StaticMesh::StaticMesh(uint32_t numSubsets, StaticMeshSubset **subsets) - : Content() +StaticMesh::StaticMesh(uint numSubsets, StaticMeshSubset **subsets) { ASSERT(numSubsets > 0); ASSERT(subsets != NULL); @@ -25,7 +24,6 @@ StaticMesh::StaticMesh(uint32_t numSubsets, StaticMeshSubset **subsets) } StaticMesh::StaticMesh(const StaticMeshFile *file, ContentManager *contentManager) - : Content() { m_numSubsets = 0; CreateSubsets(file, contentManager); @@ -33,7 +31,7 @@ StaticMesh::StaticMesh(const StaticMeshFile *file, ContentManager *contentManage StaticMesh::~StaticMesh() { - for (uint32_t i = 0; i < m_numSubsets; ++i) + for (uint i = 0; i < m_numSubsets; ++i) SAFE_DELETE(m_subsets[i]); SAFE_DELETE_ARRAY(m_subsets); } @@ -51,7 +49,7 @@ void StaticMesh::CreateSubsets(const StaticMeshFile *file, ContentManager *conte Vector3 *normals = file->GetNormals(); Vector2 *texCoords = file->GetTexCoords(); - for (uint32_t i = 0; i < m_numSubsets; ++i) + for (uint i = 0; i < m_numSubsets; ++i) { StaticMeshFileSubMesh *subMesh = &subMeshes[i]; StaticMeshFileMaterial *material = &materials[subMesh->material]; @@ -63,12 +61,12 @@ void StaticMesh::CreateSubsets(const StaticMeshFile *file, ContentManager *conte ASSERT(subset != NULL); // add the triangles to the subset - uint32_t n = 0; - for (uint32_t j = 0; j < file->GetNumTriangles(); ++j) + uint n = 0; + for (uint j = 0; j < file->GetNumTriangles(); ++j) { if (triangles[j].subMeshIndex == i) { - uint32_t pos = n * 3; + uint pos = n * 3; subset->GetVertices()->SetPosition3(pos, vertices[triangles[j].vertices[0]]); subset->GetVertices()->SetPosition3(pos + 1, vertices[triangles[j].vertices[1]]); diff --git a/src/framework/assets/static/staticmesh.h b/src/framework/assets/static/staticmesh.h index b06843c..8e7f5ce 100644 --- a/src/framework/assets/static/staticmesh.h +++ b/src/framework/assets/static/staticmesh.h @@ -22,7 +22,7 @@ public: * @param numSubsets the number of subsets being provided * @param subsets mesh subsets that this static mesh is to be made up of */ - StaticMesh(uint32_t numSubsets, StaticMeshSubset **subsets); + StaticMesh(uint numSubsets, StaticMeshSubset **subsets); /** * Creates a static mesh object. @@ -37,19 +37,19 @@ public: /** * @return the number of subsets that make up this mesh */ - uint32_t GetNumSubsets() const { return m_numSubsets; } + uint GetNumSubsets() const { return m_numSubsets; } /** * Gets the specified subset contained in this mesh. * @param index the subset to get * @return the mesh subset */ - StaticMeshSubset* GetSubset(uint32_t index) const { return m_subsets[index]; } + StaticMeshSubset* GetSubset(uint index) const { return m_subsets[index]; } private: void CreateSubsets(const StaticMeshFile *file, ContentManager *contentManager); - uint32_t m_numSubsets; + uint m_numSubsets; StaticMeshSubset **m_subsets; }; diff --git a/src/framework/assets/static/staticmeshbuilder.cpp b/src/framework/assets/static/staticmeshbuilder.cpp index 1ebf618..6b40e23 100644 --- a/src/framework/assets/static/staticmeshbuilder.cpp +++ b/src/framework/assets/static/staticmeshbuilder.cpp @@ -20,7 +20,7 @@ StaticMeshBuilder::~StaticMeshBuilder() // BuildMesh() will handle passing off the subset objects to a mesh object // if it is called. if it's not called, this will free up the memory since // it was never passed off anywhere else in that case - for (uint32_t i = 0; i < m_subsets.size(); ++i) + for (uint i = 0; i < m_subsets.size(); ++i) SAFE_DELETE(m_subsets[i]); m_subsets.clear(); } @@ -31,7 +31,7 @@ void StaticMeshBuilder::Reset() m_transform = IDENTITY_MATRIX; } -uint32_t StaticMeshBuilder::AddSubset(uint32_t numTriangles, Texture *texture) +uint StaticMeshBuilder::AddSubset(uint numTriangles, Texture *texture) { ASSERT(numTriangles > 0); StaticMeshSubset *subset = new StaticMeshSubset(numTriangles, texture); @@ -43,8 +43,8 @@ uint32_t StaticMeshBuilder::AddSubset(uint32_t numTriangles, Texture *texture) } void StaticMeshBuilder::SetTriangle( - uint32_t subsetIndex, - uint32_t triangle, + uint subsetIndex, + uint triangle, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &n1, const Vector3 &n2, const Vector3 &n3, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3 @@ -56,7 +56,7 @@ void StaticMeshBuilder::SetTriangle( ASSERT(subset != NULL); VertexBuffer *vertices = subset->GetVertices(); - uint32_t bufferIndex = triangle * 3; + uint bufferIndex = triangle * 3; ASSERT((bufferIndex + 3) <= vertices->GetNumElements()); @@ -69,8 +69,8 @@ void StaticMeshBuilder::SetTriangle( } void StaticMeshBuilder::SetTriangle( - uint32_t subsetIndex, - uint32_t triangle, + uint subsetIndex, + uint triangle, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3 ) @@ -81,7 +81,7 @@ void StaticMeshBuilder::SetTriangle( ASSERT(subset != NULL); VertexBuffer *vertices = subset->GetVertices(); - uint32_t bufferIndex = triangle * 3; + uint bufferIndex = triangle * 3; ASSERT((bufferIndex + 3) <= vertices->GetNumElements()); @@ -93,8 +93,8 @@ void StaticMeshBuilder::SetTriangle( } void StaticMeshBuilder::SetQuad( - uint32_t subsetIndex, - uint32_t firstTriangle, + uint subsetIndex, + uint firstTriangle, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4, const Vector3 &n1, const Vector3 &n2, const Vector3 &n3, const Vector3 &n4, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4 @@ -106,7 +106,7 @@ void StaticMeshBuilder::SetQuad( ASSERT(subset != NULL); VertexBuffer *vertices = subset->GetVertices(); - uint32_t bufferIndex = firstTriangle * 3; + uint bufferIndex = firstTriangle * 3; ASSERT((bufferIndex + 6) <= vertices->GetNumElements()); @@ -125,8 +125,8 @@ void StaticMeshBuilder::SetQuad( } void StaticMeshBuilder::SetQuad( - uint32_t subsetIndex, - uint32_t firstTriangle, + uint subsetIndex, + uint firstTriangle, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4 ) @@ -137,7 +137,7 @@ void StaticMeshBuilder::SetQuad( ASSERT(subset != NULL); VertexBuffer *vertices = subset->GetVertices(); - uint32_t bufferIndex = firstTriangle * 3; + uint bufferIndex = firstTriangle * 3; ASSERT((bufferIndex + 6) <= vertices->GetNumElements()); @@ -154,8 +154,8 @@ void StaticMeshBuilder::SetQuad( } void StaticMeshBuilder::SetBox( - uint32_t subsetIndex, - uint32_t firstTriangle, + uint subsetIndex, + uint firstTriangle, const Vector3 ¢er, float width, float height, float depth ) { @@ -174,8 +174,8 @@ void StaticMeshBuilder::SetBox( } void StaticMeshBuilder::SetBox( - uint32_t subsetIndex, - uint32_t firstTriangle, + uint subsetIndex, + uint firstTriangle, const Vector3 &min, const Vector3 &max ) { @@ -232,7 +232,7 @@ void StaticMeshBuilder::GenerateNormals() { ASSERT(m_subsets.size() > 0); - for (uint32_t i = 0; i < m_subsets.size(); ++i) + for (uint i = 0; i < m_subsets.size(); ++i) { StaticMeshSubset *subset = m_subsets[i]; ASSERT(subset != NULL); @@ -241,11 +241,11 @@ void StaticMeshBuilder::GenerateNormals() ASSERT(buffer->GetNumElements() % 3 == 0); // initialize all normals - for (uint32_t n = 0; n < buffer->GetNumElements(); ++n) + for (uint n = 0; n < buffer->GetNumElements(); ++n) buffer->SetNormal(n, 0.0f, 0.0f, 0.0f); // calculate the normal for each triangle and add it to the normals for each individual vertex - for (uint32_t v = 0; v < buffer->GetNumElements() / 3; ++v) + for (uint v = 0; v < buffer->GetNumElements() / 3; ++v) { // calculate the triangle normal // they should have been added in CCW order (which StaticMeshBuilder does...) @@ -264,7 +264,7 @@ void StaticMeshBuilder::GenerateNormals() } // all the vertex normals will be way too long, need to normalize all of them now - for (uint32_t n = 0; n < buffer->GetNumElements(); ++n) + for (uint n = 0; n < buffer->GetNumElements(); ++n) { Vector3 normal = buffer->GetNormal(n); buffer->SetNormal(n, Vector3::Normalize(normal)); @@ -279,7 +279,7 @@ StaticMesh* StaticMeshBuilder::BuildMesh() // convert the mesh vector to an array so it can be passed into the mesh object StaticMeshSubset **subsets = new StaticMeshSubset*[m_subsets.size()]; ASSERT(subsets != NULL); - for (uint32_t i = 0; i < m_subsets.size(); ++i) + for (uint i = 0; i < m_subsets.size(); ++i) subsets[i] = m_subsets[i]; StaticMesh *mesh = new StaticMesh(m_subsets.size(), subsets); @@ -295,7 +295,7 @@ StaticMesh* StaticMeshBuilder::BuildMesh() void StaticMeshBuilder::SetTriangleInternal( VertexBuffer *buffer, - uint32_t bufferIndex, + uint bufferIndex, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &n1, const Vector3 &n2, const Vector3 &n3, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3 @@ -316,7 +316,7 @@ void StaticMeshBuilder::SetTriangleInternal( void StaticMeshBuilder::SetTriangleInternal( VertexBuffer *buffer, - uint32_t bufferIndex, + uint bufferIndex, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3 ) diff --git a/src/framework/assets/static/staticmeshbuilder.h b/src/framework/assets/static/staticmeshbuilder.h index c838f82..df48610 100644 --- a/src/framework/assets/static/staticmeshbuilder.h +++ b/src/framework/assets/static/staticmeshbuilder.h @@ -47,7 +47,7 @@ public: * @param texture the texture to be applied to this subset, or NULL to use * no texture with it */ - uint32_t AddSubset(uint32_t numTriangles, Texture *texture); + uint AddSubset(uint numTriangles, Texture *texture); /** * Sets a triangle on the specified subset. @@ -55,8 +55,8 @@ public: * @param triangle the index of the triangle to set in the subset */ void SetTriangle( - uint32_t subsetIndex, - uint32_t triangle, + uint subsetIndex, + uint triangle, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &n1, const Vector3 &n2, const Vector3 &n3, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3 @@ -68,8 +68,8 @@ public: * @param triangle the index of the triangle to set in the subset */ void SetTriangle( - uint32_t subsetIndex, - uint32_t triangle, + uint subsetIndex, + uint triangle, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3 ); @@ -82,8 +82,8 @@ public: * the quad's vertices will be set in */ void SetQuad( - uint32_t subsetIndex, - uint32_t firstTriangle, + uint subsetIndex, + uint firstTriangle, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4, const Vector3 &n1, const Vector3 &n2, const Vector3 &n3, const Vector3 &n4, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4 @@ -97,8 +97,8 @@ public: * the quad's vertices will be set in */ void SetQuad( - uint32_t subsetIndex, - uint32_t firstTriangle, + uint subsetIndex, + uint firstTriangle, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3, const Vector2 &t4 ); @@ -111,8 +111,8 @@ public: * the box's vertices will be set in */ void SetBox( - uint32_t subsetIndex, - uint32_t firstTriangle, + uint subsetIndex, + uint firstTriangle, const Vector3 ¢er, float width, float height, float depth ); @@ -124,8 +124,8 @@ public: * the box's vertices will be set in */ void SetBox( - uint32_t subsetIndex, - uint32_t firstTriangle, + uint subsetIndex, + uint firstTriangle, const Vector3 &min, const Vector3 &max ); @@ -146,14 +146,14 @@ public: private: void SetTriangleInternal( VertexBuffer *buffer, - uint32_t bufferIndex, + uint bufferIndex, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &n1, const Vector3 &n2, const Vector3 &n3, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3 ); void SetTriangleInternal( VertexBuffer *buffer, - uint32_t bufferIndex, + uint bufferIndex, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector2 &t1, const Vector2 &t2, const Vector2 &t3 ); diff --git a/src/framework/assets/static/staticmeshfile.cpp b/src/framework/assets/static/staticmeshfile.cpp index 28ac153..f623da8 100644 --- a/src/framework/assets/static/staticmeshfile.cpp +++ b/src/framework/assets/static/staticmeshfile.cpp @@ -55,7 +55,7 @@ void StaticMeshFile::Load() m_numVertices = file->ReadUnsignedInt(); m_vertices = new Vector3[m_numVertices]; ASSERT(m_vertices != NULL); - for (uint32_t i = 0; i < m_numVertices; ++i) + for (uint i = 0; i < m_numVertices; ++i) { m_vertices[i].x = file->ReadFloat(); m_vertices[i].y = file->ReadFloat(); @@ -69,7 +69,7 @@ void StaticMeshFile::Load() m_numNormals = file->ReadUnsignedInt(); m_normals = new Vector3[m_numNormals]; ASSERT(m_normals != NULL); - for (uint32_t i = 0; i < m_numNormals; ++i) + for (uint i = 0; i < m_numNormals; ++i) { m_normals[i].x = file->ReadFloat(); m_normals[i].y = file->ReadFloat(); @@ -84,7 +84,7 @@ void StaticMeshFile::Load() m_numTexCoords = file->ReadUnsignedInt(); m_texCoords = new Vector2[m_numTexCoords]; ASSERT(m_texCoords != NULL); - for (uint32_t i = 0; i < m_numTexCoords; ++i) + for (uint i = 0; i < m_numTexCoords; ++i) { m_texCoords[i].x = file->ReadFloat(); m_texCoords[i].y = file->ReadFloat(); @@ -96,7 +96,7 @@ void StaticMeshFile::Load() m_numMaterials = file->ReadUnsignedInt(); m_materials = new StaticMeshFileMaterial[m_numMaterials]; ASSERT(m_materials != NULL); - for (uint32_t i = 0; i < m_numMaterials; ++i) + for (uint i = 0; i < m_numMaterials; ++i) { StaticMeshFileMaterial *material = &m_materials[i]; @@ -112,7 +112,7 @@ void StaticMeshFile::Load() m_numTriangles = file->ReadUnsignedInt(); m_triangles = new StaticMeshTriangle[m_numTriangles]; ASSERT(m_triangles != NULL); - for (uint32_t i = 0; i < m_numTriangles; ++i) + for (uint i = 0; i < m_numTriangles; ++i) { m_triangles[i].vertices[0] = file->ReadUnsignedInt(); m_triangles[i].vertices[1] = file->ReadUnsignedInt(); @@ -126,7 +126,7 @@ void StaticMeshFile::Load() m_numSubMeshes = file->ReadUnsignedInt(); m_subMeshes = new StaticMeshFileSubMesh[m_numSubMeshes]; ASSERT(m_subMeshes != NULL); - for (uint32_t i = 0; i < m_numSubMeshes; ++i) + for (uint i = 0; i < m_numSubMeshes; ++i) { StaticMeshFileSubMesh *subMesh = &m_subMeshes[i]; diff --git a/src/framework/assets/static/staticmeshfile.h b/src/framework/assets/static/staticmeshfile.h index 739c184..ba0eacd 100644 --- a/src/framework/assets/static/staticmeshfile.h +++ b/src/framework/assets/static/staticmeshfile.h @@ -27,8 +27,8 @@ struct StaticMeshFileMaterial struct StaticMeshFileSubMesh { stl::string name; - uint32_t material; - uint32_t numTriangles; + uint material; + uint numTriangles; }; /** @@ -49,7 +49,7 @@ public: /** * @return the total number of vertices this mesh contains */ - uint32_t GetNumVertices() const { return m_numVertices; } + uint GetNumVertices() const { return m_numVertices; } /** * @return pointer to the mesh's vertex data @@ -59,7 +59,7 @@ public: /** * @return the total number of normals this mesh contains */ - uint32_t GetNumNormals() const { return m_numNormals; } + uint GetNumNormals() const { return m_numNormals; } /** * @return pointer to the mesh's normal data, or NULL if none exist @@ -69,7 +69,7 @@ public: /** * @return the total number of texture coordinates this mesh contains */ - uint32_t GetNumTexCoords() const { return m_numTexCoords; } + uint GetNumTexCoords() const { return m_numTexCoords; } /** * @return pointer to the mesh's texture coordinates, or NULL if none exist @@ -79,7 +79,7 @@ public: /** * @return the total number of materials that this mesh contains */ - uint32_t GetNumMaterials() const { return m_numMaterials; } + uint GetNumMaterials() const { return m_numMaterials; } /** * @return pointer to the mesh's materials @@ -89,7 +89,7 @@ public: /** * @return the total number of triangles that this mesh contains */ - uint32_t GetNumTriangles() const { return m_numTriangles; } + uint GetNumTriangles() const { return m_numTriangles; } /** * @return pointer to the mesh's triangles @@ -99,7 +99,7 @@ public: /** * @return the total number of sub-meshes (subsets) this mesh contains */ - uint32_t GetNumSubMeshes() const { return m_numSubMeshes; } + uint GetNumSubMeshes() const { return m_numSubMeshes; } /** * @return pointer to the mesh's sub-meshes (subsets) @@ -109,17 +109,17 @@ public: private: void Load(); - uint32_t m_numVertices; + uint m_numVertices; Vector3 *m_vertices; - uint32_t m_numNormals; + uint m_numNormals; Vector3 *m_normals; - uint32_t m_numTexCoords; + uint m_numTexCoords; Vector2 *m_texCoords; - uint32_t m_numMaterials; + uint m_numMaterials; StaticMeshFileMaterial *m_materials; - uint32_t m_numTriangles; + uint m_numTriangles; StaticMeshTriangle *m_triangles; - uint32_t m_numSubMeshes; + uint m_numSubMeshes; StaticMeshFileSubMesh *m_subMeshes; }; diff --git a/src/framework/assets/static/staticmeshinstance.cpp b/src/framework/assets/static/staticmeshinstance.cpp index bb15b87..8f60181 100644 --- a/src/framework/assets/static/staticmeshinstance.cpp +++ b/src/framework/assets/static/staticmeshinstance.cpp @@ -22,7 +22,7 @@ StaticMeshInstance::StaticMeshInstance(StaticMesh *mesh) m_textures = new Texture*[m_mesh->GetNumSubsets()]; ASSERT(m_textures != NULL); - for (uint32_t i = 0; i < m_mesh->GetNumSubsets(); ++i) + for (uint i = 0; i < m_mesh->GetNumSubsets(); ++i) ResetTexture(i); } } @@ -32,13 +32,13 @@ StaticMeshInstance::~StaticMeshInstance() SAFE_DELETE(m_renderState); } -void StaticMeshInstance::SetTexture(uint32_t index, Texture *texture) +void StaticMeshInstance::SetTexture(uint index, Texture *texture) { m_textures[index] = texture; } -void StaticMeshInstance::ResetTexture(uint32_t index) +void StaticMeshInstance::ResetTexture(uint index) { m_textures[index] = m_mesh->GetSubset(index)->GetTexture(); } diff --git a/src/framework/assets/static/staticmeshinstance.h b/src/framework/assets/static/staticmeshinstance.h index 467ad9e..0f2f5fd 100644 --- a/src/framework/assets/static/staticmeshinstance.h +++ b/src/framework/assets/static/staticmeshinstance.h @@ -37,7 +37,7 @@ public: * @return the number of textures/materials that the mesh this instance * is for contains */ - uint32_t GetNumTextures() const { return m_mesh->GetNumSubsets(); } + uint GetNumTextures() const { return m_mesh->GetNumSubsets(); } /** * Gets the texture for the specified subset/material. @@ -45,21 +45,21 @@ public: * texture for * @return the texture, or NULL if one is not set */ - Texture* GetTexture(uint32_t index) const { return m_textures[index]; } + Texture* GetTexture(uint index) const { return m_textures[index]; } /** * Sets a new texture for the specified subset/material. * @param index the index of the subset/material to change the texture for * @param texture the new texture to set, or NULL to set no texture */ - void SetTexture(uint32_t index, Texture *texture); + void SetTexture(uint index, Texture *texture); /** * Resets the texture for the specified subset/material back to the mesh's * original texture. * @param index the index of the subset/material to reset the texture for */ - void ResetTexture(uint32_t index); + void ResetTexture(uint index); private: StaticMesh *m_mesh; diff --git a/src/framework/assets/static/staticmeshrenderer.cpp b/src/framework/assets/static/staticmeshrenderer.cpp index 825ed01..edb7c01 100644 --- a/src/framework/assets/static/staticmeshrenderer.cpp +++ b/src/framework/assets/static/staticmeshrenderer.cpp @@ -28,13 +28,13 @@ void StaticMeshRenderer::Render(GraphicsDevice *graphicsDevice, StaticMeshInstan void StaticMeshRenderer::RenderAllSubsets(GraphicsDevice *graphicsDevice, StaticMeshInstance *instance) { - for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i) + for (uint i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i) RenderSubset(graphicsDevice, instance->GetMesh()->GetSubset(i), instance->GetTexture(i)); } void StaticMeshRenderer::RenderAllSubsetsTextureless(GraphicsDevice *graphicsDevice, StaticMeshInstance *instance) { - for (uint32_t i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i) + for (uint i = 0; i < instance->GetMesh()->GetNumSubsets(); ++i) RenderTexturelessSubset(graphicsDevice, instance->GetMesh()->GetSubset(i)); } diff --git a/src/framework/assets/static/staticmeshsubset.cpp b/src/framework/assets/static/staticmeshsubset.cpp index f2a1eca..1cebb15 100644 --- a/src/framework/assets/static/staticmeshsubset.cpp +++ b/src/framework/assets/static/staticmeshsubset.cpp @@ -5,7 +5,7 @@ #include "../../graphics/texture.h" #include "../../graphics/vertexbuffer.h" -StaticMeshSubset::StaticMeshSubset(uint32_t numTriangles, Texture *texture) +StaticMeshSubset::StaticMeshSubset(uint numTriangles, Texture *texture) { VERTEX_ATTRIBS attribs[] = { VERTEX_POS_3D, diff --git a/src/framework/assets/static/staticmeshsubset.h b/src/framework/assets/static/staticmeshsubset.h index d780b80..2b6d1f5 100644 --- a/src/framework/assets/static/staticmeshsubset.h +++ b/src/framework/assets/static/staticmeshsubset.h @@ -18,7 +18,7 @@ public: * @param numTriangles the number of triangles this subset will contain * @param texture the texture to be applied to this subset */ - StaticMeshSubset(uint32_t numTriangles, Texture *texture); + StaticMeshSubset(uint numTriangles, Texture *texture); virtual ~StaticMeshSubset(); diff --git a/src/framework/assets/static/staticmeshtriangle.h b/src/framework/assets/static/staticmeshtriangle.h index 7241186..29bb9ce 100644 --- a/src/framework/assets/static/staticmeshtriangle.h +++ b/src/framework/assets/static/staticmeshtriangle.h @@ -8,8 +8,8 @@ */ struct StaticMeshTriangle { - uint32_t vertices[3]; - uint32_t subMeshIndex; + uint vertices[3]; + uint subMeshIndex; }; #endif diff --git a/src/framework/basegameapp.cpp b/src/framework/basegameapp.cpp index 9ad5b26..7abfb21 100644 --- a/src/framework/basegameapp.cpp +++ b/src/framework/basegameapp.cpp @@ -13,8 +13,8 @@ #include "input/mouse.h" #include "input/touchscreen.h" -const uint32_t DEFAULT_UPDATE_FREQUENCY = 60; -const uint32_t DEFAULT_MAX_FRAMESKIP = 10; +const uint DEFAULT_UPDATE_FREQUENCY = 60; +const uint DEFAULT_MAX_FRAMESKIP = 10; BaseGameApp::BaseGameApp() { @@ -108,15 +108,15 @@ void BaseGameApp::Loop() LOG_INFO(LOGCAT_GAMEAPP, "Main loop started.\n"); - uint32_t numUpdatesThisFrame; - uint32_t numLoops = 0; - uint32_t timeElapsed = 0; + uint numUpdatesThisFrame; + uint numLoops = 0; + uint timeElapsed = 0; - uint32_t updateTime = 0; - uint32_t renderTime = 0; + uint updateTime = 0; + uint renderTime = 0; m_nextUpdateAt = GetTicks(); - uint32_t currentTime = GetTicks(); + uint currentTime = GetTicks(); while (!m_stop) { @@ -131,8 +131,8 @@ void BaseGameApp::Loop() } else { - uint32_t newTime = GetTicks(); - uint32_t frameTime = newTime - currentTime; + uint newTime = GetTicks(); + uint frameTime = newTime - currentTime; currentTime = newTime; timeElapsed += frameTime; @@ -168,7 +168,7 @@ void BaseGameApp::Loop() if (numUpdatesThisFrame > 0) m_isRunningSlowly = TRUE; - uint32_t before = GetTicks(); + uint before = GetTicks(); OnUpdate(m_fixedUpdateInterval); updateTime += GetTicks() - before; @@ -183,7 +183,7 @@ void BaseGameApp::Loop() if (m_isDirty && m_window->IsActive() && m_window->HasGLContext()) { - uint32_t before = GetTicks(); + uint before = GetTicks(); OnRender(); m_window->Flip(); renderTime += GetTicks() - before; @@ -283,7 +283,7 @@ void BaseGameApp::OnUpdate(float delta) InternalUpdate(); } -void BaseGameApp::SetUpdateFrequency(uint32_t targetFrequency) +void BaseGameApp::SetUpdateFrequency(uint targetFrequency) { m_targetUpdatesPerSecond = targetFrequency; m_ticksPerUpdate = 1000 / m_targetUpdatesPerSecond; diff --git a/src/framework/basegameapp.h b/src/framework/basegameapp.h index 36584e8..bc2f62b 100644 --- a/src/framework/basegameapp.h +++ b/src/framework/basegameapp.h @@ -70,7 +70,7 @@ public: * @return the number of frames that were rendered and updated during the last second * (this number includes skipped renders/updates in it's count) */ - uint32_t GetFPS() const { return m_fps; } + uint GetFPS() const { return m_fps; } /** * @return average time in seconds that each frame took during the last second @@ -80,22 +80,22 @@ public: /** * @return total time in milliseconds that rendering took during the last second */ - uint32_t GetRenderTime() const { return m_renderTime; } + uint GetRenderTime() const { return m_renderTime; } /** * @return total time in milliseconds that updating game logic took during the last second */ - uint32_t GetUpdateTime() const { return m_updateTime; } + uint GetUpdateTime() const { return m_updateTime; } /** * @return the number of frames rendered during the last second */ - uint32_t GetRendersPerSecond() const { return m_rendersPerSecond; } + uint GetRendersPerSecond() const { return m_rendersPerSecond; } /** * @return the number of game logic updates during the last second */ - uint32_t GetUpdatesPerSecond() const { return m_updatesPerSecond; } + uint GetUpdatesPerSecond() const { return m_updatesPerSecond; } /** * @return TRUE if the main loop is running behind @@ -107,13 +107,13 @@ public: * Sets the desired frames per second to run the main loop at. * @param targetFrequency the number of frames to run the main loop at */ - void SetUpdateFrequency(uint32_t targetFrequency); + void SetUpdateFrequency(uint targetFrequency); /** * Sets the maximum number of frames to skip rendering per loop if the main loop is running slowly. * @param frameSkip the maximum number of frames to skip rendering per loop */ - void SetMaxFrameSkip(uint32_t frameSkip) { m_maxFrameSkip = frameSkip; } + void SetMaxFrameSkip(uint frameSkip) { m_maxFrameSkip = frameSkip; } /** * Resets the time checking that determines if the main loop is running slowly. @@ -128,7 +128,7 @@ public: */ void Invalidate() { m_isDirty = TRUE; } - unsigned int GetTicks() const { return m_system->GetTicks(); } + uint GetTicks() const { return m_system->GetTicks(); } /** * @return TRUE if the app currently is active and has input focus @@ -214,20 +214,20 @@ private: BOOL m_stop; BOOL m_isPaused; - uint32_t m_fps; + uint m_fps; float m_frameTime; - uint32_t m_numRenders; - uint32_t m_rendersPerSecond; - uint32_t m_numUpdates; - uint32_t m_updatesPerSecond; - uint32_t m_renderTime; - uint32_t m_updateTime; + uint m_numRenders; + uint m_rendersPerSecond; + uint m_numUpdates; + uint m_updatesPerSecond; + uint m_renderTime; + uint m_updateTime; - uint32_t m_targetUpdatesPerSecond; - uint32_t m_ticksPerUpdate; - uint32_t m_maxFrameSkip; + uint m_targetUpdatesPerSecond; + uint m_ticksPerUpdate; + uint m_maxFrameSkip; float m_fixedUpdateInterval; - uint32_t m_nextUpdateAt; + uint m_nextUpdateAt; BOOL m_isRunningSlowly; BOOL m_isDirty; diff --git a/src/framework/common.h b/src/framework/common.h index 0287946..58db6a4 100644 --- a/src/framework/common.h +++ b/src/framework/common.h @@ -100,7 +100,7 @@ inline void ToggleBit(T1 bit, T2 &bitfield) * Seeds the system random number generator * @param seed the value to seed the random number generator with */ -void SeedRnd(int32_t seed); +void SeedRnd(int seed); /** * Returns a random integer. @@ -108,7 +108,7 @@ void SeedRnd(int32_t seed); * @param high the high end of the range to generate a random integer within * @return the generated random integer */ -int32_t Rnd(int32_t low, int32_t high); +int Rnd(int low, int high); float Rnd(float low, float high); diff --git a/src/framework/content/content.h b/src/framework/content/content.h index 4ce113b..e0bd10d 100644 --- a/src/framework/content/content.h +++ b/src/framework/content/content.h @@ -40,7 +40,7 @@ public: /** * @return the number of references currently being held for this content */ - uint32_t GetNumReferences() const { return m_referenceCount; } + uint GetNumReferences() const { return m_referenceCount; } private: /** @@ -55,7 +55,7 @@ private: BOOL m_wasLoadedByContentLoader; BOOL m_isReferenceCounted; - uint32_t m_referenceCount; + uint m_referenceCount; }; #endif diff --git a/src/framework/content/contentloadermapstorebase.h b/src/framework/content/contentloadermapstorebase.h index 48d4679..657f164 100644 --- a/src/framework/content/contentloadermapstorebase.h +++ b/src/framework/content/contentloadermapstorebase.h @@ -150,8 +150,8 @@ void ContentLoaderMapStoreBase::Free(ContentStoreItor &itor, BOOL force, BOOL // if this is being forced, we need to manually decrease the Content's // internal reference counter (or the destructor will have a fit). // I suppose this is probably kind of "hack-ish"... - uint32_t numToRelease = itor->second.content->GetNumReferences(); - for (uint32_t i = 0; i < numToRelease; ++i) + uint numToRelease = itor->second.content->GetNumReferences(); + for (uint i = 0; i < numToRelease; ++i) ContentLoaderBase::ReleaseReference(itor->second.content); } diff --git a/src/framework/content/spritefontloader.cpp b/src/framework/content/spritefontloader.cpp index f9f408d..d01e1e2 100644 --- a/src/framework/content/spritefontloader.cpp +++ b/src/framework/content/spritefontloader.cpp @@ -49,7 +49,7 @@ void SpriteFontLoader::OnNewContext() if (font->GetTexture() == NULL) { stl::string filename; - uint8_t size = 0; + uint size = 0; DecomposeFilename(itor->first, filename, size); @@ -77,7 +77,7 @@ void SpriteFontLoader::OnLostContext() SpriteFont* SpriteFontLoader::LoadContent(const stl::string &file, const ContentParam *params) { stl::string filename; - uint8_t size = 0; + uint size = 0; DecomposeFilename(file, filename, size); @@ -105,7 +105,7 @@ stl::string SpriteFontLoader::ProcessFilename(const stl::string &filename, const return buffer; } -void SpriteFontLoader::DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint8_t &outSize) const +void SpriteFontLoader::DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint &outSize) const { ASSERT(filename.length() > 0); @@ -114,10 +114,10 @@ void SpriteFontLoader::DecomposeFilename(const stl::string &filename, stl::strin // break it up into filename and font size outFilename = filename.substr(0, startOfSize); - outSize = (uint8_t)atoi(filename.substr(startOfSize + 1).c_str()); + outSize = (uint)atoi(filename.substr(startOfSize + 1).c_str()); } -SpriteFont* SpriteFontLoader::Load(File *file, uint8_t size, SpriteFont *existing) const +SpriteFont* SpriteFontLoader::Load(File *file, uint size, SpriteFont *existing) const { LOG_INFO(LOGCAT_ASSETS, "%s: loading \"%s:%d\"\n", GetLoggingTag(), file->GetFilename().c_str(), size); @@ -271,7 +271,7 @@ void SpriteFontLoader::FreeContent(SpriteFont *content) SAFE_DELETE(content); } -BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint8_t size, SpriteFontGlyphMetrics *metrics) const +BOOL SpriteFontLoader::GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *metrics) const { ASSERT(metrics != NULL); diff --git a/src/framework/content/spritefontloader.h b/src/framework/content/spritefontloader.h index 4706fc8..6311195 100644 --- a/src/framework/content/spritefontloader.h +++ b/src/framework/content/spritefontloader.h @@ -77,10 +77,10 @@ protected: void FreeContent(SpriteFont *content); private: - void DecomposeFilename(const stl::string &filename, stl::string &outFilename, uint8_t &outSize) const; - SpriteFont* Load(File *file, uint8_t size, SpriteFont *existing) const; + 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, uint8_t size, SpriteFontGlyphMetrics *glyphMetrics) const; + BOOL GetGlyphMetrics(stbtt_fontinfo *fontInfo, char glyph, uint size, SpriteFontGlyphMetrics *glyphMetrics) const; }; #endif diff --git a/src/framework/content/spritefontparam.h b/src/framework/content/spritefontparam.h index 1200d58..b24dd18 100644 --- a/src/framework/content/spritefontparam.h +++ b/src/framework/content/spritefontparam.h @@ -6,9 +6,9 @@ struct SpriteFontParam : public ContentParam { - uint8_t size; + uint size; - SpriteFontParam(uint8_t size) + SpriteFontParam(uint size) { this->size = size; } diff --git a/src/framework/debug.cpp b/src/framework/debug.cpp index cffd54c..ddd0721 100644 --- a/src/framework/debug.cpp +++ b/src/framework/debug.cpp @@ -8,7 +8,7 @@ #include "log.h" #include "util/msgbox.h" -const int32_t DEBUG_ASSERT_BUFFER_SIZE = 2048; +const int DEBUG_ASSERT_BUFFER_SIZE = 2048; void DebugInit() { diff --git a/src/framework/file/util.cpp b/src/framework/file/util.cpp index 432313f..f3f10e7 100644 --- a/src/framework/file/util.cpp +++ b/src/framework/file/util.cpp @@ -56,7 +56,7 @@ const stl::string& GetAppPath() } g_appPath = path + "/"; #elif __APPLE__ - uint32_t size = MAXPATHLEN; + unsigned int size = MAXPATHLEN; char *pathBuffer = new char[size]; int result = _NSGetExecutablePath(pathBuffer, &size); if (result == -1) diff --git a/src/framework/frameworkutils.cpp b/src/framework/frameworkutils.cpp index 3835885..23e40b1 100644 --- a/src/framework/frameworkutils.cpp +++ b/src/framework/frameworkutils.cpp @@ -2,12 +2,12 @@ #include -void SeedRnd(int32_t seed) +void SeedRnd(int seed) { srand(seed); } -int32_t Rnd(int32_t low, int32_t high) +int Rnd(int low, int high) { return rand() % ((high - low) + 1) + low; } diff --git a/src/framework/gamewindow.h b/src/framework/gamewindow.h index cc52941..f93a4a6 100644 --- a/src/framework/gamewindow.h +++ b/src/framework/gamewindow.h @@ -40,7 +40,7 @@ public: * @param height the new window height * @return TRUE if successful, FALSE if not */ - virtual BOOL Resize(uint16_t width, uint16_t height) = 0; + virtual BOOL Resize(uint width, uint height) = 0; /** * Toggles between fullscreen and windowed mode. @@ -57,12 +57,12 @@ public: /** * @return the current width of the window's client area */ - virtual uint16_t GetWidth() const = 0; + virtual uint GetWidth() const = 0; /** * @return the current height of the window's client area */ - virtual uint16_t GetHeight() const = 0; + virtual uint GetHeight() const = 0; /** * @return the current dimensions of the window's client area @@ -72,7 +72,7 @@ public: /** * @return the bits per pixel display format of the window's graphics context */ - virtual uint8_t GetBPP() const = 0; + virtual uint GetBPP() const = 0; /** * @return TRUE if the current window is windowed, FALSE if fullscreen diff --git a/src/framework/graphics/billboardspritebatch.cpp b/src/framework/graphics/billboardspritebatch.cpp index a8b3e04..2cc2bab 100644 --- a/src/framework/graphics/billboardspritebatch.cpp +++ b/src/framework/graphics/billboardspritebatch.cpp @@ -21,7 +21,7 @@ #include "../math/matrix4x4.h" #include "../math/vector3.h" -const uint32_t VERTICES_PER_SPRITE = 6; +const uint VERTICES_PER_SPRITE = 6; const size_t PRINTF_BUFFER_SIZE = 8096; char __billboardSpriteBatch_PrintfBuffer[PRINTF_BUFFER_SIZE + 1]; @@ -132,7 +132,7 @@ void BillboardSpriteBatch::Render(const Texture *texture, const Vector3 &positio AddSprite(type, texture, position, width, height, 0, 0, texture->GetWidth(), texture->GetHeight(), color); } -void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color) +void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint index, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color) { const RectF *texCoords = &atlas->GetTile(index).texCoords; const Texture *texture = atlas->GetTexture(); @@ -140,7 +140,7 @@ void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, flo AddSprite(type, texture, Vector3(x, y, z), width, height, texCoords->left, texCoords->top, texCoords->right, texCoords->bottom, color); } -void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color) +void BillboardSpriteBatch::Render(const TextureAtlas *atlas, uint index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type, const Color &color) { const RectF *texCoords = &atlas->GetTile(index).texCoords; const Texture *texture = atlas->GetTexture(); @@ -157,8 +157,8 @@ void BillboardSpriteBatch::Render(const SpriteFont *font, const Vector3 &positio { size_t textLength = strlen(text); - uint16_t textWidth = 0; - uint16_t textHeight = 0; + uint textWidth = 0; + uint textHeight = 0; font->MeasureString(&textWidth, &textHeight, text); // the x,y,z coordinate specified is used as the position to center the @@ -222,7 +222,7 @@ void BillboardSpriteBatch::Printf(const SpriteFont *font, const Vector3 &positio Render(font, position, type, color, pixelScale, __billboardSpriteBatch_PrintfBuffer); } -void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color) +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); Matrix4x4 transform = GetTransformFor(type, position); @@ -242,13 +242,13 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *t AddSprite(type, transform, texture, ZERO_VECTOR, width, height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color); } -void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color) +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); - uint16_t sourceWidth = sourceRight - sourceLeft; + uint sourceWidth = sourceRight - sourceLeft; ASSERT(sourceWidth > 0); - uint16_t sourceHeight = sourceBottom - sourceTop; + uint sourceHeight = sourceBottom - sourceTop; ASSERT(sourceHeight > 0); float texLeft = sourceLeft / (float)sourceWidth; float texTop = sourceTop / (float)sourceHeight; @@ -268,9 +268,9 @@ void BillboardSpriteBatch::AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 ++m_currentSpritePointer; } -void BillboardSpriteBatch::SetSpriteInfo(uint32_t spriteIndex, 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) +void BillboardSpriteBatch::SetSpriteInfo(uint spriteIndex, 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) { - uint32_t base = spriteIndex * VERTICES_PER_SPRITE; + uint base = spriteIndex * VERTICES_PER_SPRITE; float halfWidth = width / 2.0f; float halfHeight = height / 2.0f; @@ -343,10 +343,10 @@ void BillboardSpriteBatch::RenderQueue() m_graphicsDevice->BindVertexBuffer(m_vertices); const Texture *currentTexture = NULL; - uint32_t startOffset = 0; - uint32_t stopOffset = 0; + uint startOffset = 0; + uint stopOffset = 0; - for (uint32_t i = 0; i < m_currentSpritePointer; ++i) + for (uint i = 0; i < m_currentSpritePointer; ++i) { if (currentTexture != m_textures[i]) { @@ -369,11 +369,11 @@ void BillboardSpriteBatch::RenderQueue() m_graphicsDevice->UnbindVertexBuffer(); } -void BillboardSpriteBatch::RenderQueueRange(const Texture *texture, uint32_t firstSprite, uint32_t lastSprite) +void BillboardSpriteBatch::RenderQueueRange(const Texture *texture, uint firstSprite, uint lastSprite) { const int TRIANGLES_PER_SPRITE = 2; - uint32_t vertexOffset = firstSprite * VERTICES_PER_SPRITE; - uint32_t numTriangles = (lastSprite - firstSprite) * TRIANGLES_PER_SPRITE; + uint vertexOffset = firstSprite * VERTICES_PER_SPRITE; + uint numTriangles = (lastSprite - firstSprite) * TRIANGLES_PER_SPRITE; m_graphicsDevice->BindTexture(texture); m_shader->SetTextureHasAlphaOnly(texture->GetFormat() == TEXTURE_FORMAT_ALPHA); diff --git a/src/framework/graphics/billboardspritebatch.h b/src/framework/graphics/billboardspritebatch.h index 8382f85..ca20380 100644 --- a/src/framework/graphics/billboardspritebatch.h +++ b/src/framework/graphics/billboardspritebatch.h @@ -106,7 +106,7 @@ public: * @param type the type of billboard to render this texture as * @param color color to tint the texture with */ - void Render(const TextureAtlas *atlas, uint32_t index, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type = BILLBOARDSPRITE_SPHERICAL, const Color &color = COLOR_WHITE); + void Render(const TextureAtlas *atlas, uint index, float x, float y, float z, float width, float height, BILLBOARDSPRITE_TYPE type = BILLBOARDSPRITE_SPHERICAL, const Color &color = COLOR_WHITE); /** * Renders a texture atlas sub-texture / tile as a billboard. The billboard @@ -118,7 +118,7 @@ public: * @param type the type of billboard to render this texture as * @param color color to tint the texture with */ - void Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type = BILLBOARDSPRITE_SPHERICAL, const Color &color = COLOR_WHITE); + void Render(const TextureAtlas *atlas, uint index, const Vector3 &position, float width, float height, BILLBOARDSPRITE_TYPE type = BILLBOARDSPRITE_SPHERICAL, const Color &color = COLOR_WHITE); /** * Renders text as series of billboards. The text will be centered on @@ -183,20 +183,20 @@ public: void End(); private: - void Initialize(GraphicsDevice *graphicsDevice, uint16_t maxSprites); + void Initialize(GraphicsDevice *graphicsDevice, uint maxSprites); void InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader); - void AddSprite(BILLBOARDSPRITE_TYPE type, const Texture *texture, const Vector3 &position, float width, float height, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color); + void 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); void 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); - void AddSprite(BILLBOARDSPRITE_TYPE type, const Matrix4x4 &transform, const Texture *texture, const Vector3 &offset, float width, float height, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color); + void 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); void 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); - void SetSpriteInfo(uint32_t spriteIndex, 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); + void SetSpriteInfo(uint spriteIndex, 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); void RenderQueue(); - void RenderQueueRange(const Texture *texture, uint32_t firstSprite, uint32_t lastSprite); + void RenderQueueRange(const Texture *texture, uint firstSprite, uint lastSprite); Matrix4x4 GetTransformFor(BILLBOARDSPRITE_TYPE type, const Vector3 &position) const; void CheckForNewSpriteSpace(); - uint32_t m_currentSpriteCapacity; + uint m_currentSpriteCapacity; GraphicsDevice *m_graphicsDevice; SpriteShader *m_shader; RenderState *m_renderState; @@ -207,7 +207,7 @@ private: BlendState m_overrideBlendState; VertexBuffer *m_vertices; stl::vector m_textures; - uint32_t m_currentSpritePointer; + uint m_currentSpritePointer; Vector3 m_cameraPosition; Vector3 m_cameraForward; diff --git a/src/framework/graphics/bufferobject.h b/src/framework/graphics/bufferobject.h index a1951a2..1a4eeac 100644 --- a/src/framework/graphics/bufferobject.h +++ b/src/framework/graphics/bufferobject.h @@ -55,7 +55,7 @@ public: /** * @return the number of elements contained in this buffer object */ - virtual uint32_t GetNumElements() const = 0; + virtual uint GetNumElements() const = 0; /** * @return the size in bytes of each element of data in this buffer object @@ -81,7 +81,7 @@ public: /** * @return the OpenGL buffer object ID for this buffer */ - uint32_t GetBufferId() const { return m_bufferId; } + uint GetBufferId() const { return m_bufferId; } void OnNewContext(); void OnLostContext(); @@ -124,7 +124,7 @@ private: BUFFEROBJECT_TYPE m_type; BUFFEROBJECT_USAGE m_usage; - uint32_t m_bufferId; + uint m_bufferId; BOOL m_isDirty; size_t m_sizeInBytes; }; diff --git a/src/framework/graphics/customtextureatlas.cpp b/src/framework/graphics/customtextureatlas.cpp index 7d9c7b2..9f1ac5c 100644 --- a/src/framework/graphics/customtextureatlas.cpp +++ b/src/framework/graphics/customtextureatlas.cpp @@ -5,7 +5,7 @@ #include "texture.h" #include "../math/rect.h" -CustomTextureAtlas::CustomTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset) +CustomTextureAtlas::CustomTextureAtlas(uint textureWidth, uint textureHeight, float texCoordEdgeOffset) : TextureAtlas(textureWidth, textureHeight, texCoordEdgeOffset) { } @@ -19,12 +19,12 @@ CustomTextureAtlas::~CustomTextureAtlas() { } -uint32_t CustomTextureAtlas::Add(const Rect &position) +uint CustomTextureAtlas::Add(const Rect &position) { return Add(position.left, position.top, position.right, position.bottom); } -uint32_t CustomTextureAtlas::Add(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) +uint CustomTextureAtlas::Add(uint left, uint top, uint right, uint bottom) { ASSERT(right <= GetWidth()); ASSERT(bottom <= GetHeight()); diff --git a/src/framework/graphics/customtextureatlas.h b/src/framework/graphics/customtextureatlas.h index 04f49b3..1d2da91 100644 --- a/src/framework/graphics/customtextureatlas.h +++ b/src/framework/graphics/customtextureatlas.h @@ -23,7 +23,7 @@ public: * help alleviate "texture bleeding" * issues while rendering */ - CustomTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET); + CustomTextureAtlas(uint textureWidth, uint textureHeight, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET); /** * Creates a texture atlas object with the specified properties. @@ -41,7 +41,7 @@ public: * @param position the pixel coordinates of the sub-texture / tile * @return the index of the new definition */ - uint32_t Add(const Rect &position); + uint Add(const Rect &position); /** * Adds a new definition for a sub-texture / tile. @@ -51,7 +51,7 @@ public: * @param bottom bottom Y coordinate of the sub-texture / tile * @return the index of the new definition */ - uint32_t Add(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom); + uint Add(uint left, uint top, uint right, uint bottom); /** * Clears all sub-texture / tile definitions. diff --git a/src/framework/graphics/framebuffer.cpp b/src/framework/graphics/framebuffer.cpp index 84a69a1..ddcd087 100644 --- a/src/framework/graphics/framebuffer.cpp +++ b/src/framework/graphics/framebuffer.cpp @@ -39,7 +39,7 @@ BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice) return TRUE; } -BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint16_t fixedWidth, uint16_t fixedHeight) +BOOL Framebuffer::Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight) { ASSERT(fixedWidth != 0); ASSERT(fixedHeight != 0); @@ -173,8 +173,8 @@ BOOL Framebuffer::AttachTexture(FRAMEBUFFER_DATA_TYPE type) if (attachmentType == 0) return FALSE; - uint16_t width = 0; - uint16_t height = 0; + uint width = 0; + uint height = 0; GetDimensionsForAttachment(width, height); Texture *attach = new Texture(); @@ -212,8 +212,8 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferTextureMap::iterator &itor, BOOL if (attachmentType == 0) return FALSE; - uint16_t width = 0; - uint16_t height = 0; + uint width = 0; + uint height = 0; GetDimensionsForAttachment(width, height); TEXTURE_FORMAT existingFormat = existing->GetFormat(); @@ -268,8 +268,8 @@ BOOL Framebuffer::AttachRenderbuffer(FRAMEBUFFER_DATA_TYPE type) if (attachmentType == 0) return FALSE; - uint16_t width = 0; - uint16_t height = 0; + uint width = 0; + uint height = 0; GetDimensionsForAttachment(width, height); Renderbuffer *attach = new Renderbuffer(); @@ -308,8 +308,8 @@ BOOL Framebuffer::ReCreateAndAttach(FramebufferRenderbufferMap::iterator &itor, if (attachmentType == 0) return FALSE; - uint16_t width = 0; - uint16_t height = 0; + uint width = 0; + uint height = 0; GetDimensionsForAttachment(width, height); FRAMEBUFFER_DATA_TYPE existingType = existing->GetType(); @@ -604,7 +604,7 @@ BOOL Framebuffer::RemoveRenderbuffer(Renderbuffer *renderbuffer) return FALSE; } -void Framebuffer::GetDimensionsForAttachment(uint16_t &width, uint16_t &height) const +void Framebuffer::GetDimensionsForAttachment(uint &width, uint &height) const { if (IsUsingFixedDimensions()) { diff --git a/src/framework/graphics/framebuffer.h b/src/framework/graphics/framebuffer.h index 2f2c7a8..87c26b1 100644 --- a/src/framework/graphics/framebuffer.h +++ b/src/framework/graphics/framebuffer.h @@ -25,9 +25,9 @@ public: void Release(); BOOL Initialize(GraphicsDevice *graphicsDevice); - BOOL Initialize(GraphicsDevice *graphicsDevice, uint16_t fixedWidth, uint16_t fixedHeight); + BOOL Initialize(GraphicsDevice *graphicsDevice, uint fixedWidth, uint fixedHeight); - uint32_t GetFramebufferName() const { return m_framebufferName; } + uint GetFramebufferName() const { return m_framebufferName; } BOOL IsInvalidated() const { return m_framebufferName == 0; } BOOL IsUsingFixedDimensions() const { return (m_fixedWidth != 0 && m_fixedHeight != 0); } @@ -57,11 +57,11 @@ private: BOOL RemoveTexture(Texture *texture); BOOL RemoveRenderbuffer(Renderbuffer *renderbuffer); - void GetDimensionsForAttachment(uint16_t &width, uint16_t &height) const; + void GetDimensionsForAttachment(uint &width, uint &height) const; - uint32_t m_framebufferName; - uint16_t m_fixedWidth; - uint16_t m_fixedHeight; + uint m_framebufferName; + uint m_fixedWidth; + uint m_fixedHeight; ViewContext *m_viewContext; FramebufferRenderbufferMap m_renderbuffers; FramebufferTextureMap m_textures; diff --git a/src/framework/graphics/geometrydebugrenderer.cpp b/src/framework/graphics/geometrydebugrenderer.cpp index 16bcb2c..32b1096 100644 --- a/src/framework/graphics/geometrydebugrenderer.cpp +++ b/src/framework/graphics/geometrydebugrenderer.cpp @@ -57,7 +57,7 @@ void GeometryDebugRenderer::Render(const BoundingBox &box, const Color &color) ASSERT(m_begunRendering == TRUE); ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 24)); - uint32_t i = m_currentVertex; + uint i = m_currentVertex; // removed lines which are duplicated by more then one face // left and right faces don't need to be drawn at all (entirely duplicated lines) @@ -103,7 +103,7 @@ void GeometryDebugRenderer::Render(const BoundingBox &box, const Color &color) m_vertices->SetPosition3(i++, box.min.x, box.min.y, box.min.z); // fill in all the colours - for (uint32_t j = m_currentVertex; j < i; ++j) + for (uint j = m_currentVertex; j < i; ++j) m_vertices->SetColor(j, color); m_currentVertex = i; @@ -120,7 +120,7 @@ void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &co ASSERT(m_begunRendering == TRUE); ASSERT(m_vertices->GetNumElements() > (m_currentVertex + 615)); - uint32_t p = m_currentVertex; + uint p = m_currentVertex; float ax, ay, az; float bx, by, bz; @@ -170,7 +170,7 @@ void GeometryDebugRenderer::Render(const BoundingSphere &sphere, const Color &co } // fill in all the colours - for (uint32_t i = m_currentVertex; i < p; ++i) + for (uint i = m_currentVertex; i < p; ++i) m_vertices->SetColor(i, color); m_currentVertex = p; diff --git a/src/framework/graphics/geometrydebugrenderer.h b/src/framework/graphics/geometrydebugrenderer.h index e203d62..e18f15b 100644 --- a/src/framework/graphics/geometrydebugrenderer.h +++ b/src/framework/graphics/geometrydebugrenderer.h @@ -124,7 +124,7 @@ private: Color m_color1; Color m_color2; VertexBuffer *m_vertices; - uint32_t m_currentVertex; + uint m_currentVertex; BOOL m_begunRendering; }; diff --git a/src/framework/graphics/graphicsdevice.cpp b/src/framework/graphics/graphicsdevice.cpp index 479af57..a9ffc4b 100644 --- a/src/framework/graphics/graphicsdevice.cpp +++ b/src/framework/graphics/graphicsdevice.cpp @@ -238,7 +238,7 @@ void GraphicsDevice::OnNewContext() UnbindVertexBuffer(); UnbindIndexBuffer(); - for (uint32_t i = 0; i < MAX_BOUND_TEXTURES; ++i) + for (uint i = 0; i < MAX_BOUND_TEXTURES; ++i) UnbindTexture(i); UnbindShader(); UnbindRenderbuffer(); @@ -313,7 +313,7 @@ Texture* GraphicsDevice::GetSolidColorTexture(const Color &color) return m_solidColorTextures->Get(color); } -void GraphicsDevice::BindTexture(const Texture *texture, uint32_t unit) +void GraphicsDevice::BindTexture(const Texture *texture, uint unit) { ASSERT(unit < MAX_BOUND_TEXTURES); ASSERT(texture != NULL); @@ -326,13 +326,13 @@ void GraphicsDevice::BindTexture(const Texture *texture, uint32_t unit) m_boundTextures[unit] = texture; } -void GraphicsDevice::BindSolidColorTexture(const Color &color, uint32_t unit) +void GraphicsDevice::BindSolidColorTexture(const Color &color, uint unit) { Texture *texture = m_solidColorTextures->Get(color); BindTexture(texture, unit); } -void GraphicsDevice::UnbindTexture(uint32_t unit) +void GraphicsDevice::UnbindTexture(uint unit) { ASSERT(unit < MAX_BOUND_TEXTURES); GL_CALL(glActiveTexture(GL_TEXTURE0 + unit)); @@ -346,7 +346,7 @@ void GraphicsDevice::UnbindTexture(const Texture *texture) if (texture == NULL) return; - for (uint32_t i = 0; i < MAX_BOUND_TEXTURES; ++i) + for (uint i = 0; i < MAX_BOUND_TEXTURES; ++i) { if (m_boundTextures[i] == texture) UnbindTexture(i); @@ -560,10 +560,10 @@ void GraphicsDevice::SetShaderVertexAttributes() ASSERT(m_enabledVertexAttribIndices.empty() == TRUE); ASSERT(m_boundVertexBuffer->GetNumAttributes() >= m_boundShader->GetNumAttributes()); - uint32_t numAttributes = m_boundShader->GetNumAttributes(); - for (uint32_t i = 0; i < numAttributes; ++i) + uint numAttributes = m_boundShader->GetNumAttributes(); + for (uint i = 0; i < numAttributes; ++i) { - int32_t bufferAttribIndex = 0; + int bufferAttribIndex = 0; if (m_boundShader->IsAttributeMappedToStandardType(i)) { VERTEX_STANDARD_ATTRIBS standardType = m_boundShader->GetAttributeMappedStandardType(i); @@ -575,10 +575,10 @@ void GraphicsDevice::SetShaderVertexAttributes() else bufferAttribIndex = m_boundShader->GetAttributeMappedBufferIndex(i); - uint32_t offset = 0; + uint offset = 0; GLint size = 0; - const VertexBufferAttribute *bufferAttribInfo = m_boundVertexBuffer->GetAttributeInfo((uint32_t)bufferAttribIndex); + const VertexBufferAttribute *bufferAttribInfo = m_boundVertexBuffer->GetAttributeInfo((uint)bufferAttribIndex); size = bufferAttribInfo->size; offset = bufferAttribInfo->offset; ASSERT(size != 0); @@ -605,7 +605,7 @@ void GraphicsDevice::ClearSetShaderVertexAttributes() { while (!m_enabledVertexAttribIndices.empty()) { - uint32_t index = m_enabledVertexAttribIndices.back(); + uint index = m_enabledVertexAttribIndices.back(); m_enabledVertexAttribIndices.pop_back(); GL_CALL(glDisableVertexAttribArray(index)); } @@ -621,7 +621,7 @@ void GraphicsDevice::RenderTriangles(const IndexBuffer *buffer) ASSERT(m_boundIndexBuffer == NULL); if (!m_shaderVertexAttribsSet) SetShaderVertexAttributes(); - int numVertices = buffer->GetNumElements(); + uint numVertices = buffer->GetNumElements(); ASSERT(numVertices % 3 == 0); GL_CALL(glDrawElements(GL_TRIANGLES, numVertices, GL_UNSIGNED_SHORT, buffer->GetBuffer())); } @@ -657,12 +657,12 @@ void GraphicsDevice::RenderTriangles() } } -void GraphicsDevice::RenderTriangles(uint32_t startVertex, uint32_t numTriangles) +void GraphicsDevice::RenderTriangles(uint startVertex, uint numTriangles) { ASSERT(m_boundVertexBuffer != NULL); if (!m_shaderVertexAttribsSet) SetShaderVertexAttributes(); - uint32_t numVertices = numTriangles * 3; + uint numVertices = numTriangles * 3; if (m_boundIndexBuffer != NULL) { @@ -672,7 +672,7 @@ void GraphicsDevice::RenderTriangles(uint32_t startVertex, uint32_t numTriangles // get the offset from the beginning of the index buffer to start rendering at // client buffer is just a raw pointer to the first index to use // IBO is basically the same idea, but the pointer "starts" at NULL and goes from there - uint32_t indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes(); + uint indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes(); const void *offset; if (m_boundIndexBuffer->IsClientSideBuffer()) offset = ((int8_t*)m_boundIndexBuffer->GetBuffer() + indexOffset); @@ -697,7 +697,7 @@ void GraphicsDevice::RenderLines(const IndexBuffer *buffer) ASSERT(m_boundIndexBuffer == NULL); if (!m_shaderVertexAttribsSet) SetShaderVertexAttributes(); - uint32_t numVertices = buffer->GetNumElements(); + uint numVertices = buffer->GetNumElements(); ASSERT(numVertices % 2 == 0); GL_CALL(glDrawElements(GL_LINES, numVertices, GL_UNSIGNED_SHORT, buffer->GetBuffer())); } @@ -711,7 +711,7 @@ void GraphicsDevice::RenderLines() if (m_boundIndexBuffer != NULL) { // using bound index buffer - int numIndices = m_boundIndexBuffer->GetNumElements(); + uint numIndices = m_boundIndexBuffer->GetNumElements(); ASSERT(numIndices % 2 == 0); // get the offset from the beginning of the index buffer to start rendering at @@ -733,12 +733,12 @@ void GraphicsDevice::RenderLines() } } -void GraphicsDevice::RenderLines(uint32_t startVertex, uint32_t numLines) +void GraphicsDevice::RenderLines(uint startVertex, uint numLines) { ASSERT(m_boundVertexBuffer != NULL); if (!m_shaderVertexAttribsSet) SetShaderVertexAttributes(); - uint32_t numVertices = numLines * 2; + uint numVertices = numLines * 2; if (m_boundIndexBuffer != NULL) { @@ -748,7 +748,7 @@ void GraphicsDevice::RenderLines(uint32_t startVertex, uint32_t numLines) // get the offset from the beginning of the index buffer to start rendering at // client buffer is just a raw pointer to the first index to use // IBO is basically the same idea, but the pointer "starts" at NULL and goes from there - uint32_t indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes(); + uint indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes(); const void *offset; if (m_boundIndexBuffer->IsClientSideBuffer()) offset = ((int8_t*)m_boundIndexBuffer->GetBuffer() + indexOffset); @@ -773,7 +773,7 @@ void GraphicsDevice::RenderPoints(const IndexBuffer *buffer) ASSERT(m_boundIndexBuffer == NULL); if (!m_shaderVertexAttribsSet) SetShaderVertexAttributes(); - uint32_t numVertices = buffer->GetNumElements(); + uint numVertices = buffer->GetNumElements(); GL_CALL(glDrawElements(GL_POINTS, numVertices, GL_UNSIGNED_SHORT, buffer->GetBuffer())); } @@ -786,7 +786,7 @@ void GraphicsDevice::RenderPoints() if (m_boundIndexBuffer != NULL) { // using bound index buffer - int numIndices = m_boundIndexBuffer->GetNumElements(); + uint numIndices = m_boundIndexBuffer->GetNumElements(); // get the offset from the beginning of the index buffer to start rendering at // client buffer is just a raw pointer to the first index to use @@ -806,7 +806,7 @@ void GraphicsDevice::RenderPoints() } } -void GraphicsDevice::RenderPoints(uint32_t startVertex, uint32_t numPoints) +void GraphicsDevice::RenderPoints(uint startVertex, uint numPoints) { ASSERT(m_boundVertexBuffer != NULL); if (!m_shaderVertexAttribsSet) @@ -820,7 +820,7 @@ void GraphicsDevice::RenderPoints(uint32_t startVertex, uint32_t numPoints) // get the offset from the beginning of the index buffer to start rendering at // client buffer is just a raw pointer to the first index to use // IBO is basically the same idea, but the pointer "starts" at NULL and goes from there - uint32_t indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes(); + uint indexOffset = startVertex * m_boundIndexBuffer->GetElementWidthInBytes(); const void *offset; if (m_boundIndexBuffer->IsClientSideBuffer()) offset = ((int8_t*)m_boundIndexBuffer->GetBuffer() + indexOffset); diff --git a/src/framework/graphics/graphicsdevice.h b/src/framework/graphics/graphicsdevice.h index 89e5d4e..bf0a4c2 100644 --- a/src/framework/graphics/graphicsdevice.h +++ b/src/framework/graphics/graphicsdevice.h @@ -35,7 +35,7 @@ class ViewContext; struct Color; typedef stl::list ManagedResourceList; -typedef stl::vector EnabledVertexAttribList; +typedef stl::vector EnabledVertexAttribList; /** * Provides an abstraction over the underlying OpenGL context. @@ -107,20 +107,20 @@ public: * @param texture the texture to bind * @param unit the texture unit to bind to */ - void BindTexture(const Texture *texture, uint32_t unit = 0); + void BindTexture(const Texture *texture, uint unit = 0); /** * Binds a texture that is filled with the specified solid color. * @param color a color with which to find and bind a texture with * @param unit the texture unit that the solid color texture should be bound to */ - void BindSolidColorTexture(const Color &color, uint32_t unit = 0); + void BindSolidColorTexture(const Color &color, uint unit = 0); /** * Unbinds the currently bound texture. * @param unit the texture unit to be unbound */ - void UnbindTexture(uint32_t unit = 0); + void UnbindTexture(uint unit = 0); /** * Unbinds the specified texture only if it's bound already. If it's not @@ -262,7 +262,7 @@ public: * @param startVertex the index of the first vertex to be rendered * @param numTriangles the number of triangles to be rendered */ - void RenderTriangles(uint32_t startVertex, uint32_t numTriangles); + void RenderTriangles(uint startVertex, uint numTriangles); /** * Renders the currently bound vertex buffer as lines. @@ -280,7 +280,7 @@ public: * @param startVertex the index of the first vertex to be rendered * @param numLines the number of lines to be rendered */ - void RenderLines(uint32_t startVertex, uint32_t numLines); + void RenderLines(uint startVertex, uint numLines); /** * Renders the currently bound vertex buffer as points. @@ -297,7 +297,7 @@ public: * @param startVertex the index of the first vertex to be rendered * @param numPoints the number of points to be rendered */ - void RenderPoints(uint32_t startVertex, uint32_t numPoints); + void RenderPoints(uint startVertex, uint numPoints); /** * @return a debug geometry renderer diff --git a/src/framework/graphics/gridtextureatlas.cpp b/src/framework/graphics/gridtextureatlas.cpp index 2198021..2f7bba4 100644 --- a/src/framework/graphics/gridtextureatlas.cpp +++ b/src/framework/graphics/gridtextureatlas.cpp @@ -2,13 +2,13 @@ #include "texture.h" -GridTextureAtlas::GridTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder, float texCoordEdgeOffset) +GridTextureAtlas::GridTextureAtlas(uint textureWidth, uint textureHeight, uint tileWidth, uint tileHeight, uint tileBorder, float texCoordEdgeOffset) : TextureAtlas(textureWidth, textureHeight, texCoordEdgeOffset) { GenerateGrid(tileWidth, tileHeight, tileBorder); } -GridTextureAtlas::GridTextureAtlas(Texture *source, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder, float texCoordEdgeOffset) +GridTextureAtlas::GridTextureAtlas(Texture *source, uint tileWidth, uint tileHeight, uint tileBorder, float texCoordEdgeOffset) : TextureAtlas(source, texCoordEdgeOffset) { GenerateGrid(tileWidth, tileHeight, tileBorder); @@ -18,7 +18,7 @@ GridTextureAtlas::~GridTextureAtlas() { } -void GridTextureAtlas::GenerateGrid(uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder) +void GridTextureAtlas::GenerateGrid(uint tileWidth, uint tileHeight, uint tileBorder) { m_tileWidth = tileWidth; m_tileHeight = tileHeight; @@ -26,14 +26,14 @@ void GridTextureAtlas::GenerateGrid(uint16_t tileWidth, uint16_t tileHeight, uin tileWidth += tileBorder; tileHeight += tileBorder; - uint16_t tilesX = (GetWidth() - tileBorder) / (m_tileWidth + tileBorder); - uint16_t tilesY = (GetHeight() - tileBorder) / (m_tileHeight + tileBorder); + uint tilesX = (GetWidth() - tileBorder) / (m_tileWidth + tileBorder); + uint tilesY = (GetHeight() - tileBorder) / (m_tileHeight + tileBorder); m_tiles.resize(tilesX * tilesY); - for (uint16_t y = 0; y < tilesY; ++y) + for (uint y = 0; y < tilesY; ++y) { - for (uint16_t x = 0; x < tilesX; ++x) + for (uint x = 0; x < tilesX; ++x) { TextureAtlasTile *current = &m_tiles[(y * tilesX) + x]; diff --git a/src/framework/graphics/gridtextureatlas.h b/src/framework/graphics/gridtextureatlas.h index d694df4..9d5e789 100644 --- a/src/framework/graphics/gridtextureatlas.h +++ b/src/framework/graphics/gridtextureatlas.h @@ -27,7 +27,7 @@ public: * help alleviate "texture bleeding" * issues while rendering */ - GridTextureAtlas(uint16_t textureWidth, uint16_t textureHeight, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder = 0, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET); + GridTextureAtlas(uint textureWidth, uint textureHeight, uint tileWidth, uint tileHeight, uint tileBorder = 0, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET); /** * Creates a texture atlas object with the specified properties. @@ -39,25 +39,25 @@ public: * help alleviate "texture bleeding" * issues while rendering */ - GridTextureAtlas(Texture *source, uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder = 0, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET); + GridTextureAtlas(Texture *source, uint tileWidth, uint tileHeight, uint tileBorder = 0, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET); virtual ~GridTextureAtlas(); /** * @return width in pixels of each sub-texture / tile */ - uint16_t GetTileWidth() const { return m_tileWidth; } + uint GetTileWidth() const { return m_tileWidth; } /** * @return height in pixels of each sub-texture / tile */ - uint16_t GetTileHeight() const { return m_tileHeight; } + uint GetTileHeight() const { return m_tileHeight; } private: - void GenerateGrid(uint16_t tileWidth, uint16_t tileHeight, uint16_t tileBorder); + void GenerateGrid(uint tileWidth, uint tileHeight, uint tileBorder); - uint16_t m_tileWidth; - uint16_t m_tileHeight; + uint m_tileWidth; + uint m_tileHeight; }; #endif diff --git a/src/framework/graphics/image.cpp b/src/framework/graphics/image.cpp index 2dbdfa7..ce1e647 100644 --- a/src/framework/graphics/image.cpp +++ b/src/framework/graphics/image.cpp @@ -32,7 +32,7 @@ void Image::Release() } -BOOL Image::Create(uint16_t width, uint16_t height, IMAGE_FORMAT format) +BOOL Image::Create(uint width, uint height, IMAGE_FORMAT format) { ASSERT(m_pixels == NULL); if (m_pixels != NULL) @@ -55,7 +55,7 @@ BOOL Image::Create(uint16_t width, uint16_t height, IMAGE_FORMAT format) if (bpp == 0) return FALSE; - size_t pixelsLength = (width * height) * (bpp / 8); + uint pixelsLength = (width * height) * (bpp / 8); m_pixels = new uint8_t[pixelsLength]; memset(m_pixels, 0, pixelsLength); @@ -77,7 +77,7 @@ BOOL Image::Create(const Image *source) return Create(source, 0, 0, source->GetWidth(), source->GetHeight()); } -BOOL Image::Create(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height) +BOOL Image::Create(const Image *source, uint x, uint y, uint width, uint height) { ASSERT(m_pixels == NULL); if (m_pixels != NULL) @@ -172,7 +172,7 @@ BOOL Image::Create(File *file) // copy from STB "owned" memory to our own, then free up the STB stuff // (this is kind of unnecessary, but I'd like this method to be the // *only* one that knows/cares about stb_image at all) - size_t pixelsLength = (width * height) * componentsPerPixel; + uint pixelsLength = (width * height) * componentsPerPixel; m_pixels = new uint8_t[pixelsLength]; memcpy(m_pixels, pixels, pixelsLength); stbi_image_free(pixels); @@ -187,7 +187,7 @@ BOOL Image::Create(File *file) } } -Color Image::GetColor(uint16_t x, uint16_t y) const +Color Image::GetColor(uint x, uint y) const { ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA); @@ -203,7 +203,7 @@ Color Image::GetColor(uint16_t x, uint16_t y) const } } -void Image::SetColor(uint16_t x, uint16_t y, const Color &color) +void Image::SetColor(uint x, uint y, const Color &color) { ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA); @@ -220,13 +220,13 @@ void Image::SetColor(uint16_t x, uint16_t y, const Color &color) } } -void Image::Copy(const Image *source, uint16_t destX, uint16_t destY) +void Image::Copy(const Image *source, uint destX, uint destY) { ASSERT(source != NULL); Copy(source, 0, 0, source->GetWidth(), source->GetHeight(), destX, destY); } -void Image::Copy(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t destX, uint16_t destY) +void Image::Copy(const Image *source, uint x, uint y, uint width, uint height, uint destX, uint destY) { ASSERT(source != NULL); if (source == NULL) @@ -241,10 +241,10 @@ void Image::Copy(const Image *source, uint16_t x, uint16_t y, uint16_t width, ui uint8_t *sourcePixels = source->GetPixels() + source->GetOffsetFor(x, y); uint8_t *destPixels = m_pixels + GetOffsetFor(destX, destY); - size_t lineWidthInBytes = width * (m_bpp / 8); - uint16_t numLinesToCopy = height; + uint lineWidthInBytes = width * (m_bpp / 8); + uint numLinesToCopy = height; - for (uint16_t i = 0; i < numLinesToCopy; ++i) + for (uint i = 0; i < numLinesToCopy; ++i) { memcpy(destPixels, sourcePixels, lineWidthInBytes); sourcePixels += source->GetPitch(); @@ -261,14 +261,14 @@ void Image::Clear(const Color &color) { ASSERT(m_format == IMAGE_FORMAT_RGB || m_format == IMAGE_FORMAT_RGBA); - uint32_t sizeInBytes = GetSizeInBytes(); + uint sizeInBytes = GetSizeInBytes(); uint8_t *pixel = m_pixels; if (m_format == IMAGE_FORMAT_RGB) { ASSERT(sizeInBytes % 3 == 0); uint8_t dummy; - for (uint32_t i = 0; i < sizeInBytes; i += 3) + for (uint i = 0; i < sizeInBytes; i += 3) { color.ToInts(pixel, pixel + 1, pixel + 2, &dummy); pixel += 3; @@ -277,7 +277,7 @@ void Image::Clear(const Color &color) else { ASSERT(sizeInBytes % 4 == 0); - for (uint32_t i = 0; i < sizeInBytes; i += 4) + for (uint i = 0; i < sizeInBytes; i += 4) { color.ToInts(pixel, pixel + 1, pixel + 2, pixel + 3); pixel += 4; @@ -305,13 +305,13 @@ void Image::FlipVertically() // TODO: this is a naive implementation. fix so it can flip the image // one scanline at a time using the already allocated memory - size_t pixelsLength = (m_width * m_height) * (m_bpp / 8); + uint pixelsLength = (m_width * m_height) * (m_bpp / 8); uint8_t *flippedPixels = new uint8_t[pixelsLength]; uint8_t *source = (m_pixels + pixelsLength) - m_pitch; // first pixel of the last line uint8_t *dest = flippedPixels; // first pixel of the first line - for (uint16_t y = 0; y < m_height; ++y) + for (uint y = 0; y < m_height; ++y) { memcpy(dest, source, m_pitch); source -= m_pitch; // go up one line diff --git a/src/framework/graphics/image.h b/src/framework/graphics/image.h index 0332db2..5288031 100644 --- a/src/framework/graphics/image.h +++ b/src/framework/graphics/image.h @@ -28,7 +28,7 @@ public: * @param format the pixel format of the image * @return TRUE if successful */ - BOOL Create(uint16_t width, uint16_t height, IMAGE_FORMAT format); + BOOL Create(uint width, uint height, IMAGE_FORMAT format); /** * Creates a copy of an image from another image object. @@ -46,7 +46,7 @@ public: * @param height the height of the source region to copy * @return TRUE if successful */ - BOOL Create(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height); + BOOL Create(const Image *source, uint x, uint y, uint width, uint height); /** * Creates an image from an image file. @@ -69,7 +69,7 @@ public: * @return offset into the raw image pixel data that corresponds * to the given X and Y coordinate on the image */ - uint32_t GetOffsetFor(uint16_t x, uint16_t y) const; + uint GetOffsetFor(uint x, uint y) const; /** * Gets a pointer to the raw image pixel data beginning at the given @@ -78,7 +78,7 @@ public: * @param y Y coordinate to get a pointer to * @return pointer to the raw image pixel data for this location */ - uint8_t* Get(uint16_t x, uint16_t y) const; + uint8_t* Get(uint x, uint y) const; /** * Gets a filled color object that corresponds to the pixel located @@ -87,7 +87,7 @@ public: * @param y Y coordinate to get the color of * @return color object containing the color of the specified pixel */ - Color GetColor(uint16_t x, uint16_t y) const; + Color GetColor(uint x, uint y) const; /** * Sets the color of a pixel on the image. @@ -95,7 +95,7 @@ public: * @param y Y coordinate of the pixel to set * @param color the color to set the pixel to */ - void SetColor(uint16_t x, uint16_t y, const Color &color); + void SetColor(uint x, uint y, const Color &color); /** * Sets the color of a pixel on the image. @@ -103,7 +103,7 @@ public: * @param y Y coordinate of the pixel to set * @param color the color (as a 32-bit hex value) to set the pixel to */ - void SetColor(uint16_t x, uint16_t y, uint32_t color) { SetColor(x, y, Color::FromInt(color)); } + void SetColor(uint x, uint y, uint32_t color) { SetColor(x, y, Color::FromInt(color)); } /** * Copies a source image and draws it onto this image at the position @@ -113,7 +113,7 @@ public: * @param destX the X coordinate to copy the source image to on this image * @param destY the Y coordinate to copy the source image to on this image */ - void Copy(const Image *source, uint16_t destX, uint16_t destY); + void Copy(const Image *source, uint destX, uint destY); /** * Copies a source image and draws it onto this image at the position @@ -127,22 +127,22 @@ public: * @param destX the X coordinate to copy the source image to on this image * @param destY the Y coordinate to copy the source image to on this image */ - void Copy(const Image *source, uint16_t x, uint16_t y, uint16_t width, uint16_t height, uint16_t destX, uint16_t destY); + void Copy(const Image *source, uint x, uint y, uint width, uint height, uint destX, uint destY); /** * @return the width of this image */ - uint16_t GetWidth() const { return m_width; } + uint GetWidth() const { return m_width; } /** * @return the height of this image */ - uint16_t GetHeight() const { return m_height; } + uint GetHeight() const { return m_height; } /** * @return the bits per pixel of this image's pixel data */ - uint8_t GetBpp() const { return m_bpp; } + uint GetBpp() const { return m_bpp; } /** * @return the pixel format of this image @@ -153,12 +153,12 @@ public: * @return the number of bytes equivalent to one horizontal line * of pixel data */ - uint32_t GetPitch() const { return m_pitch; } + uint GetPitch() const { return m_pitch; } /** * @return the number of bytes the raw pixel data in this image */ - uint32_t GetSizeInBytes() const; + uint GetSizeInBytes() const; /** * Zeros-out the pixel data for this image. @@ -191,24 +191,24 @@ public: private: uint8_t *m_pixels; - uint32_t m_pitch; - uint16_t m_width; - uint16_t m_height; - uint8_t m_bpp; + uint m_pitch; + uint m_width; + uint m_height; + uint m_bpp; IMAGE_FORMAT m_format; }; -inline uint32_t Image::GetOffsetFor(uint16_t x, uint16_t y) const +inline uint Image::GetOffsetFor(uint x, uint y) const { return (x + (y * m_width)) * (m_bpp / 8); } -inline uint8_t* Image::Get(uint16_t x, uint16_t y) const +inline uint8_t* Image::Get(uint x, uint y) const { return m_pixels + GetOffsetFor(x, y); } -inline uint32_t Image::GetSizeInBytes() const +inline uint Image::GetSizeInBytes() const { return (m_width * m_height) * (m_bpp / 8); } diff --git a/src/framework/graphics/indexbuffer.cpp b/src/framework/graphics/indexbuffer.cpp index b7a6178..f1f0c9f 100644 --- a/src/framework/graphics/indexbuffer.cpp +++ b/src/framework/graphics/indexbuffer.cpp @@ -18,12 +18,12 @@ void IndexBuffer::Release() BufferObject::Release(); } -BOOL IndexBuffer::Initialize(uint32_t numIndices, BUFFEROBJECT_USAGE usage) +BOOL IndexBuffer::Initialize(uint numIndices, BUFFEROBJECT_USAGE usage) { return Initialize(NULL, numIndices, usage); } -BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint32_t numIndices, BUFFEROBJECT_USAGE usage) +BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage) { ASSERT(m_buffer.size() == 0); if (m_buffer.size() > 0) @@ -67,12 +67,12 @@ BOOL IndexBuffer::Initialize(GraphicsDevice *graphicsDevice, const IndexBuffer * return TRUE; } -void IndexBuffer::Set(const uint16_t *indices, uint32_t numIndices) +void IndexBuffer::Set(const uint16_t *indices, uint numIndices) { memcpy(&m_buffer[0], indices, GetNumElements() * GetElementWidthInBytes()); } -void IndexBuffer::Resize(uint32_t numIndices) +void IndexBuffer::Resize(uint numIndices) { ASSERT(numIndices > 0); if (numIndices == 0) @@ -87,9 +87,9 @@ void IndexBuffer::Resize(uint32_t numIndices) --m_currentIndex; } -void IndexBuffer::Extend(uint32_t amount) +void IndexBuffer::Extend(uint amount) { - uint32_t newSize = GetNumElements() + amount; + uint newSize = GetNumElements() + amount; Resize(newSize); } diff --git a/src/framework/graphics/indexbuffer.h b/src/framework/graphics/indexbuffer.h index 0c339dd..917a112 100644 --- a/src/framework/graphics/indexbuffer.h +++ b/src/framework/graphics/indexbuffer.h @@ -30,7 +30,7 @@ public: * @param usage the expected usage pattern of this index buffer * @return TRUE if successful, FALSE if not */ - BOOL Initialize(uint32_t numIndices, BUFFEROBJECT_USAGE usage); + BOOL Initialize(uint numIndices, BUFFEROBJECT_USAGE usage); /** * Initializes the index buffer. @@ -40,7 +40,7 @@ public: * @param usage the expected usage pattern of this index buffer * @return TRUE if successful, FALSE if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, uint32_t numIndices, BUFFEROBJECT_USAGE usage); + BOOL Initialize(GraphicsDevice *graphicsDevice, uint numIndices, BUFFEROBJECT_USAGE usage); /** * Initializes the index buffer. @@ -63,14 +63,14 @@ public: * @param indices the source index data to copy * @param numIndices the number of indices to copy from the source */ - void Set(const uint16_t *indices, uint32_t numIndices); + void Set(const uint16_t *indices, uint numIndices); /** * Sets an index to a new value. * @param index the position of the index in this buffer to set * @param value the new value to set */ - void SetIndex(uint32_t index, uint16_t value); + void SetIndex(uint index, uint16_t value); /** * Moves the current index position to the next position. @@ -94,7 +94,7 @@ public: * direction, then it will be shrunk so as not to move * out of bounds. */ - void Move(int32_t numIndices); + void Move(int numIndices); /** * Moves the current index position to the beginning of the buffer. @@ -110,7 +110,7 @@ public: * Moves the current index position to the position specified. * @param index the position to move to */ - void MoveTo(uint32_t index) { m_currentIndex = index; } + void MoveTo(uint index) { m_currentIndex = index; } /** * Sets the index at the current position to a new value. @@ -123,18 +123,18 @@ public: * @param numIndices the amount of indices the buffer should be resized * to hold */ - void Resize(uint32_t numIndices); + void Resize(uint numIndices); /** * Extends the buffer capacity to hold the specified number of extra indices. * @param amount the amount of indices to extend the buffer by */ - void Extend(uint32_t amount); + void Extend(uint amount); /** * @return the number of indices contained in this buffer */ - uint32_t GetNumElements() const { return m_buffer.size(); } + uint GetNumElements() const { return m_buffer.size(); } /** * @return the size in bytes of each index in this buffer object @@ -149,21 +149,21 @@ public: /** * @return the current position in the buffer */ - uint32_t GetCurrentPosition() const { return m_currentIndex; } + uint GetCurrentPosition() const { return m_currentIndex; } /** * @return the number of index spaces left between the current position * and the end of the buffer */ - uint32_t GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); } + uint GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); } private: stl::vector m_buffer; - uint32_t m_currentIndex; + uint m_currentIndex; }; -inline void IndexBuffer::SetIndex(uint32_t index, uint16_t value) +inline void IndexBuffer::SetIndex(uint index, uint16_t value) { m_buffer[index] = value; } @@ -191,10 +191,10 @@ inline BOOL IndexBuffer::MovePrevious() } } -inline void IndexBuffer::Move(int32_t numIndices) +inline void IndexBuffer::Move(int numIndices) { // m_currentIndex is unsigned, so detect when we would go negative beforehand - if (numIndices < 0 && (uint32_t)abs(numIndices) > m_currentIndex) + if (numIndices < 0 && (uint)abs(numIndices) > m_currentIndex) m_currentIndex = 0; else { diff --git a/src/framework/graphics/renderbuffer.cpp b/src/framework/graphics/renderbuffer.cpp index 8d44437..0e063e2 100644 --- a/src/framework/graphics/renderbuffer.cpp +++ b/src/framework/graphics/renderbuffer.cpp @@ -15,7 +15,7 @@ Renderbuffer::Renderbuffer() m_type = FRAMEBUFFER_DATA_NONE; } -BOOL Renderbuffer::Initialize(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t 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) @@ -58,7 +58,7 @@ BOOL Renderbuffer::CreateRenderbuffer() { ASSERT(m_renderbufferName == 0); - uint32_t format = 0; + uint format = 0; #ifdef MOBILE switch (m_type) { diff --git a/src/framework/graphics/renderbuffer.h b/src/framework/graphics/renderbuffer.h index 6531d28..fc8c06f 100644 --- a/src/framework/graphics/renderbuffer.h +++ b/src/framework/graphics/renderbuffer.h @@ -31,22 +31,22 @@ public: * @param format the type of data this renderbuffer contains * @return TRUE if the renderbuffer was created successfully */ - BOOL Initialize(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t 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 */ - uint32_t GetRenderbufferName() const { return m_renderbufferName; } + uint GetRenderbufferName() const { return m_renderbufferName; } /** * @return the width of the renderbuffer in pixels */ - uint16_t GetWidth() const { return m_width; } + uint GetWidth() const { return m_width; } /** * @return the height of the renderbuffer in pixels */ - uint16_t GetHeight() const { return m_height; } + uint GetHeight() const { return m_height; } /** * @return the type of data this renderbuffer contains @@ -71,9 +71,9 @@ public: private: BOOL CreateRenderbuffer(); - uint32_t m_renderbufferName; - uint16_t m_width; - uint16_t m_height; + uint m_renderbufferName; + uint m_width; + uint m_height; FRAMEBUFFER_DATA_TYPE m_type; }; diff --git a/src/framework/graphics/shader.cpp b/src/framework/graphics/shader.cpp index 4f8ed9e..92b58ac 100644 --- a/src/framework/graphics/shader.cpp +++ b/src/framework/graphics/shader.cpp @@ -27,8 +27,8 @@ STATIC_ASSERT(sizeof(Vector4) == 4 * sizeof(float)); STATIC_ASSERT(sizeof(Quaternion) == 4 * sizeof(float)); STATIC_ASSERT(sizeof(Matrix3x3) == 9 * sizeof(float)); STATIC_ASSERT(sizeof(Matrix4x4) == 16 * sizeof(float)); -STATIC_ASSERT(sizeof(Point2) == 2 * sizeof(int32_t)); -STATIC_ASSERT(sizeof(Point3) == 3 * sizeof(int32_t)); +STATIC_ASSERT(sizeof(Point2) == 2 * sizeof(int)); +STATIC_ASSERT(sizeof(Point3) == 3 * sizeof(int)); Shader::Shader() { @@ -352,7 +352,7 @@ void Shader::LoadUniformInfo() char *uniformName = new char[maxUniformNameLength]; // get info about each uniform - for (int32_t i = 0; i < numUniforms; ++i) + for (int i = 0; i < numUniforms; ++i) { GLint size; GLenum type; @@ -364,9 +364,9 @@ void Shader::LoadUniformInfo() // store the uniform info ShaderUniform uniform; - uniform.location = (uint32_t)location; - uniform.type = (uint32_t)type; - uniform.size = (uint32_t)size; + uniform.location = (uint)location; + uniform.type = (uint)type; + uniform.size = (uint)size; stl::string name = uniformName; // it seems Windows/Mac (possibly Linux too) have differing opinions on @@ -395,7 +395,7 @@ void Shader::LoadAttributeInfo() // sanity checking, which only matters for shader reloading (e.g. when a context is lost) if (m_attributeMapping != NULL) { - ASSERT((uint32_t)numAttributes == m_numAttributes); + ASSERT((uint)numAttributes == m_numAttributes); } m_numAttributes = numAttributes; @@ -419,7 +419,7 @@ void Shader::LoadAttributeInfo() char *attributeName = new char[maxAttributeNameLength]; // get info about each attribute - for (int32_t i = 0; i < numAttributes; ++i) + for (int i = 0; i < numAttributes; ++i) { GLint size; GLenum type; @@ -431,9 +431,9 @@ void Shader::LoadAttributeInfo() // store the attribute info ShaderAttribute attribute; - attribute.location = (uint32_t)location; - attribute.type = (uint32_t)type; - attribute.size = (uint32_t)size; + attribute.location = (uint)location; + attribute.type = (uint)type; + attribute.size = (uint)size; attribute.isTypeBound = FALSE; stl::string name = attributeName; @@ -565,7 +565,7 @@ void Shader::SetUniform(const stl::string &name, float x) } } -void Shader::SetUniform(const stl::string &name, int32_t x) +void Shader::SetUniform(const stl::string &name, int x) { if (m_isBound) { @@ -621,7 +621,7 @@ void Shader::SetUniform(const stl::string &name, const Vector2 &v) } } -void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y) +void Shader::SetUniform(const stl::string &name, int x, int y) { if (m_isBound) { @@ -699,7 +699,7 @@ void Shader::SetUniform(const stl::string &name, const Vector3 &v) } } -void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z) +void Shader::SetUniform(const stl::string &name, int x, int y, int z) { if (m_isBound) { @@ -823,7 +823,7 @@ void Shader::SetUniform(const stl::string &name, const Color &c) } } -void Shader::SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z, int32_t w) +void Shader::SetUniform(const stl::string &name, int x, int y, int z, int w) { if (m_isBound) { @@ -880,7 +880,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 &m) } } -void Shader::SetUniform(const stl::string &name, const float *x, uint32_t count) +void Shader::SetUniform(const stl::string &name, const float *x, uint count) { if (m_isBound) { @@ -895,7 +895,7 @@ void Shader::SetUniform(const stl::string &name, const float *x, uint32_t count) } } -void Shader::SetUniform(const stl::string &name, const Vector2 *v, uint32_t count) +void Shader::SetUniform(const stl::string &name, const Vector2 *v, uint count) { if (m_isBound) { @@ -913,7 +913,7 @@ void Shader::SetUniform(const stl::string &name, const Vector2 *v, uint32_t coun } } -void Shader::SetUniform(const stl::string &name, const Vector3 *v, uint32_t count) +void Shader::SetUniform(const stl::string &name, const Vector3 *v, uint count) { if (m_isBound) { @@ -931,7 +931,7 @@ void Shader::SetUniform(const stl::string &name, const Vector3 *v, uint32_t coun } } -void Shader::SetUniform(const stl::string &name, const Vector4 *v, uint32_t count) +void Shader::SetUniform(const stl::string &name, const Vector4 *v, uint count) { if (m_isBound) { @@ -949,7 +949,7 @@ void Shader::SetUniform(const stl::string &name, const Vector4 *v, uint32_t coun } } -void Shader::SetUniform(const stl::string &name, const Quaternion *q, uint32_t count) +void Shader::SetUniform(const stl::string &name, const Quaternion *q, uint count) { if (m_isBound) { @@ -968,7 +968,7 @@ void Shader::SetUniform(const stl::string &name, const Quaternion *q, uint32_t c } } -void Shader::SetUniform(const stl::string &name, const Color *c, uint32_t count) +void Shader::SetUniform(const stl::string &name, const Color *c, uint count) { if (m_isBound) { @@ -987,7 +987,7 @@ void Shader::SetUniform(const stl::string &name, const Color *c, uint32_t count) } } -void Shader::SetUniform(const stl::string &name, const Matrix3x3 *m, uint32_t count) +void Shader::SetUniform(const stl::string &name, const Matrix3x3 *m, uint count) { if (m_isBound) { @@ -1006,7 +1006,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix3x3 *m, uint32_t co } } -void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint32_t count) +void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint count) { if (m_isBound) { @@ -1025,7 +1025,7 @@ void Shader::SetUniform(const stl::string &name, const Matrix4x4 *m, uint32_t co } } -void Shader::MapAttributeToVboAttribIndex(const stl::string &name, uint32_t vboAttribIndex) +void Shader::MapAttributeToVboAttribIndex(const stl::string &name, uint vboAttribIndex) { ShaderAttribute *attribute = GetAttribute(name); ASSERT(attribute != NULL); diff --git a/src/framework/graphics/shader.h b/src/framework/graphics/shader.h index 12cf32f..e44cd7a 100644 --- a/src/framework/graphics/shader.h +++ b/src/framework/graphics/shader.h @@ -85,7 +85,7 @@ public: /** * @return the OpenGL program ID that can be bound */ - uint32_t GetProgramId() const { return m_programId; } + uint GetProgramId() const { return m_programId; } /** * Checks if this shader contains a uniform. Note that the GLSL compiler @@ -114,7 +114,7 @@ public: * Sets the value of a uniform. * @param name the name of the uniform to set */ - void SetUniform(const stl::string &name, int32_t x); + void SetUniform(const stl::string &name, int x); /** * Sets the value of a uniform. @@ -132,7 +132,7 @@ public: * Sets the value of a uniform. * @param name the name of the uniform to set */ - void SetUniform(const stl::string &name, int32_t x, int32_t y); + void SetUniform(const stl::string &name, int x, int y); /** * Sets the value of a uniform. @@ -156,7 +156,7 @@ public: * Sets the value of a uniform. * @param name the name of the uniform to set */ - void SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z); + void SetUniform(const stl::string &name, int x, int y, int z); /** * Sets the value of a uniform. @@ -192,7 +192,7 @@ public: * Sets the value of a uniform. * @param name the name of the uniform to set */ - void SetUniform(const stl::string &name, int32_t x, int32_t y, int32_t z, int32_t w); + void SetUniform(const stl::string &name, int x, int y, int z, int w); /** * Sets the value of a uniform. @@ -206,19 +206,19 @@ public: */ void SetUniform(const stl::string &name, const Matrix4x4 &m); - void SetUniform(const stl::string &name, const float *x, uint32_t count); - void SetUniform(const stl::string &name, const Vector2 *v, uint32_t count); - void SetUniform(const stl::string &name, const Vector3 *v, uint32_t count); - void SetUniform(const stl::string &name, const Vector4 *v, uint32_t count); - void SetUniform(const stl::string &name, const Quaternion *q, uint32_t count); - void SetUniform(const stl::string &name, const Color *c, uint32_t count); - void SetUniform(const stl::string &name, const Matrix3x3 *m, uint32_t count); - void SetUniform(const stl::string &name, const Matrix4x4 *m, uint32_t count); + void SetUniform(const stl::string &name, const float *x, uint count); + void SetUniform(const stl::string &name, const Vector2 *v, uint count); + void SetUniform(const stl::string &name, const Vector3 *v, uint count); + void SetUniform(const stl::string &name, const Vector4 *v, uint count); + void SetUniform(const stl::string &name, const Quaternion *q, uint count); + void SetUniform(const stl::string &name, const Color *c, uint count); + void SetUniform(const stl::string &name, const Matrix3x3 *m, uint count); + void SetUniform(const stl::string &name, const Matrix4x4 *m, uint count); /** * @return the number of attributes used in this shader */ - uint32_t GetNumAttributes() const { return m_numAttributes; } + uint GetNumAttributes() const { return m_numAttributes; } /** * Returns whether the given shader attribute has been mapped to a standard @@ -228,7 +228,7 @@ public: * @return TRUE if this shader attribute was mapped to a standard attribute * type or FALSE if it wasn't */ - BOOL IsAttributeMappedToStandardType(uint32_t attribIndex) const; + BOOL IsAttributeMappedToStandardType(uint attribIndex) const; /** * Gets a vertex buffer object attribute index that corresponds to the @@ -238,7 +238,7 @@ public: * @return an index for a vertex buffer object's attributes that * corresponds to the specified shader attribute */ - uint32_t GetAttributeMappedBufferIndex(uint32_t attribIndex) const; + uint GetAttributeMappedBufferIndex(uint attribIndex) const; /** * Gets the standard attribute type mapping corresponding to the given @@ -248,7 +248,7 @@ public: * @return the standard attribute type mapping associated with this * shader attribute */ - VERTEX_STANDARD_ATTRIBS GetAttributeMappedStandardType(uint32_t attribIndex) const; + VERTEX_STANDARD_ATTRIBS GetAttributeMappedStandardType(uint attribIndex) const; /** * Maps the given shader attribute to an index that will be used to refer @@ -259,7 +259,7 @@ public: * @param vboAttribIndex the index value to map that will be used to refer * to an attribute in bound vertex buffer objects */ - void MapAttributeToVboAttribIndex(const stl::string &name, uint32_t vboAttribIndex); + void MapAttributeToVboAttribIndex(const stl::string &name, uint vboAttribIndex); /** * Maps the given shader attribute so that it will correspond to an @@ -370,15 +370,15 @@ private: BOOL m_vertexShaderCompileStatus; BOOL m_fragmentShaderCompileStatus; BOOL m_linkStatus; - uint32_t m_vertexShaderId; - uint32_t m_fragmentShaderId; - uint32_t m_programId; + uint m_vertexShaderId; + uint m_fragmentShaderId; + uint m_programId; BOOL m_isBound; ShaderUniformMap m_uniforms; ShaderAttributeMap m_attributes; ShaderAttributeMapInfo *m_attributeMapping; - uint32_t m_numAttributes; + uint m_numAttributes; CachedShaderUniformMap m_cachedUniforms; }; @@ -391,17 +391,17 @@ inline BOOL Shader::IsReadyForUse() const return FALSE; } -inline BOOL Shader::IsAttributeMappedToStandardType(uint32_t attribIndex) const +inline BOOL Shader::IsAttributeMappedToStandardType(uint attribIndex) const { return m_attributeMapping[attribIndex].usesStandardType; } -inline uint32_t Shader::GetAttributeMappedBufferIndex(uint32_t attribIndex) const +inline uint Shader::GetAttributeMappedBufferIndex(uint attribIndex) const { return m_attributeMapping[attribIndex].attribIndex; } -inline VERTEX_STANDARD_ATTRIBS Shader::GetAttributeMappedStandardType(uint32_t attribIndex) const +inline VERTEX_STANDARD_ATTRIBS Shader::GetAttributeMappedStandardType(uint attribIndex) const { return m_attributeMapping[attribIndex].standardType; } diff --git a/src/framework/graphics/shaderstructs.h b/src/framework/graphics/shaderstructs.h index 9fafc58..054440f 100644 --- a/src/framework/graphics/shaderstructs.h +++ b/src/framework/graphics/shaderstructs.h @@ -12,9 +12,9 @@ */ struct ShaderUniform { - uint32_t location; - uint32_t type; - uint32_t size; + uint location; + uint type; + uint size; }; /** @@ -22,9 +22,9 @@ struct ShaderUniform */ struct ShaderAttribute { - uint32_t location; - uint32_t type; - uint32_t size; + uint location; + uint type; + uint size; BOOL isTypeBound; }; @@ -35,7 +35,7 @@ struct ShaderAttributeMapInfo { BOOL usesStandardType; VERTEX_STANDARD_ATTRIBS standardType; - uint32_t attribIndex; + uint attribIndex; }; /** @@ -69,7 +69,7 @@ struct CachedShaderUniform } f1; struct { - int32_t x; + int x; } i1; struct { @@ -78,8 +78,8 @@ struct CachedShaderUniform } f2; struct { - int32_t x; - int32_t y; + int x; + int y; } i2; struct { @@ -89,9 +89,9 @@ struct CachedShaderUniform } f3; struct { - int32_t x; - int32_t y; - int32_t z; + int x; + int y; + int z; } i3; struct { @@ -102,10 +102,10 @@ struct CachedShaderUniform } f4; struct { - int32_t x; - int32_t y; - int32_t z; - int32_t w; + int x; + int y; + int z; + int w; } i4; struct { @@ -121,7 +121,7 @@ struct CachedShaderUniform struct CachedShaderArrayUniform { CACHED_SHADER_UNIFORM_TYPE type; - uint32_t count; + uint count; float *values; CachedShaderArrayUniform() diff --git a/src/framework/graphics/spritebatch.cpp b/src/framework/graphics/spritebatch.cpp index fb2ddc6..1f926ca 100644 --- a/src/framework/graphics/spritebatch.cpp +++ b/src/framework/graphics/spritebatch.cpp @@ -129,25 +129,25 @@ void SpriteBatch::Begin(const RenderState &renderState, const BlendState &blendS InternalBegin(&renderState, &blendState, shader); } -void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, const Color &color) +void SpriteBatch::Render(const Texture *texture, int x, int y, const Color &color) { y = FixYCoord(y, texture->GetHeight()); AddSprite(texture, x, y, x + texture->GetWidth(), y + texture->GetHeight(), 0, 0, texture->GetWidth(), texture->GetHeight(), color); } -void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color) +void SpriteBatch::Render(const Texture *texture, int x, int y, uint width, uint height, const Color &color) { y = FixYCoord(y, height); AddSprite(texture, x, y, x + width, y + height, 0, 0, width, height, color); } -void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) +void SpriteBatch::Render(const Texture *texture, int x, int y, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) { y = FixYCoord(y, texture->GetHeight()); AddSprite(texture, x, y, x + texture->GetWidth(), y + texture->GetHeight(), texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color); } -void SpriteBatch::Render(const Texture *texture, int16_t x, int16_t y, uint16_t width, uint16_t height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) +void SpriteBatch::Render(const Texture *texture, int x, int y, uint width, uint height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) { y = FixYCoord(y, height); AddSprite(texture, x, y, x + width, y + height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color); @@ -163,7 +163,7 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, c Render(texture, screenCoordinates.x, screenCoordinates.y, color); } -void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color) +void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint width, uint height, const Color &color) { Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection); @@ -183,7 +183,7 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, f Render(texture, screenCoordinates.x, screenCoordinates.y, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color); } -void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) +void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, uint width, uint height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) { Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection); @@ -193,17 +193,17 @@ void SpriteBatch::Render(const Texture *texture, const Vector3 &worldPosition, u Render(texture, screenCoordinates.x, screenCoordinates.y, width, height, texCoordLeft, texCoordTop, texCoordRight, texCoordBottom, color); } -void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, const Color &color) +void SpriteBatch::Render(const TextureAtlas *atlas, uint index, int x, int y, const Color &color) { const RectF *texCoords = &atlas->GetTile(index).texCoords; const Rect *tileSize = &atlas->GetTile(index).dimensions; const Texture *texture = atlas->GetTexture(); - y = FixYCoord(y, (uint16_t)tileSize->GetHeight()); + y = FixYCoord(y, (uint)tileSize->GetHeight()); AddSprite(texture, x, y, x + tileSize->GetWidth(), y + tileSize->GetHeight(), texCoords->left, texCoords->top, texCoords->right, texCoords->bottom, color); } -void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color) +void SpriteBatch::Render(const TextureAtlas *atlas, uint index, int x, int y, uint width, uint height, const Color &color) { const RectF *texCoords = &atlas->GetTile(index).texCoords; const Texture *texture = atlas->GetTexture(); @@ -212,7 +212,7 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, int16_t x, i AddSprite(texture, x, y, x + width, y + height, texCoords->left, texCoords->top, texCoords->right, texCoords->bottom, color); } -void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, const Color &color) +void SpriteBatch::Render(const TextureAtlas *atlas, uint index, const Vector3 &worldPosition, const Color &color) { Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection); @@ -223,7 +223,7 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector Render(atlas, index, screenCoordinates.x, screenCoordinates.y, color); } -void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color) +void SpriteBatch::Render(const TextureAtlas *atlas, uint index, const Vector3 &worldPosition, uint width, uint height, const Color &color) { Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection); @@ -233,14 +233,14 @@ void SpriteBatch::Render(const TextureAtlas *atlas, uint32_t index, const Vector Render(atlas, index, screenCoordinates.x, screenCoordinates.y, width, height, color); } -void SpriteBatch::Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *text) +void SpriteBatch::Render(const SpriteFont *font, int x, int y, const Color &color, const char *text) { size_t textLength = strlen(text); - y = FixYCoord(y, (uint16_t)font->GetLetterHeight()); + y = FixYCoord(y, (uint)font->GetLetterHeight()); - int16_t drawX = x; - int16_t drawY = y; + int drawX = x; + int drawY = y; for (size_t i = 0; i < textLength; ++i) { @@ -267,13 +267,13 @@ void SpriteBatch::Render(const SpriteFont *font, int16_t x, int16_t y, const Col } } -void SpriteBatch::Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *text) +void SpriteBatch::Render(const SpriteFont *font, int x, int y, const Color &color, float scale, const char *text) { size_t textLength = strlen(text); float scaledLetterHeight = (float)font->GetLetterHeight() * scale; - y = (int16_t)FixYCoord(y, scaledLetterHeight); + y = (int)FixYCoord(y, scaledLetterHeight); float drawX = (float)x; float drawY = (float)y; @@ -310,8 +310,8 @@ void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, c { Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection); - uint16_t textWidth = 0; - uint16_t textHeight = 0; + uint textWidth = 0; + uint textHeight = 0; font->MeasureString(&textWidth, &textHeight, text); screenCoordinates.x -= textWidth / 2; @@ -324,8 +324,8 @@ void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, c { Point2 screenCoordinates = m_graphicsDevice->GetViewContext()->GetCamera()->Project(worldPosition, m_previousModelview, m_previousProjection); - uint16_t textWidth = 0; - uint16_t textHeight = 0; + uint textWidth = 0; + uint textHeight = 0; font->MeasureString(&textWidth, &textHeight, scale, text); screenCoordinates.x -= textWidth / 2; @@ -334,7 +334,7 @@ void SpriteBatch::Render(const SpriteFont *font, const Vector3 &worldPosition, c Render(font, screenCoordinates.x, screenCoordinates.y, color, scale, text); } -void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *format, ...) +void SpriteBatch::Printf(const SpriteFont *font, int x, int y, const Color &color, const char *format, ...) { va_list args; va_start(args, format); @@ -344,7 +344,7 @@ void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Col Render(font, x, y, color, __spriteBatch_printfBuffer); } -void SpriteBatch::Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *format, ...) +void SpriteBatch::Printf(const SpriteFont *font, int x, int y, const Color &color, float scale, const char *format, ...) { va_list args; va_start(args, format); @@ -374,17 +374,17 @@ void SpriteBatch::Printf(const SpriteFont *font, const Vector3 &worldPosition, c Render(font, worldPosition, color, scale, __spriteBatch_printfBuffer); } -void SpriteBatch::RenderLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, const Color &color) +void SpriteBatch::RenderLine(int x1, int y1, int x2, int y2, const Color &color) { - y1 = FixYCoord(y1, (uint16_t)1); - y2 = FixYCoord(y2, (uint16_t)1); + y1 = FixYCoord(y1, (uint)1); + y2 = FixYCoord(y2, (uint)1); AddLine(x1, y1, x2, y2, color); } -void SpriteBatch::RenderBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color) +void SpriteBatch::RenderBox(int left, int top, int right, int bottom, const Color &color) { - uint16_t height = bottom - top; + uint height = bottom - top; top = FixYCoord(top, height); bottom = top + height; @@ -396,12 +396,12 @@ void SpriteBatch::RenderBox(int16_t left, int16_t top, int16_t right, int16_t bo void SpriteBatch::RenderBox(const Rect &rect, const Color &color) { - int16_t left = (int16_t)rect.left; - int16_t top = (int16_t)rect.top; - int16_t right = (int16_t)rect.right; - int16_t bottom = (int16_t)rect.bottom; + int left = (int)rect.left; + int top = (int)rect.top; + int right = (int)rect.right; + int bottom = (int)rect.bottom; - uint16_t height = bottom - top; + uint height = bottom - top; top = FixYCoord(top, height); bottom = top + height; @@ -411,9 +411,9 @@ void SpriteBatch::RenderBox(const Rect &rect, const Color &color) AddLine(left, top, right, top, color); } -void SpriteBatch::RenderFilledBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color) +void SpriteBatch::RenderFilledBox(int left, int top, int right, int bottom, const Color &color) { - uint16_t height = bottom - top; + uint height = bottom - top; top = FixYCoord(top, height); bottom = top + height; @@ -422,25 +422,25 @@ void SpriteBatch::RenderFilledBox(int16_t left, int16_t top, int16_t right, int1 void SpriteBatch::RenderFilledBox(const Rect &rect, const Color &color) { - int16_t left = (int16_t)rect.left; - int16_t top = (int16_t)rect.top; - int16_t right = (int16_t)rect.right; - int16_t bottom = (int16_t)rect.bottom; + int left = (int)rect.left; + int top = (int)rect.top; + int right = (int)rect.right; + int bottom = (int)rect.bottom; - uint16_t height = bottom - top; + uint height = bottom - top; top = FixYCoord(top, height); bottom = top + height; AddFilledBox(left, top, right, bottom, color); } -void SpriteBatch::AddSprite(const Texture *texture, int16_t destLeft, int16_t destTop, int16_t destRight, int16_t destBottom, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, 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); - uint16_t width = sourceRight - sourceLeft; + uint width = sourceRight - sourceLeft; ASSERT(width > 0); - uint16_t height = sourceBottom - sourceTop; + uint height = sourceBottom - sourceTop; ASSERT(height > 0); float texLeft = sourceLeft / (float)width; float texTop = sourceTop / (float)height; @@ -462,7 +462,7 @@ void SpriteBatch::AddSprite(const Texture *texture, int16_t destLeft, int16_t de ++m_currentSpritePointer; } -void SpriteBatch::AddSprite(const Texture *texture, int16_t destLeft, int16_t destTop, int16_t destRight, int16_t destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) +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); @@ -555,9 +555,9 @@ BOOL SpriteBatch::ClipSpriteCoords(float &left, float &top, float &right, float return TRUE; } -void SpriteBatch::SetSpriteInfo(uint32_t spriteIndex, const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color) +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) { - uint32_t base = m_vertices->GetCurrentPosition(); + uint base = m_vertices->GetCurrentPosition(); m_vertices->SetPosition2(base, destLeft, destTop); m_vertices->SetPosition2(base + 1, destRight, destTop); @@ -606,9 +606,9 @@ void SpriteBatch::AddLine(float x1, float y1, float x2, float y2, const Color &c ++m_currentSpritePointer; } -void SpriteBatch::SetLineInfo(uint32_t spriteIndex, float x1, float y1, float x2, float y2, const Color &color) +void SpriteBatch::SetLineInfo(uint spriteIndex, float x1, float y1, float x2, float y2, const Color &color) { - uint32_t base = m_vertices->GetCurrentPosition(); + uint base = m_vertices->GetCurrentPosition(); m_vertices->SetPosition2(base, x1, y1); m_vertices->SetPosition2(base + 1, x2, y2); @@ -653,9 +653,9 @@ void SpriteBatch::AddFilledBox(float left, float top, float right, float bottom, ++m_currentSpritePointer; } -void SpriteBatch::SetFilledBoxInfo(uint32_t spriteIndex, float left, float top, float right, float bottom, const Color &color) +void SpriteBatch::SetFilledBoxInfo(uint spriteIndex, float left, float top, float right, float bottom, const Color &color) { - uint32_t base = m_vertices->GetCurrentPosition(); + uint base = m_vertices->GetCurrentPosition(); m_vertices->SetPosition2(base, left, top); m_vertices->SetPosition2(base + 1, right, top); @@ -764,7 +764,7 @@ void SpriteBatch::RenderQueue() const SpriteBatchEntity *firstEntity = &m_entities[0]; const SpriteBatchEntity *lastEntity = &m_entities[0]; - for (uint32_t i = 0; i < m_currentSpritePointer; ++i) + for (uint i = 0; i < m_currentSpritePointer; ++i) { if (lastEntity->type != m_entities[i].type) { @@ -799,8 +799,8 @@ void SpriteBatch::RenderQueue() void SpriteBatch::RenderQueueRange(const SpriteBatchEntity *firstEntity, const SpriteBatchEntity *lastEntity) { - uint32_t startVertex = firstEntity->firstVertex; - uint32_t lastVertex = lastEntity->lastVertex + 1; + uint startVertex = firstEntity->firstVertex; + uint lastVertex = lastEntity->lastVertex + 1; if (lastEntity->texture != NULL) { @@ -832,7 +832,7 @@ void SpriteBatch::CheckForNewSpriteSpace(SPRITEBATCH_ENTITY_TYPE type) // time. This is because we use std::vector::push_back to expand the // entity object storage by only one. - uint32_t verticesRequired = GetVerticesRequiredFor(type); + uint verticesRequired = GetVerticesRequiredFor(type); if (m_vertices->GetRemainingSpace() < verticesRequired) { // need to add more space for a new entity of the specified type to fit @@ -844,9 +844,9 @@ void SpriteBatch::CheckForNewSpriteSpace(SPRITEBATCH_ENTITY_TYPE type) } } -inline uint32_t SpriteBatch::GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type) +inline uint SpriteBatch::GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type) { - uint32_t numVerticesRequired = 0; + uint numVerticesRequired = 0; switch (type) { case SPRITEBATCH_ENTITY_SPRITE: numVerticesRequired = 6; break; @@ -858,12 +858,12 @@ inline uint32_t SpriteBatch::GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type return numVerticesRequired; } -inline int16_t SpriteBatch::FixYCoord(int16_t y, uint16_t sourceHeight) const +inline int SpriteBatch::FixYCoord(int y, uint sourceHeight) const { return m_graphicsDevice->GetViewContext()->GetViewportHeight() - y - sourceHeight; } -inline float SpriteBatch::FixYCoord(int16_t y, float sourceHeight) const +inline float SpriteBatch::FixYCoord(int y, float sourceHeight) const { return (float)m_graphicsDevice->GetViewContext()->GetViewportHeight() - (float)y - sourceHeight; } @@ -873,8 +873,8 @@ void SpriteBatch::SetClipRegion(const Rect &rect) ASSERT(m_begunRendering == TRUE); m_isClipping = TRUE; - int32_t fixedTop = ((int32_t)m_graphicsDevice->GetViewContext()->GetViewportHeight() - rect.top - rect.GetHeight()); - int32_t fixedBottom = fixedTop + rect.GetHeight(); + int fixedTop = ((int)m_graphicsDevice->GetViewContext()->GetViewportHeight() - rect.top - rect.GetHeight()); + int fixedBottom = fixedTop + rect.GetHeight(); m_clipRegion.left = (float)rect.left; m_clipRegion.top = (float)fixedTop; @@ -882,14 +882,14 @@ void SpriteBatch::SetClipRegion(const Rect &rect) m_clipRegion.bottom = (float)fixedBottom; } -void SpriteBatch::SetClipRegion(int16_t left, int16_t top, int16_t right, int16_t bottom) +void SpriteBatch::SetClipRegion(int left, int top, int right, int bottom) { ASSERT(m_begunRendering == TRUE); m_isClipping = TRUE; - int16_t height = bottom - top; - int16_t fixedTop = (m_graphicsDevice->GetViewContext()->GetViewportHeight() - top - height); - int16_t fixedBottom = fixedTop + height; + int height = bottom - top; + int fixedTop = (m_graphicsDevice->GetViewContext()->GetViewportHeight() - top - height); + int fixedBottom = fixedTop + height; m_clipRegion.left = (float)left; m_clipRegion.top = (float)fixedTop; diff --git a/src/framework/graphics/spritebatch.h b/src/framework/graphics/spritebatch.h index e0bac9e..d17e27e 100644 --- a/src/framework/graphics/spritebatch.h +++ b/src/framework/graphics/spritebatch.h @@ -29,8 +29,8 @@ struct SpriteBatchEntity { const Texture *texture; SPRITEBATCH_ENTITY_TYPE type; - uint32_t firstVertex; - uint32_t lastVertex; + uint firstVertex; + uint lastVertex; }; /** @@ -85,7 +85,7 @@ public: * @param y Y coordinate to render at * @param color color to tint the texture with */ - void Render(const Texture *texture, int16_t x, int16_t y, const Color &color = COLOR_WHITE); + void Render(const Texture *texture, int x, int y, const Color &color = COLOR_WHITE); /** * Renders a texture as a sprite. @@ -95,7 +95,7 @@ public: * @param height custom height to scale the texture to during rendering * @param color color to tint the texture with */ - void Render(const Texture *texture, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color = COLOR_WHITE); + void Render(const Texture *texture, int x, int y, uint width, uint height, const Color &color = COLOR_WHITE); /** * Renders a texture as a sprite. @@ -107,7 +107,7 @@ public: * @param texCoordBottom bottom V texture coordinate defining a sub-region of the texture to render * @param color color to tint the texture with */ - void Render(const Texture *texture, int16_t x, int16_t y, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE); + void Render(const Texture *texture, int x, int y, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE); /** * Renders a texture as a sprite. @@ -121,7 +121,7 @@ public: * @param texCoordBottom bottom V texture coordinate defining a sub-region of the texture to render * @param color color to tint the texture with */ - void Render(const Texture *texture, int16_t x, int16_t y, uint16_t width, uint16_t height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE); + void Render(const Texture *texture, int x, int y, uint width, uint height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE); /** * Renders a texture as a sprite. The given world position will be @@ -141,7 +141,7 @@ public: * @param height custom height to scale the texture to during rendering * @param color color to tint the texture with */ - void Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color = COLOR_WHITE); + void Render(const Texture *texture, const Vector3 &worldPosition, uint width, uint height, const Color &color = COLOR_WHITE); /** * Renders a texture as a sprite. The given world position will be @@ -169,7 +169,7 @@ public: * @param texCoordBottom bottom V texture coordinate defining a sub-region of the texture to render * @param color color to tint the texture with */ - void Render(const Texture *texture, const Vector3 &worldPosition, uint16_t width, uint16_t height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE); + void Render(const Texture *texture, const Vector3 &worldPosition, uint width, uint height, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color = COLOR_WHITE); /** * Renders a texture atlas sub-texture / tile as a sprite. @@ -178,7 +178,7 @@ public: * @param y Y coordinate to render at * @param color color to tint the texture with */ - void Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, const Color &color = COLOR_WHITE); + void Render(const TextureAtlas *atlas, uint index, int x, int y, const Color &color = COLOR_WHITE); /** * Renders a texture atlas sub-texture / tile as a sprite. @@ -189,7 +189,7 @@ public: * @param height custom height to scale the texture to during rendering * @param color color to tint the texture with */ - void Render(const TextureAtlas *atlas, uint32_t index, int16_t x, int16_t y, uint16_t width, uint16_t height, const Color &color = COLOR_WHITE); + void Render(const TextureAtlas *atlas, uint index, int x, int y, uint width, uint height, const Color &color = COLOR_WHITE); /** * Renders a texture atlas sub-texture / tile as a sprite. The given @@ -199,7 +199,7 @@ public: * @param worldPosition 3D world position to render at * @param color color to tint the texture with */ - void Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, const Color &color = COLOR_WHITE); + void Render(const TextureAtlas *atlas, uint index, const Vector3 &worldPosition, const Color &color = COLOR_WHITE); /** * Renders a texture atlas sub-texture / tile as a sprite. The given @@ -211,7 +211,7 @@ public: * @param height custom height to scale the texture to during rendering * @param color color to tint the texture with */ - void Render(const TextureAtlas *atlas, uint32_t index, const Vector3 &worldPosition, uint16_t width, uint16_t height, const Color &color = COLOR_WHITE); + void Render(const TextureAtlas *atlas, uint index, const Vector3 &worldPosition, uint width, uint height, const Color &color = COLOR_WHITE); /** * Renders text as series of sprites. @@ -221,7 +221,7 @@ public: * @param color the color to render the text in * @param text the string of text to render */ - void Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *text); + void Render(const SpriteFont *font, int x, int y, const Color &color, const char *text); /** * Renders text as series of sprites. @@ -232,7 +232,7 @@ public: * @param scale scaling factor to render with * @param text the string of text to render */ - void Render(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *text); + void Render(const SpriteFont *font, int x, int y, const Color &color, float scale, const char *text); /** * Renders text as series of sprites. The given world position will be @@ -265,7 +265,7 @@ public: * @param color the color to render the text in * @param format the string of text to render */ - void Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, const char *format, ...); + void Printf(const SpriteFont *font, int x, int y, const Color &color, const char *format, ...); /** * Renders formatted text as series of sprites. @@ -276,7 +276,7 @@ public: * @param scale scaling factor to render with * @param format the string of text to render */ - void Printf(const SpriteFont *font, int16_t x, int16_t y, const Color &color, float scale, const char *format, ...); + void Printf(const SpriteFont *font, int x, int y, const Color &color, float scale, const char *format, ...); /** * Renders formatted text as series of sprites. The given world position @@ -309,7 +309,7 @@ public: * @param y2 Y coordinate of the second point * @param color the color to render the line with */ - void RenderLine(int16_t x1, int16_t y1, int16_t x2, int16_t y2, const Color &color); + void RenderLine(int x1, int y1, int x2, int y2, const Color &color); /** * Renders a box. @@ -319,7 +319,7 @@ public: * @param bottom bottom Y coordinate of the box * @param color the color to render the box with */ - void RenderBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color); + void RenderBox(int left, int top, int right, int bottom, const Color &color); /** * Renders a box. @@ -336,7 +336,7 @@ public: * @param bottom bottom Y coordinate of the box * @param color the color to render the box with */ - void RenderFilledBox(int16_t left, int16_t top, int16_t right, int16_t bottom, const Color &color); + void RenderFilledBox(int left, int top, int right, int bottom, const Color &color); /** * Renders a filled box. @@ -366,7 +366,7 @@ public: * @param right right X coordinate of the clipping region * @param bottom bottom Y coordinate of the clipping region */ - void SetClipRegion(int16_t left, int16_t top, int16_t right, int16_t bottom); + void SetClipRegion(int left, int top, int right, int bottom); /** * Removes the clipping region. All subsequent rendering will no longer @@ -377,18 +377,18 @@ public: private: void InternalBegin(const RenderState *renderState, const BlendState *blendState, SpriteShader *shader); - void AddSprite(const Texture *texture, int16_t destLeft, int16_t destTop, int16_t destRight, int16_t destBottom, uint16_t sourceLeft, uint16_t sourceTop, uint16_t sourceRight, uint16_t sourceBottom, const Color &color); - void AddSprite(const Texture *texture, int16_t destLeft, int16_t destTop, int16_t destRight, int16_t destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color); + 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); - void SetSpriteInfo(uint32_t spriteIndex, const Texture *texture, float destLeft, float destTop, float destRight, float destBottom, float texCoordLeft, float texCoordTop, float texCoordRight, float texCoordBottom, const Color &color); + 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(uint32_t spriteIndex, 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); void AddFilledBox(float left, float top, float right, float bottom, const Color &color); - void SetFilledBoxInfo(uint32_t spriteIndex, 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); void RenderQueue(); @@ -396,9 +396,9 @@ private: void CheckForNewSpriteSpace(SPRITEBATCH_ENTITY_TYPE type); - uint32_t GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type); - int16_t FixYCoord(int16_t y, uint16_t sourceHeight) const; - float FixYCoord(int16_t y, float sourceHeight) const; + uint GetVerticesRequiredFor(SPRITEBATCH_ENTITY_TYPE type); + int FixYCoord(int y, uint sourceHeight) const; + float FixYCoord(int y, float sourceHeight) const; GraphicsDevice *m_graphicsDevice; SpriteShader *m_shader; @@ -410,7 +410,7 @@ private: BlendState m_overrideBlendState; VertexBuffer *m_vertices; stl::vector m_entities; - uint32_t m_currentSpritePointer; + uint m_currentSpritePointer; Matrix4x4 m_previousProjection; Matrix4x4 m_previousModelview; BOOL m_isClipping; diff --git a/src/framework/graphics/spritefont.cpp b/src/framework/graphics/spritefont.cpp index f4abba2..fbc1126 100644 --- a/src/framework/graphics/spritefont.cpp +++ b/src/framework/graphics/spritefont.cpp @@ -23,7 +23,7 @@ SpriteFont::~SpriteFont() SAFE_DELETE(m_texture); } -void SpriteFont::Load(Texture *texture, TextureAtlas *glyphs, uint8_t size) +void SpriteFont::Load(Texture *texture, TextureAtlas *glyphs, uint size) { m_texture = texture; m_glyphs = glyphs; @@ -46,7 +46,7 @@ const TextureAtlasTile& SpriteFont::GetGlyph(unsigned char c) const return m_glyphs->GetTile((int)c - LOW_GLYPH); } -void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, const char *format, ...) const +void SpriteFont::MeasureString(uint *width, uint *height, const char *format, ...) const { if (width == NULL && height == NULL) return; @@ -60,8 +60,8 @@ void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, const char *fo size_t textLength = strlen(buffer); - uint16_t currentMaxWidth = 0; - uint16_t left = 0; + uint currentMaxWidth = 0; + uint left = 0; int numLines = 1; for (size_t i = 0; i < textLength; ++i) @@ -85,10 +85,10 @@ void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, const char *fo if (width != NULL) *width = currentMaxWidth; if (height != NULL) - *height = (uint16_t)(numLines * GetLetterHeight()); + *height = (uint)(numLines * GetLetterHeight()); } -void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, float scale, const char *format, ...) const +void SpriteFont::MeasureString(uint *width, uint *height, float scale, const char *format, ...) const { if (width == NULL && height == NULL) return; @@ -127,8 +127,8 @@ void SpriteFont::MeasureString(uint16_t *width, uint16_t *height, float scale, c } if (width != NULL) - *width = (uint16_t)ceil(currentMaxWidth); + *width = (uint)ceil(currentMaxWidth); if (height != NULL) - *height = (uint16_t)(numLines * scaledLetterHeight); + *height = (uint)(numLines * scaledLetterHeight); } diff --git a/src/framework/graphics/spritefont.h b/src/framework/graphics/spritefont.h index 98575a3..4084e96 100644 --- a/src/framework/graphics/spritefont.h +++ b/src/framework/graphics/spritefont.h @@ -9,8 +9,8 @@ class Texture; class TextureAtlas; struct TextureAtlasTile; -const uint8_t LOW_GLYPH = 32; -const uint8_t HIGH_GLYPH = 127; +const int LOW_GLYPH = 32; +const int HIGH_GLYPH = 127; /** * Represents a font that has been pre-rendered at a given size to a @@ -37,7 +37,7 @@ public: * to the font's individual characters (glyphs) * @param size the size that the glyphs were rendered at */ - void Load(Texture *texture, TextureAtlas *glyphs, uint8_t size); + void Load(Texture *texture, TextureAtlas *glyphs, uint size); /** * Lost OpenGL graphics context callback. This will free the texture @@ -48,7 +48,7 @@ public: /** * @return the size that the glyphs were originally rendered at */ - uint8_t GetSize() const { return m_size; } + uint GetSize() const { return m_size; } /** * @return the texture containing the font glyphs @@ -59,7 +59,7 @@ public: * @return the number of pixels that one line of text rendered with this * font takes up */ - uint8_t GetLetterHeight() const { return m_letterHeight; } + uint GetLetterHeight() const { return m_letterHeight; } /** * @param c the character to get sub-texture dimensions/positioning for @@ -75,7 +75,7 @@ public: * @param height the height in pixels of the rendered text if not NULL * @param format the text to measure */ - void MeasureString(uint16_t *width, uint16_t *height, const char *format, ...) const; + void MeasureString(uint *width, uint *height, const char *format, ...) const; /** * Measures the given string of text and returns the width and height @@ -85,14 +85,14 @@ public: * @param scale a scaling factor for rendering to take into account * @param format the text to measure */ - void MeasureString(uint16_t *width, uint16_t *height, float scale, const char *format, ...) const; + void MeasureString(uint *width, uint *height, float scale, const char *format, ...) const; private: - uint8_t m_size; + uint m_size; Texture *m_texture; TextureAtlas *m_glyphs; - uint8_t m_letterHeight; + uint m_letterHeight; }; #endif diff --git a/src/framework/graphics/spriteshader.cpp b/src/framework/graphics/spriteshader.cpp index 2ea243c..7f693fc 100644 --- a/src/framework/graphics/spriteshader.cpp +++ b/src/framework/graphics/spriteshader.cpp @@ -14,5 +14,5 @@ SpriteShader::~SpriteShader() void SpriteShader::SetTextureHasAlphaOnly(BOOL hasAlphaOnly) { ASSERT(IsReadyForUse() == TRUE); - SetUniform(m_textureHasAlphaOnlyUniform, (int32_t)hasAlphaOnly); + SetUniform(m_textureHasAlphaOnlyUniform, (int)hasAlphaOnly); } diff --git a/src/framework/graphics/texture.cpp b/src/framework/graphics/texture.cpp index 66b0210..9c56dbe 100644 --- a/src/framework/graphics/texture.cpp +++ b/src/framework/graphics/texture.cpp @@ -37,8 +37,8 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image) const void* pixels = image->GetPixels(); TEXTURE_FORMAT format = TEXTURE_FORMAT_NONE; - uint32_t glFormat = 0; - uint32_t glType = GL_UNSIGNED_BYTE; + uint glFormat = 0; + uint glType = GL_UNSIGNED_BYTE; if (image->GetFormat() == IMAGE_FORMAT_ALPHA) { @@ -79,7 +79,7 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, Image *image) return TRUE; } -BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height, TEXTURE_FORMAT textureFormat) +BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint width, uint height, TEXTURE_FORMAT textureFormat) { ASSERT(m_textureName == 0); if (m_textureName != 0) @@ -94,8 +94,8 @@ BOOL Texture::Create(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t he } int bpp = 0; - uint32_t format = 0; - uint32_t type = 0; + uint format = 0; + uint type = 0; GetTextureSpecsFromFormat(textureFormat, &bpp, &format, &type); ASSERT(format != 0); if (format == 0) @@ -142,7 +142,7 @@ void Texture::Release() m_format = TEXTURE_FORMAT_NONE; } -BOOL Texture::Update(Image *image, uint16_t destX, uint16_t destY) +BOOL Texture::Update(Image *image, uint destX, uint destY) { ASSERT(m_textureName != 0); if (m_textureName == 0) @@ -162,8 +162,8 @@ BOOL Texture::Update(Image *image, uint16_t destX, uint16_t destY) ASSERT(destY + image->GetHeight() <= m_height); const void* pixels = image->GetPixels(); - uint32_t glFormat = 0; - uint32_t glType = 0; + uint glFormat = 0; + uint glType = 0; if (image->GetFormat() == IMAGE_FORMAT_ALPHA) { @@ -194,7 +194,7 @@ void Texture::OnLostContext() m_textureName = 0; } -void Texture::GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint32_t *format, uint32_t *type) +void Texture::GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint *format, uint *type) { switch (textureFormat) { diff --git a/src/framework/graphics/texture.h b/src/framework/graphics/texture.h index 430143a..58cb68b 100644 --- a/src/framework/graphics/texture.h +++ b/src/framework/graphics/texture.h @@ -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, uint16_t width, uint16_t height, TEXTURE_FORMAT textureFormat); + BOOL Create(GraphicsDevice *graphicsDevice, uint width, uint height, TEXTURE_FORMAT textureFormat); /** * Frees the texture resources. @@ -51,22 +51,22 @@ public: * @param destY the Y coordinate on the texture to place the new image at * @return TRUE if the texture was updated successfully */ - BOOL Update(Image *image, uint16_t destX = 0, uint16_t destY = 0); + BOOL Update(Image *image, uint destX = 0, uint destY = 0); /** * @return the texture name or ID assigned to this texture by OpenGL */ - uint32_t GetTextureName() const { return m_textureName; } + uint GetTextureName() const { return m_textureName; } /** * @return the width of this texture in pixels */ - uint16_t GetWidth() const { return m_width; } + uint GetWidth() const { return m_width; } /** * @return the height of this texture in pixels */ - uint16_t GetHeight() const { return m_height; } + uint GetHeight() const { return m_height; } /** * @return the pixel format of this texture @@ -86,12 +86,12 @@ public: void OnLostContext(); private: - void GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint32_t *format, uint32_t *type); + void GetTextureSpecsFromFormat(TEXTURE_FORMAT textureFormat, int *bpp, uint *format, uint *type); GraphicsDevice *m_graphicsDevice; - uint32_t m_textureName; - uint16_t m_width; - uint16_t m_height; + uint m_textureName; + uint m_width; + uint m_height; TEXTURE_FORMAT m_format; }; diff --git a/src/framework/graphics/textureatlas.cpp b/src/framework/graphics/textureatlas.cpp index 19e327f..398f69e 100644 --- a/src/framework/graphics/textureatlas.cpp +++ b/src/framework/graphics/textureatlas.cpp @@ -4,7 +4,7 @@ #include "texture.h" -TextureAtlas::TextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset) +TextureAtlas::TextureAtlas(uint textureWidth, uint textureHeight, float texCoordEdgeOffset) { ASSERT(textureWidth > 0); ASSERT(textureHeight > 0); diff --git a/src/framework/graphics/textureatlas.h b/src/framework/graphics/textureatlas.h index b3a9502..df28f50 100644 --- a/src/framework/graphics/textureatlas.h +++ b/src/framework/graphics/textureatlas.h @@ -45,17 +45,17 @@ public: /** * @return the width in pixels of the underlying texture object */ - uint16_t GetWidth() const { return m_textureWidth; } + uint GetWidth() const { return m_textureWidth; } /** * @return the height in pixels of the underlying texture object */ - uint16_t GetHeight() const { return m_textureHeight; } + uint GetHeight() const { return m_textureHeight; } /** * @return the number of sub-textures or tiles currently contained in this atlas */ - uint32_t GetNumTextures() const { return m_tiles.size(); } + uint GetNumTextures() const { return m_tiles.size(); } /** * Gets position and dimension information about a specified @@ -63,7 +63,7 @@ public: * @param index the index of the sub-texture or tile to retrieve * @return the sub-texture/tile's information */ - const TextureAtlasTile& GetTile(uint32_t index) const { return m_tiles[index]; } + const TextureAtlasTile& GetTile(uint index) const { return m_tiles[index]; } /** * Sets the underlying texture object for this atlas. @@ -82,7 +82,7 @@ protected: * help alleviate "texture bleeding" * issues while rendering */ - TextureAtlas(uint16_t textureWidth, uint16_t textureHeight, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET); + TextureAtlas(uint textureWidth, uint textureHeight, float texCoordEdgeOffset = TEXCOORD_EDGE_BLEED_OFFSET); /** * Sets the base texture object. @@ -103,8 +103,8 @@ protected: stl::vector m_tiles; private: - uint16_t m_textureWidth; - uint16_t m_textureHeight; + uint m_textureWidth; + uint m_textureHeight; Texture *m_source; float m_texCoordEdgeOffset; }; diff --git a/src/framework/graphics/vertexattribs.h b/src/framework/graphics/vertexattribs.h index 6ace86e..b7225a3 100644 --- a/src/framework/graphics/vertexattribs.h +++ b/src/framework/graphics/vertexattribs.h @@ -56,14 +56,14 @@ struct VertexBufferAttribute * The number of floating point value components that make up the * attribute. e.g. 3 for a Vector3, 4 for a Color, etc. */ - uint32_t size; + uint size; /** * The offset from the start of a vertex to where this attribute's data * begins. Specified as the number of floating point components * (Multiply by sizeof(float) to get the offset as the number of bytes). */ - uint32_t offset; + uint offset; }; #endif diff --git a/src/framework/graphics/vertexbuffer.cpp b/src/framework/graphics/vertexbuffer.cpp index f2de99b..83ac697 100644 --- a/src/framework/graphics/vertexbuffer.cpp +++ b/src/framework/graphics/vertexbuffer.cpp @@ -44,12 +44,12 @@ void VertexBuffer::Release() BufferObject::Release(); } -BOOL VertexBuffer::Initialize(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes, uint32_t 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, uint32_t numAttributes, uint32_t 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) @@ -88,9 +88,9 @@ BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer if (!BufferObject::Initialize(graphicsDevice, BUFFEROBJECT_TYPE_VERTEX, source->GetUsage())) return FALSE; - uint32_t numAttribs = source->GetNumAttributes(); + uint numAttribs = source->GetNumAttributes(); VERTEX_ATTRIBS *attribs = new VERTEX_ATTRIBS[numAttribs]; - for (uint32_t i = 0; i < numAttribs; ++i) + for (uint i = 0; i < numAttribs; ++i) attribs[i] = source->GetAttributeInfo(i)->standardType; BOOL success = SetSizesAndOffsets(attribs, numAttribs); @@ -105,7 +105,7 @@ BOOL VertexBuffer::Initialize(GraphicsDevice *graphicsDevice, const VertexBuffer return success; } -BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes) +BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint numAttributes) { ASSERT(attributes != NULL); ASSERT(numAttributes > 0); @@ -121,13 +121,13 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t if (m_attribs != NULL) return FALSE; - uint32_t numGpuSlotsUsed = 0; - uint32_t offset = 0; + uint numGpuSlotsUsed = 0; + uint offset = 0; VertexBufferAttribute *attribsInfo = new VertexBufferAttribute[numAttributes]; BOOL success = TRUE; - for (uint32_t i = 0; i < numAttributes; ++i) + for (uint i = 0; i < numAttributes; ++i) { VERTEX_ATTRIBS attrib = attributes[i]; @@ -136,7 +136,7 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t uint8_t standardTypeBitMask = (uint8_t)((uint16_t)attrib >> 8); // using integer division that rounds up (so given size = 13, result is 4, not 3) - uint32_t thisAttribsGpuSlotSize = ((uint32_t)size + (FLOATS_PER_GPU_ATTRIB_SLOT - 1)) / FLOATS_PER_GPU_ATTRIB_SLOT; + uint thisAttribsGpuSlotSize = ((uint)size + (FLOATS_PER_GPU_ATTRIB_SLOT - 1)) / FLOATS_PER_GPU_ATTRIB_SLOT; ASSERT(numGpuSlotsUsed + thisAttribsGpuSlotSize <= MAX_GPU_ATTRIB_SLOTS); if (numGpuSlotsUsed + thisAttribsGpuSlotSize > MAX_GPU_ATTRIB_SLOTS) { @@ -200,18 +200,18 @@ BOOL VertexBuffer::SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t return success; } -int32_t VertexBuffer::GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const +int VertexBuffer::GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const { - for (uint32_t i = 0; i < m_numAttributes; ++i) + for (uint i = 0; i < m_numAttributes; ++i) { - if ((uint32_t)m_attribs[i].standardType == (uint32_t)standardAttrib) - return (int32_t)i; + if ((uint)m_attribs[i].standardType == (uint)standardAttrib) + return (int)i; } return -1; } -void VertexBuffer::Resize(uint32_t numVertices) +void VertexBuffer::Resize(uint numVertices) { ASSERT(numVertices > 0); if (numVertices == 0) @@ -227,13 +227,13 @@ void VertexBuffer::Resize(uint32_t numVertices) --m_currentVertex; } -void VertexBuffer::Extend(uint32_t amount) +void VertexBuffer::Extend(uint amount) { - uint32_t newSize = GetNumElements() + amount; + uint newSize = GetNumElements() + amount; Resize(newSize); } -void VertexBuffer::Copy(const VertexBuffer *source, uint32_t destIndex) +void VertexBuffer::Copy(const VertexBuffer *source, uint destIndex) { ASSERT(source != NULL); ASSERT(source->GetNumElements() > 0); @@ -241,7 +241,7 @@ void VertexBuffer::Copy(const VertexBuffer *source, uint32_t destIndex) ASSERT(destIndex >= 0); ASSERT(destIndex + source->GetNumElements() <= GetNumElements()); - uint32_t destOffset = GetVertexPosition(destIndex); + uint destOffset = GetVertexPosition(destIndex); memcpy(&m_buffer[destOffset], source->GetBuffer(), GetNumElements() * GetElementWidthInBytes()); SetDirty(); diff --git a/src/framework/graphics/vertexbuffer.h b/src/framework/graphics/vertexbuffer.h index 14550f7..64b774d 100644 --- a/src/framework/graphics/vertexbuffer.h +++ b/src/framework/graphics/vertexbuffer.h @@ -41,7 +41,7 @@ public: * @param usage the expected usage pattern of this vertex buffer * @return TRUE if successful, FALSE if not */ - BOOL Initialize(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes, uint32_t numVertices, BUFFEROBJECT_USAGE usage); + BOOL Initialize(const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage); /** * Initializes the vertex buffer. @@ -53,7 +53,7 @@ public: * @param usage the expected usage pattern of this vertex buffer * @return TRUE if successful, FALSE if not */ - BOOL Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint32_t numAttributes, uint32_t numVertices, BUFFEROBJECT_USAGE usage); + BOOL Initialize(GraphicsDevice *graphicsDevice, const VERTEX_ATTRIBS *attributes, uint numAttributes, uint numVertices, BUFFEROBJECT_USAGE usage); /** * Initializes the vertex buffer. @@ -76,21 +76,21 @@ public: /** * @return the number of attributes in this vertex buffer */ - uint32_t GetNumAttributes() const { return m_numAttributes; } + uint GetNumAttributes() const { return m_numAttributes; } /** * Returns information about the specified attribute. * @param index the index of the attribute to get information about * @return the attribute's information */ - const VertexBufferAttribute* GetAttributeInfo(uint32_t index) const { return &m_attribs[index]; } + const VertexBufferAttribute* GetAttributeInfo(uint index) const { return &m_attribs[index]; } /** * @return the standard attributes included in this buffer's data. Note * that this is not necessarily all of the attributes contained in * this buffer. */ - uint32_t GetStandardAttribs() const { return m_standardTypeAttribs; } + uint GetStandardAttribs() const { return m_standardTypeAttribs; } /** * Checks whether this buffer's vertex data includes the specified standard @@ -99,120 +99,120 @@ public: * @return TRUE if the vertex data in this buffer contains this standard * attribute */ - BOOL HasStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const { return (m_standardTypeAttribs & (uint32_t)standardAttrib) > 0; } + BOOL HasStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const { return (m_standardTypeAttribs & (uint)standardAttrib) > 0; } /** * Returns the index of the specified standard attribute. * @param standardAttrib the standard attribute to get the index of * @return the index of the attribute, or -1 if it is not present */ - int32_t GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const; + int GetIndexOfStandardAttrib(VERTEX_STANDARD_ATTRIBS standardAttrib) const; /** * @return the offset from the start of a single vertex's data that the * color attribute starts at (in floats) */ - uint32_t GetColorOffset() const { return m_colorOffset; } + uint GetColorOffset() const { return m_colorOffset; } /** * @return the offset from the start of a single vertex's data that the * 3D position attribute starts at (in floats) */ - uint32_t GetPosition3Offset() const { return m_position3Offset; } + uint GetPosition3Offset() const { return m_position3Offset; } /** * @return the offset from the start of a single vertex's data that the * 2D position attribute starts at (in floats) */ - uint32_t GetPosition2Offset() const { return m_position2Offset; } + uint GetPosition2Offset() const { return m_position2Offset; } /** * @return the offset from the start of a single vertex's data that the * normal attribute starts at (in floats) */ - uint32_t GetNormalOffset() const { return m_normalOffset; } + uint GetNormalOffset() const { return m_normalOffset; } /** * @return the offset from the start of a single vertex's data that the * texture coordinate attribute starts at (in floats) */ - uint32_t GetTexCoordOffset() const { return m_texCoordOffset; } + uint GetTexCoordOffset() const { return m_texCoordOffset; } /** * @return the offset from the start of a single vertex's data that the * color attribute starts at (in bytes) */ - uint32_t GetColorOffsetBytes() const { return m_colorOffset * sizeof(float); } + uint GetColorOffsetBytes() const { return m_colorOffset * sizeof(float); } /** * @return the offset from the start of a single vertex's data that the * 3D position attribute starts at (in bytes) */ - uint32_t GetPosition3OffsetBytes() const { return m_position3Offset * sizeof(float); } + uint GetPosition3OffsetBytes() const { return m_position3Offset * sizeof(float); } /** * @return the offset from the start of a single vertex's data that the * 2D position attribute starts at (in bytes) */ - uint32_t GetPosition2OffsetBytes() const { return m_position2Offset * sizeof(float); } + uint GetPosition2OffsetBytes() const { return m_position2Offset * sizeof(float); } /** * @return the offset from the start of a single vertex's data that the * normal attribute starts at (in bytes) */ - uint32_t GetNormalOffsetBytes() const { return m_normalOffset * sizeof(float); } + uint GetNormalOffsetBytes() const { return m_normalOffset * sizeof(float); } /** * @return the offset from the start of a single vertex's data that the * texture coordinate attribute starts at (in bytes) */ - uint32_t GetTexCoordOffsetBytes() const { return m_texCoordOffset * sizeof(float); } + uint GetTexCoordOffsetBytes() const { return m_texCoordOffset * sizeof(float); } /** * @param index the vertex to get the color data for * @return the vertex's color data */ - Color GetColor(uint32_t index) const; + Color GetColor(uint index) const; /** * @param index the vertex to get the position data for * @return the vertex's 3D position data */ - Vector3 GetPosition3(uint32_t index) const; + Vector3 GetPosition3(uint index) const; /** * @param index the vertex to get the position data for * @return the vertex's 2D position data */ - Vector2 GetPosition2(uint32_t index) const; + Vector2 GetPosition2(uint index) const; /** * @param index the vertex to get the normal data for * @return the vertex's normal data */ - Vector3 GetNormal(uint32_t index) const; + Vector3 GetNormal(uint index) const; /** * @param index the vertex to get the texture coordinate data for * @return the vertex's texture coordinate data */ - Vector2 GetTexCoord(uint32_t index) const; + Vector2 GetTexCoord(uint index) const; - void Get1f(uint32_t attrib, uint32_t index, float &x) const; - float Get1f(uint32_t attrib, uint32_t index) const; - void Get2f(uint32_t attrib, uint32_t index, float &x, float &y) const; - void Get2f(uint32_t attrib, uint32_t index, Vector2 &v) const; - Vector2 Get2f(uint32_t attrib, uint32_t index) const; - void Get3f(uint32_t attrib, uint32_t index, float &x, float &y, float &z) const; - void Get3f(uint32_t attrib, uint32_t index, Vector3 &v) const; - Vector3 Get3f(uint32_t attrib, uint32_t index) const; - void Get4f(uint32_t attrib, uint32_t index, float &x, float &y, float &z, float &w) const; - void Get4f(uint32_t attrib, uint32_t index, Color &c) const; - Color Get4f(uint32_t attrib, uint32_t index) const; - void Get9f(uint32_t attrib, uint32_t index, Matrix3x3 &m) const; - Matrix3x3 Get9f(uint32_t attrib, uint32_t index) const; - void Get16f(uint32_t attrib, uint32_t index, Matrix4x4 &m) const; - Matrix4x4 Get16f(uint32_t attrib, uint32_t index) const; + void Get1f(uint attrib, uint index, float &x) const; + float Get1f(uint attrib, uint index) const; + void Get2f(uint attrib, uint index, float &x, float &y) const; + void Get2f(uint attrib, uint index, Vector2 &v) const; + Vector2 Get2f(uint attrib, uint index) const; + void Get3f(uint attrib, uint index, float &x, float &y, float &z) const; + void Get3f(uint attrib, uint index, Vector3 &v) const; + Vector3 Get3f(uint attrib, uint index) const; + void Get4f(uint attrib, uint index, float &x, float &y, float &z, float &w) const; + void Get4f(uint attrib, uint index, Color &c) const; + Color Get4f(uint attrib, uint index) const; + void Get9f(uint attrib, uint index, Matrix3x3 &m) const; + Matrix3x3 Get9f(uint attrib, uint index) const; + void Get16f(uint attrib, uint index, Matrix4x4 &m) const; + Matrix4x4 Get16f(uint attrib, uint index) const; /** * @return the current vertex's color data @@ -239,28 +239,28 @@ public: */ Vector2 GetCurrentTexCoord() const { return GetTexCoord(GetCurrentPosition()); } - void GetCurrent1f(uint32_t attrib, float &x) const { Get1f(attrib, GetCurrentPosition(), x); } - float GetCurrent1f(uint32_t attrib) const { return Get1f(attrib, GetCurrentPosition()); } - void GetCurrent2f(uint32_t attrib, float &x, float &y) const { Get2f(attrib, GetCurrentPosition(), x, y); } - void GetCurrent2f(uint32_t attrib, Vector2 &v) const { Get2f(attrib, GetCurrentPosition(), v); } - Vector2 GetCurrent2f(uint32_t attrib) const { return Get2f(attrib, GetCurrentPosition()); } - void GetCurrent3f(uint32_t attrib, float &x, float &y, float &z) const { Get3f(attrib, GetCurrentPosition(), x, y, z); } - void GetCurrent3f(uint32_t attrib, Vector3 &v) const { Get3f(attrib, GetCurrentPosition(), v); } - Vector3 GetCurrent3f(uint32_t attrib) const { return Get3f(attrib, GetCurrentPosition()); } - void GetCurrent4f(uint32_t attrib, float &x, float &y, float &z, float &w) const { Get4f(attrib, GetCurrentPosition(), x, y, z, w); } - void GetCurrent4f(uint32_t attrib, Color &c) const { Get4f(attrib, GetCurrentPosition(), c); } - Color GetCurrent4f(uint32_t attrib) const { return Get4f(attrib, GetCurrentPosition()); } - void GetCurrent9f(uint32_t attrib, Matrix3x3 &m) const { Get9f(attrib, GetCurrentPosition(), m); } - Matrix3x3 GetCurrent9f(uint32_t attrib) const { return Get9f(attrib, GetCurrentPosition()); } - void GetCurrent16f(uint32_t attrib, Matrix4x4 &m) const { Get16f(attrib, GetCurrentPosition(), m); } - Matrix4x4 GetCurrent16f(uint32_t attrib) const { return Get16f(attrib, GetCurrentPosition()); } + void GetCurrent1f(uint attrib, float &x) const { Get1f(attrib, GetCurrentPosition(), x); } + float GetCurrent1f(uint attrib) const { return Get1f(attrib, GetCurrentPosition()); } + void GetCurrent2f(uint attrib, float &x, float &y) const { Get2f(attrib, GetCurrentPosition(), x, y); } + void GetCurrent2f(uint attrib, Vector2 &v) const { Get2f(attrib, GetCurrentPosition(), v); } + Vector2 GetCurrent2f(uint attrib) const { return Get2f(attrib, GetCurrentPosition()); } + void GetCurrent3f(uint attrib, float &x, float &y, float &z) const { Get3f(attrib, GetCurrentPosition(), x, y, z); } + void GetCurrent3f(uint attrib, Vector3 &v) const { Get3f(attrib, GetCurrentPosition(), v); } + Vector3 GetCurrent3f(uint attrib) const { return Get3f(attrib, GetCurrentPosition()); } + void GetCurrent4f(uint attrib, float &x, float &y, float &z, float &w) const { Get4f(attrib, GetCurrentPosition(), x, y, z, w); } + void GetCurrent4f(uint attrib, Color &c) const { Get4f(attrib, GetCurrentPosition(), c); } + Color GetCurrent4f(uint attrib) const { return Get4f(attrib, GetCurrentPosition()); } + void GetCurrent9f(uint attrib, Matrix3x3 &m) const { Get9f(attrib, GetCurrentPosition(), m); } + Matrix3x3 GetCurrent9f(uint attrib) const { return Get9f(attrib, GetCurrentPosition()); } + void GetCurrent16f(uint attrib, Matrix4x4 &m) const { Get16f(attrib, GetCurrentPosition(), m); } + Matrix4x4 GetCurrent16f(uint attrib) const { return Get16f(attrib, GetCurrentPosition()); } /** * Sets a vertex's color attribute. * @param index the vertex to set * @param color the new color attribute to set */ - void SetColor(uint32_t index, const Color &color); + void SetColor(uint index, const Color &color); /** * Sets a vertex's color attribute. @@ -269,7 +269,7 @@ public: * @param g green component of the color attribute to set * @param b blue component of the color attribute to set */ - void SetColor(uint32_t index, float r, float g, float b); + void SetColor(uint index, float r, float g, float b); /** * Sets a vertex's color attribute. @@ -279,14 +279,14 @@ public: * @param b blue component of the color attribute to set * @param a alpha component of the color attribute to set */ - void SetColor(uint32_t index, float r, float g, float b, float a); + void SetColor(uint index, float r, float g, float b, float a); /** * Sets a vertex's 3D position attribute. * @param index the vertex to set * @param position the new 3D position attribute to set */ - void SetPosition3(uint32_t index, const Vector3 &position); + void SetPosition3(uint index, const Vector3 &position); /** * Sets a vertex's 3D position attribute. @@ -295,14 +295,14 @@ public: * @param y Y coordinate of the 3D position attribute to set * @param z Z coordinate of the 3D position attribute to set */ - void SetPosition3(uint32_t index, float x, float y, float z); + void SetPosition3(uint index, float x, float y, float z); /** * Sets a vertex's 2D position attribute. * @param index the vertex to set * @param position the new 2D position attribute to set */ - void SetPosition2(uint32_t index, const Vector2 &position); + void SetPosition2(uint index, const Vector2 &position); /** * Sets a vertex's 2D position attribute. @@ -310,14 +310,14 @@ public: * @param x X coordinate of the 2D position attribute to set * @param y Y coordinate of the 2D position attribute to set */ - void SetPosition2(uint32_t index, float x, float y); + void SetPosition2(uint index, float x, float y); /** * Sets a vertex's normal attribute. * @param index the vertex to set * @param position the new normal attribute to set */ - void SetNormal(uint32_t index, const Vector3 &normal); + void SetNormal(uint index, const Vector3 &normal); /** * Sets a vertex's normal attribute. @@ -326,14 +326,14 @@ public: * @param y Y coordinate of the normal attribute to set * @param z Z coordinate of the normal attribute to set */ - void SetNormal(uint32_t index, float x, float y, float z); + void SetNormal(uint index, float x, float y, float z); /** * Sets a vertex's texture coordinate attribute. * @param index the vertex to set * @param texCoord the new texture coordinate attribute to set */ - void SetTexCoord(uint32_t index, const Vector2 &texCoord); + void SetTexCoord(uint index, const Vector2 &texCoord); /** * Sets a vertex's texture coordinate attribute. @@ -341,17 +341,17 @@ public: * @param x U coordinate of the texture coordinate attribute to set * @param y V coordinate of the texture coordinate attribute to set */ - void SetTexCoord(uint32_t index, float x, float y); + void SetTexCoord(uint index, float x, float y); - void Set1f(uint32_t attrib, uint32_t index, float x); - void Set2f(uint32_t attrib, uint32_t index, float x, float y); - void Set2f(uint32_t attrib, uint32_t index, const Vector2 &v); - void Set3f(uint32_t attrib, uint32_t index, float x, float y, float z); - void Set3f(uint32_t attrib, uint32_t index, const Vector3 &v); - void Set4f(uint32_t attrib, uint32_t index, float x, float y, float z, float w); - void Set4f(uint32_t attrib, uint32_t index, const Color &c); - void Set9f(uint32_t attrib, uint32_t index, const Matrix3x3 &m); - void Set16f(uint32_t attrib, uint32_t index, const Matrix4x4 &m); + void Set1f(uint attrib, uint index, float x); + void Set2f(uint attrib, uint index, float x, float y); + void Set2f(uint attrib, uint index, const Vector2 &v); + void Set3f(uint attrib, uint index, float x, float y, float z); + void Set3f(uint attrib, uint index, const Vector3 &v); + void Set4f(uint attrib, uint index, float x, float y, float z, float w); + void Set4f(uint attrib, uint index, const Color &c); + void Set9f(uint attrib, uint index, const Matrix3x3 &m); + void Set16f(uint attrib, uint index, const Matrix4x4 &m); /** * Sets the current vertex's color attribute. @@ -430,15 +430,15 @@ public: */ void SetCurrentTexCoord(float x, float y) { SetTexCoord(GetCurrentPosition(), x, y); } - void SetCurrent1f(uint32_t attrib, float x) { Set1f(attrib, GetCurrentPosition(), x); } - void SetCurrent2f(uint32_t attrib, float x, float y) { Set2f(attrib, GetCurrentPosition(), x, y); } - void SetCurrent2f(uint32_t attrib, const Vector2 &v) { Set2f(attrib, GetCurrentPosition(), v); } - void SetCurrent3f(uint32_t attrib, float x, float y, float z) { Set3f(attrib, GetCurrentPosition(), x, y, z); } - void SetCurrent3f(uint32_t attrib, const Vector3 &v) { Set3f(attrib, GetCurrentPosition(), v); } - void SetCurrent4f(uint32_t attrib, float x, float y, float z, float w) { Set4f(attrib, GetCurrentPosition(), x, y, z, w); } - void SetCurrent4f(uint32_t attrib, const Color &c) { Set4f(attrib, GetCurrentPosition(), c); } - void SetCurrent9f(uint32_t attrib, const Matrix3x3 &m) { Set9f(attrib, GetCurrentPosition(), m); } - void SetCurrent16f(uint32_t attrib, const Matrix4x4 &m) { Set16f(attrib, GetCurrentPosition(), m); } + void SetCurrent1f(uint attrib, float x) { Set1f(attrib, GetCurrentPosition(), x); } + void SetCurrent2f(uint attrib, float x, float y) { Set2f(attrib, GetCurrentPosition(), x, y); } + void SetCurrent2f(uint attrib, const Vector2 &v) { Set2f(attrib, GetCurrentPosition(), v); } + void SetCurrent3f(uint attrib, float x, float y, float z) { Set3f(attrib, GetCurrentPosition(), x, y, z); } + void SetCurrent3f(uint attrib, const Vector3 &v) { Set3f(attrib, GetCurrentPosition(), v); } + void SetCurrent4f(uint attrib, float x, float y, float z, float w) { Set4f(attrib, GetCurrentPosition(), x, y, z, w); } + void SetCurrent4f(uint attrib, const Color &c) { Set4f(attrib, GetCurrentPosition(), c); } + void SetCurrent9f(uint attrib, const Matrix3x3 &m) { Set9f(attrib, GetCurrentPosition(), m); } + void SetCurrent16f(uint attrib, const Matrix4x4 &m) { Set16f(attrib, GetCurrentPosition(), m); } /** * Moves the current vertex position to the next position. @@ -462,7 +462,7 @@ public: * direction, then it will be shrunk so as not to move * out of bounds. */ - void Move(int32_t numVertices); + void Move(int numVertices); /** * Moves the current vertex position to the beginning of the buffer. @@ -478,20 +478,20 @@ public: * Moves the current vertex position to the position specified. * @param index the position to move to */ - void MoveTo(uint32_t index) { m_currentVertex = index; } + void MoveTo(uint index) { m_currentVertex = index; } /** * Resizes the buffer capacity to hold the specified number of vertices. * @param numVertices the amount of vertices the buffer should be resized * to hold */ - void Resize(uint32_t numVertices); + void Resize(uint numVertices); /** * Extends the buffer capacity to hold the specified number of extra vertices. * @param amount the amount of vertices to extend the buffer by */ - void Extend(uint32_t amount); + void Extend(uint amount); /** * Copies vertices from a source buffer to this one. The copied vertices @@ -500,12 +500,12 @@ public: * @param destIndex the index of the vertex position in this buffer to * start copying the vertices to */ - void Copy(const VertexBuffer *source, uint32_t destIndex); + void Copy(const VertexBuffer *source, uint destIndex); /** * @return the number of vertices contained in this buffer */ - uint32_t GetNumElements() const { return m_numVertices; } + uint GetNumElements() const { return m_numVertices; } /** * @return the size in bytes of each vertex in this buffer object @@ -520,49 +520,49 @@ public: /** * @return the current position in the buffer */ - uint32_t GetCurrentPosition() const { return m_currentVertex; } + uint GetCurrentPosition() const { return m_currentVertex; } /** * @return the number of vertex spaces left between the current position * and the end of the buffer */ - uint32_t GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); } + uint GetRemainingSpace() const { return (GetNumElements() - 1) - GetCurrentPosition(); } private: - BOOL SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint32_t numAttributes); + BOOL SetSizesAndOffsets(const VERTEX_ATTRIBS *attributes, uint numAttributes); BOOL IsBufferAllocated() const { return m_buffer.size() > 0; } - uint32_t GetVertexPosition(uint32_t index) const { return (index * m_elementWidth); } - uint32_t GetColorBufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_colorOffset; } - uint32_t GetPosition3BufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_position3Offset; } - uint32_t GetPosition2BufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_position2Offset; } - uint32_t GetNormalBufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_normalOffset; } - uint32_t GetTexCoordBufferPosition(uint32_t index) const { return GetVertexPosition(index) + m_texCoordOffset; } - uint32_t GetGenericBufferPosition(uint32_t attrib, uint32_t index) const { return GetVertexPosition(index) + m_attribs[attrib].offset; } + uint GetVertexPosition(uint index) const { return (index * m_elementWidth); } + uint GetColorBufferPosition(uint index) const { return GetVertexPosition(index) + m_colorOffset; } + uint GetPosition3BufferPosition(uint index) const { return GetVertexPosition(index) + m_position3Offset; } + uint GetPosition2BufferPosition(uint index) const { return GetVertexPosition(index) + m_position2Offset; } + uint GetNormalBufferPosition(uint index) const { return GetVertexPosition(index) + m_normalOffset; } + uint GetTexCoordBufferPosition(uint index) const { return GetVertexPosition(index) + m_texCoordOffset; } + uint GetGenericBufferPosition(uint attrib, uint index) const { return GetVertexPosition(index) + m_attribs[attrib].offset; } - uint32_t m_numVertices; - uint32_t m_currentVertex; - uint32_t m_standardTypeAttribs; + uint m_numVertices; + uint m_currentVertex; + uint m_standardTypeAttribs; // the below are all in terms of floats. multiply by sizeof(float) to get in bytes! - uint32_t m_elementWidth; - uint32_t m_colorOffset; - uint32_t m_position3Offset; - uint32_t m_position2Offset; - uint32_t m_normalOffset; - uint32_t m_texCoordOffset; + uint m_elementWidth; + uint m_colorOffset; + uint m_position3Offset; + uint m_position2Offset; + uint m_normalOffset; + uint m_texCoordOffset; // --- VertexBufferAttribute *m_attribs; - uint32_t m_numAttributes; - uint32_t m_numGPUAttributeSlotsUsed; + uint m_numAttributes; + uint m_numGPUAttributeSlotsUsed; stl::vector m_buffer; }; -inline Color VertexBuffer::GetColor(uint32_t index) const +inline Color VertexBuffer::GetColor(uint index) const { - uint32_t p = GetColorBufferPosition(index); + uint p = GetColorBufferPosition(index); return Color( m_buffer[p], m_buffer[p + 1], @@ -571,9 +571,9 @@ inline Color VertexBuffer::GetColor(uint32_t index) const ); } -inline Vector3 VertexBuffer::GetPosition3(uint32_t index) const +inline Vector3 VertexBuffer::GetPosition3(uint index) const { - uint32_t p = GetPosition3BufferPosition(index); + uint p = GetPosition3BufferPosition(index); return Vector3( m_buffer[p], m_buffer[p + 1], @@ -581,18 +581,18 @@ inline Vector3 VertexBuffer::GetPosition3(uint32_t index) const ); } -inline Vector2 VertexBuffer::GetPosition2(uint32_t index) const +inline Vector2 VertexBuffer::GetPosition2(uint index) const { - uint32_t p = GetPosition2BufferPosition(index); + uint p = GetPosition2BufferPosition(index); return Vector2( m_buffer[p], m_buffer[p + 1] ); } -inline Vector3 VertexBuffer::GetNormal(uint32_t index) const +inline Vector3 VertexBuffer::GetNormal(uint index) const { - uint32_t p = GetNormalBufferPosition(index); + uint p = GetNormalBufferPosition(index); return Vector3( m_buffer[p], m_buffer[p + 1], @@ -600,69 +600,69 @@ inline Vector3 VertexBuffer::GetNormal(uint32_t index) const ); } -inline Vector2 VertexBuffer::GetTexCoord(uint32_t index) const +inline Vector2 VertexBuffer::GetTexCoord(uint index) const { - uint32_t p = GetTexCoordBufferPosition(index); + uint p = GetTexCoordBufferPosition(index); return Vector2( m_buffer[p], m_buffer[p + 1] ); } -inline void VertexBuffer::Get1f(uint32_t attrib, uint32_t index, float &x) const +inline void VertexBuffer::Get1f(uint attrib, uint index, float &x) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); x = m_buffer[p]; } -inline float VertexBuffer::Get1f(uint32_t attrib, uint32_t index) const +inline float VertexBuffer::Get1f(uint attrib, uint index) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); return m_buffer[p]; } -inline void VertexBuffer::Get2f(uint32_t attrib, uint32_t index, float &x, float &y) const +inline void VertexBuffer::Get2f(uint attrib, uint index, float &x, float &y) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); x = m_buffer[p]; y = m_buffer[p + 1]; } -inline void VertexBuffer::Get2f(uint32_t attrib, uint32_t index, Vector2 &v) const +inline void VertexBuffer::Get2f(uint attrib, uint index, Vector2 &v) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); v.x = m_buffer[p]; v.y = m_buffer[p + 1]; } -inline Vector2 VertexBuffer::Get2f(uint32_t attrib, uint32_t index) const +inline Vector2 VertexBuffer::Get2f(uint attrib, uint index) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); return Vector2( m_buffer[p], m_buffer[p + 1] ); } -inline void VertexBuffer::Get3f(uint32_t attrib, uint32_t index, float &x, float &y, float &z) const +inline void VertexBuffer::Get3f(uint attrib, uint index, float &x, float &y, float &z) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); x = m_buffer[p]; y = m_buffer[p + 1]; z = m_buffer[p + 2]; } -inline void VertexBuffer::Get3f(uint32_t attrib, uint32_t index, Vector3 &v) const +inline void VertexBuffer::Get3f(uint attrib, uint index, Vector3 &v) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); v.x = m_buffer[p]; v.y = m_buffer[p + 1]; v.z = m_buffer[p + 2]; } -inline Vector3 VertexBuffer::Get3f(uint32_t attrib, uint32_t index) const +inline Vector3 VertexBuffer::Get3f(uint attrib, uint index) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); return Vector3( m_buffer[p], m_buffer[p + 1], @@ -670,27 +670,27 @@ inline Vector3 VertexBuffer::Get3f(uint32_t attrib, uint32_t index) const ); } -inline void VertexBuffer::Get4f(uint32_t attrib, uint32_t index, float &x, float &y, float &z, float &w) const +inline void VertexBuffer::Get4f(uint attrib, uint index, float &x, float &y, float &z, float &w) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); x = m_buffer[p]; y = m_buffer[p + 1]; z = m_buffer[p + 2]; w = m_buffer[p + 3]; } -inline void VertexBuffer::Get4f(uint32_t attrib, uint32_t index, Color &c) const +inline void VertexBuffer::Get4f(uint attrib, uint index, Color &c) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); c.r = m_buffer[p]; c.g = m_buffer[p + 1]; c.b = m_buffer[p + 2]; c.a = m_buffer[p + 3]; } -inline Color VertexBuffer::Get4f(uint32_t attrib, uint32_t index) const +inline Color VertexBuffer::Get4f(uint attrib, uint index) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); return Color( m_buffer[p], m_buffer[p + 1], @@ -699,17 +699,17 @@ inline Color VertexBuffer::Get4f(uint32_t attrib, uint32_t index) const ); } -inline void VertexBuffer::Get9f(uint32_t attrib, uint32_t index, Matrix3x3 &m) const +inline void VertexBuffer::Get9f(uint attrib, uint index, Matrix3x3 &m) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); void *dest = m.m; const void *src = &m_buffer[p]; memcpy(dest, src, sizeof(float) * 9); } -inline Matrix3x3 VertexBuffer::Get9f(uint32_t attrib, uint32_t index) const +inline Matrix3x3 VertexBuffer::Get9f(uint attrib, uint index) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); Matrix3x3 m; void *dest = m.m; const void *src = &m_buffer[p]; @@ -717,17 +717,17 @@ inline Matrix3x3 VertexBuffer::Get9f(uint32_t attrib, uint32_t index) const return m; } -inline void VertexBuffer::Get16f(uint32_t attrib, uint32_t index, Matrix4x4 &m) const +inline void VertexBuffer::Get16f(uint attrib, uint index, Matrix4x4 &m) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); void *dest = m.m; const void *src = &m_buffer[p]; memcpy(dest, src, sizeof(float) * 16); } -inline Matrix4x4 VertexBuffer::Get16f(uint32_t attrib, uint32_t index) const +inline Matrix4x4 VertexBuffer::Get16f(uint attrib, uint index) const { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); Matrix4x4 m; void *dest = m.m; const void *src = &m_buffer[p]; @@ -735,9 +735,9 @@ inline Matrix4x4 VertexBuffer::Get16f(uint32_t attrib, uint32_t index) const return m; } -inline void VertexBuffer::SetColor(uint32_t index, const Color &color) +inline void VertexBuffer::SetColor(uint index, const Color &color) { - uint32_t p = GetColorBufferPosition(index); + uint p = GetColorBufferPosition(index); m_buffer[p] = color.r; m_buffer[p + 1] = color.g; m_buffer[p + 2] = color.b; @@ -745,9 +745,9 @@ inline void VertexBuffer::SetColor(uint32_t index, const Color &color) SetDirty(); } -inline void VertexBuffer::SetColor(uint32_t index, float r, float g, float b) +inline void VertexBuffer::SetColor(uint index, float r, float g, float b) { - uint32_t p = GetColorBufferPosition(index); + uint p = GetColorBufferPosition(index); m_buffer[p] = r; m_buffer[p + 1] = g; m_buffer[p + 2] = b; @@ -755,9 +755,9 @@ inline void VertexBuffer::SetColor(uint32_t index, float r, float g, float b) SetDirty(); } -inline void VertexBuffer::SetColor(uint32_t index, float r, float g, float b, float a) +inline void VertexBuffer::SetColor(uint index, float r, float g, float b, float a) { - uint32_t p = GetColorBufferPosition(index); + uint p = GetColorBufferPosition(index); m_buffer[p] = r; m_buffer[p + 1] = g; m_buffer[p + 2] = b; @@ -765,118 +765,118 @@ inline void VertexBuffer::SetColor(uint32_t index, float r, float g, float b, fl SetDirty(); } -inline void VertexBuffer::SetPosition3(uint32_t index, const Vector3 &position) +inline void VertexBuffer::SetPosition3(uint index, const Vector3 &position) { - uint32_t p = GetPosition3BufferPosition(index); + uint p = GetPosition3BufferPosition(index); m_buffer[p] = position.x; m_buffer[p + 1] = position.y; m_buffer[p + 2] = position.z; SetDirty(); } -inline void VertexBuffer::SetPosition3(uint32_t index, float x, float y, float z) +inline void VertexBuffer::SetPosition3(uint index, float x, float y, float z) { - uint32_t p = GetPosition3BufferPosition(index); + uint p = GetPosition3BufferPosition(index); m_buffer[p] = x; m_buffer[p + 1] = y; m_buffer[p + 2] = z; SetDirty(); } -inline void VertexBuffer::SetPosition2(uint32_t index, const Vector2 &position) +inline void VertexBuffer::SetPosition2(uint index, const Vector2 &position) { - uint32_t p = GetPosition2BufferPosition(index); + uint p = GetPosition2BufferPosition(index); m_buffer[p] = position.x; m_buffer[p + 1] = position.y; SetDirty(); } -inline void VertexBuffer::SetPosition2(uint32_t index, float x, float y) +inline void VertexBuffer::SetPosition2(uint index, float x, float y) { - uint32_t p = GetPosition2BufferPosition(index); + uint p = GetPosition2BufferPosition(index); m_buffer[p] = x; m_buffer[p + 1] = y; SetDirty(); } -inline void VertexBuffer::SetNormal(uint32_t index, const Vector3 &normal) +inline void VertexBuffer::SetNormal(uint index, const Vector3 &normal) { - uint32_t p = GetNormalBufferPosition(index); + uint p = GetNormalBufferPosition(index); m_buffer[p] = normal.x; m_buffer[p + 1] = normal.y; m_buffer[p + 2] = normal.z; SetDirty(); } -inline void VertexBuffer::SetNormal(uint32_t index, float x, float y, float z) +inline void VertexBuffer::SetNormal(uint index, float x, float y, float z) { - uint32_t p = GetNormalBufferPosition(index); + uint p = GetNormalBufferPosition(index); m_buffer[p] = x; m_buffer[p + 1] = y; m_buffer[p + 2] = z; SetDirty(); } -inline void VertexBuffer::SetTexCoord(uint32_t index, const Vector2 &texCoord) +inline void VertexBuffer::SetTexCoord(uint index, const Vector2 &texCoord) { - uint32_t p = GetTexCoordBufferPosition(index); + uint p = GetTexCoordBufferPosition(index); m_buffer[p] = texCoord.x; m_buffer[p + 1] = texCoord.y; SetDirty(); } -inline void VertexBuffer::SetTexCoord(uint32_t index, float x, float y) +inline void VertexBuffer::SetTexCoord(uint index, float x, float y) { - uint32_t p = GetTexCoordBufferPosition(index); + uint p = GetTexCoordBufferPosition(index); m_buffer[p] = x; m_buffer[p + 1] = y; SetDirty(); } -inline void VertexBuffer::Set1f(uint32_t attrib, uint32_t index, float x) +inline void VertexBuffer::Set1f(uint attrib, uint index, float x) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); m_buffer[p] = x; SetDirty(); } -inline void VertexBuffer::Set2f(uint32_t attrib, uint32_t index, float x, float y) +inline void VertexBuffer::Set2f(uint attrib, uint index, float x, float y) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); m_buffer[p] = x; m_buffer[p + 1] = y; SetDirty(); } -inline void VertexBuffer::Set2f(uint32_t attrib, uint32_t index, const Vector2 &v) +inline void VertexBuffer::Set2f(uint attrib, uint index, const Vector2 &v) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); m_buffer[p] = v.x; m_buffer[p + 1] = v.y; SetDirty(); } -inline void VertexBuffer::Set3f(uint32_t attrib, uint32_t index, float x, float y, float z) +inline void VertexBuffer::Set3f(uint attrib, uint index, float x, float y, float z) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); m_buffer[p] = x; m_buffer[p + 1] = y; m_buffer[p + 2] = z; SetDirty(); } -inline void VertexBuffer::Set3f(uint32_t attrib, uint32_t index, const Vector3 &v) +inline void VertexBuffer::Set3f(uint attrib, uint index, const Vector3 &v) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); m_buffer[p] = v.x; m_buffer[p + 1] = v.y; m_buffer[p + 2] = v.z; SetDirty(); } -inline void VertexBuffer::Set4f(uint32_t attrib, uint32_t index, float x, float y, float z, float w) +inline void VertexBuffer::Set4f(uint attrib, uint index, float x, float y, float z, float w) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); m_buffer[p] = x; m_buffer[p + 1] = y; m_buffer[p + 2] = z; @@ -884,9 +884,9 @@ inline void VertexBuffer::Set4f(uint32_t attrib, uint32_t index, float x, float SetDirty(); } -inline void VertexBuffer::Set4f(uint32_t attrib, uint32_t index, const Color &c) +inline void VertexBuffer::Set4f(uint attrib, uint index, const Color &c) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); m_buffer[p] = c.r; m_buffer[p + 1] = c.g; m_buffer[p + 2] = c.b; @@ -894,18 +894,18 @@ inline void VertexBuffer::Set4f(uint32_t attrib, uint32_t index, const Color &c) SetDirty(); } -inline void VertexBuffer::Set9f(uint32_t attrib, uint32_t index, const Matrix3x3 &m) +inline void VertexBuffer::Set9f(uint attrib, uint index, const Matrix3x3 &m) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); void *dest = &m_buffer[p]; const void *src = m.m; memcpy(dest, src, sizeof(float) * 9); SetDirty(); } -inline void VertexBuffer::Set16f(uint32_t attrib, uint32_t index, const Matrix4x4 &m) +inline void VertexBuffer::Set16f(uint attrib, uint index, const Matrix4x4 &m) { - uint32_t p = GetGenericBufferPosition(attrib, index); + uint p = GetGenericBufferPosition(attrib, index); void *dest = &m_buffer[p]; const void *src = m.m; memcpy(dest, src, sizeof(float) * 16); @@ -935,10 +935,10 @@ inline BOOL VertexBuffer::MovePrevious() } } -inline void VertexBuffer::Move(int32_t numVertices) +inline void VertexBuffer::Move(int numVertices) { // m_currentVertex is unsigned, so detect when we would go negative beforehand - if (numVertices < 0 && (uint32_t)abs(numVertices) > m_currentVertex) + if (numVertices < 0 && (uint)abs(numVertices) > m_currentVertex) m_currentVertex = 0; else { diff --git a/src/framework/graphics/vertexskinningshader.cpp b/src/framework/graphics/vertexskinningshader.cpp index 41b9721..9302fa1 100644 --- a/src/framework/graphics/vertexskinningshader.cpp +++ b/src/framework/graphics/vertexskinningshader.cpp @@ -14,13 +14,13 @@ VertexSkinningShader::~VertexSkinningShader() { } -void VertexSkinningShader::SetJointPositions(const Vector3 *positions, uint32_t count) +void VertexSkinningShader::SetJointPositions(const Vector3 *positions, uint count) { ASSERT(IsReadyForUse() == TRUE); SetUniform(m_positionsUniform, positions, count); } -void VertexSkinningShader::SetJointRotations(const Quaternion *rotations, uint32_t count) +void VertexSkinningShader::SetJointRotations(const Quaternion *rotations, uint count) { ASSERT(IsReadyForUse() == TRUE); SetUniform(m_rotationsUniform, rotations, count); diff --git a/src/framework/graphics/vertexskinningshader.h b/src/framework/graphics/vertexskinningshader.h index 5a9b313..91e613d 100644 --- a/src/framework/graphics/vertexskinningshader.h +++ b/src/framework/graphics/vertexskinningshader.h @@ -13,8 +13,8 @@ class VertexSkinningShader : public StandardShader public: virtual ~VertexSkinningShader(); - void SetJointPositions(const Vector3 *positions, uint32_t count); - void SetJointRotations(const Quaternion *rotations, uint32_t count); + void SetJointPositions(const Vector3 *positions, uint count); + void SetJointRotations(const Quaternion *rotations, uint count); protected: VertexSkinningShader(); diff --git a/src/framework/graphics/viewcontext.h b/src/framework/graphics/viewcontext.h index 356483b..a812b28 100644 --- a/src/framework/graphics/viewcontext.h +++ b/src/framework/graphics/viewcontext.h @@ -40,12 +40,12 @@ public: Camera* GetCamera() const { return m_camera; } void SetCamera(Camera *camera); - uint16_t GetViewportTop() const { return (uint16_t)m_viewport.top; } - uint16_t GetViewportLeft() const { return (uint16_t)m_viewport.left; } - uint16_t GetViewportBottom() const { return (uint16_t)m_viewport.bottom; } - uint16_t GetViewportRight() const { return (uint16_t)m_viewport.right; } - uint16_t GetViewportWidth() const { return (uint16_t)m_viewport.GetWidth(); } - uint16_t GetViewportHeight() const { return (uint16_t)m_viewport.GetHeight(); } + uint GetViewportTop() const { return (uint)m_viewport.top; } + uint GetViewportLeft() const { return (uint)m_viewport.left; } + uint GetViewportBottom() const { return (uint)m_viewport.bottom; } + uint GetViewportRight() const { return (uint)m_viewport.right; } + 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; } diff --git a/src/framework/gwen/gwen_inputprocessor.cpp b/src/framework/gwen/gwen_inputprocessor.cpp index c37be19..c06e506 100644 --- a/src/framework/gwen/gwen_inputprocessor.cpp +++ b/src/framework/gwen/gwen_inputprocessor.cpp @@ -37,7 +37,7 @@ namespace Gwen return (BOOL)m_canvas->InputKey(gwenKey, FALSE); } - BOOL InputProcessor::OnMouseButtonDown(MOUSE_BUTTONS button, uint16_t x, uint16_t y) + BOOL InputProcessor::OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y) { int gwenButton = ConvertToGwenButton(button); @@ -53,7 +53,7 @@ namespace Gwen return (movedResult || clickResult); } - BOOL InputProcessor::OnMouseButtonUp(MOUSE_BUTTONS button, uint16_t x, uint16_t y) + BOOL InputProcessor::OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y) { int gwenButton = ConvertToGwenButton(button); @@ -69,7 +69,7 @@ namespace Gwen return (movedResult || clickResult); } - BOOL InputProcessor::OnMouseMove(uint16_t x, uint16_t y, int16_t deltaX, int16_t 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(); @@ -80,7 +80,7 @@ namespace Gwen return (BOOL)m_canvas->InputMouseMoved(scaledX, scaledY, scaledDeltaX, scaledDeltaY); } - BOOL InputProcessor::OnTouchDown(int32_t id, uint16_t x, uint16_t y, BOOL isPrimary) + BOOL InputProcessor::OnTouchDown(int id, uint x, uint y, BOOL isPrimary) { if (!isPrimary) return FALSE; @@ -96,7 +96,7 @@ namespace Gwen return (movedResult || clickResult); } - BOOL InputProcessor::OnTouchUp(int32_t id, BOOL isPrimary) + BOOL InputProcessor::OnTouchUp(int id, BOOL isPrimary) { if (!isPrimary) return FALSE; @@ -113,7 +113,7 @@ namespace Gwen return (movedResult || clickResult); } - BOOL InputProcessor::OnTouchMove(int32_t id, uint16_t x, uint16_t y, int16_t deltaX, int16_t deltaY, BOOL isPrimary) + BOOL InputProcessor::OnTouchMove(int id, uint x, uint y, int deltaX, int deltaY, BOOL isPrimary) { if (!isPrimary) return FALSE; diff --git a/src/framework/gwen/gwen_inputprocessor.h b/src/framework/gwen/gwen_inputprocessor.h index a6adbe2..f444383 100644 --- a/src/framework/gwen/gwen_inputprocessor.h +++ b/src/framework/gwen/gwen_inputprocessor.h @@ -22,13 +22,13 @@ namespace Gwen BOOL OnKeyDown(KEYS key); BOOL OnKeyUp(KEYS key); - BOOL OnMouseButtonDown(MOUSE_BUTTONS button, uint16_t x, uint16_t y); - BOOL OnMouseButtonUp(MOUSE_BUTTONS button, uint16_t x, uint16_t y); - BOOL OnMouseMove(uint16_t x, uint16_t y, int16_t deltaX, int16_t 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(int32_t id, uint16_t x, uint16_t y, BOOL isPrimary); - BOOL OnTouchUp(int32_t id, BOOL isPrimary); - BOOL OnTouchMove(int32_t id, uint16_t x, uint16_t y, int16_t deltaX, int16_t 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); diff --git a/src/framework/gwen/gwen_spritebatchrenderer.cpp b/src/framework/gwen/gwen_spritebatchrenderer.cpp index 2d2b87c..b6c7bb7 100644 --- a/src/framework/gwen/gwen_spritebatchrenderer.cpp +++ b/src/framework/gwen/gwen_spritebatchrenderer.cpp @@ -77,10 +77,10 @@ namespace Gwen ASSERT(m_spriteBatch != NULL); Gwen::Rect rect = ClipRegion(); - int16_t left = (int16_t)((float)rect.x * Scale()); - int16_t top = (int16_t)((float)rect.y * Scale()); - int16_t right = (int16_t)((float)(rect.x + rect.w) * Scale()); - int16_t bottom = (int16_t)((float)(rect.y + rect.h) * Scale()); + int left = (int)((float)rect.x * Scale()); + int top = (int)((float)rect.y * Scale()); + int right = (int)((float)(rect.x + rect.w) * Scale()); + int bottom = (int)((float)(rect.y + rect.h) * Scale()); m_spriteBatch->SetClipRegion(left, top, right, bottom); } @@ -154,7 +154,7 @@ namespace Gwen void SpriteBatchRenderer::LoadFont(Gwen::Font *pFont) { LOG_INFO(LOGCAT_GWENUI, "Gwen::Renderer::SpriteBatchRenderer loading font \"%s\"\n", pFont->facename.c_str()); - SpriteFontParam fontParam((uint8_t)pFont->size); + SpriteFontParam fontParam((uint)pFont->size); SpriteFont *font = m_contentManager->Get(pFont->facename, fontParam); ASSERT(font != NULL); @@ -202,8 +202,8 @@ namespace Gwen ASSERT(font != NULL); - uint16_t width = 0; - uint16_t height = 0; + uint width = 0; + uint height = 0; font->MeasureString(&width, &height, text.c_str()); Gwen::Point result(width, height); diff --git a/src/framework/input/marmaladekeyboard.cpp b/src/framework/input/marmaladekeyboard.cpp index 568a95d..22d7b17 100644 --- a/src/framework/input/marmaladekeyboard.cpp +++ b/src/framework/input/marmaladekeyboard.cpp @@ -21,7 +21,7 @@ MarmaladeKeyboard::~MarmaladeKeyboard() BOOL MarmaladeKeyboard::OnKeyEvent(const s3eKeyboardEvent *eventArgs) { - int32_t keyCode = (int32_t)eventArgs->m_Key; + int keyCode = (int)eventArgs->m_Key; BOOL isDown = (BOOL)eventArgs->m_Pressed; if (isDown) diff --git a/src/framework/input/marmalademouse.cpp b/src/framework/input/marmalademouse.cpp index e6f9c73..8303dc2 100644 --- a/src/framework/input/marmalademouse.cpp +++ b/src/framework/input/marmalademouse.cpp @@ -29,10 +29,10 @@ void MarmaladeMouse::ResetDeltas() BOOL MarmaladeMouse::OnButtonEvent(const s3ePointerEvent *eventArgs) { - int32_t button = (int32_t)eventArgs->m_Button; + int button = (int32_t)eventArgs->m_Button; BOOL isDown = (BOOL)eventArgs->m_Pressed; - int32_t x = eventArgs->m_x; - int32_t y = eventArgs->m_y; + int x = eventArgs->m_x; + int y = eventArgs->m_y; if (isDown) { diff --git a/src/framework/input/marmalademouse.h b/src/framework/input/marmalademouse.h index 08df7eb..04a09e8 100644 --- a/src/framework/input/marmalademouse.h +++ b/src/framework/input/marmalademouse.h @@ -24,10 +24,10 @@ public: BOOL IsPressed(MOUSE_BUTTONS button); void Lock(MOUSE_BUTTONS button) { m_lockedButtons[button] = TRUE; } - uint16_t GetX() const { return m_x; } - uint16_t GetY() const { return m_y; } - int16_t GetDeltaX() const { return m_deltaX; } - int16_t GetDeltaY() const { return m_deltaY; } + uint GetX() const { return m_x; } + uint GetY() const { return m_y; } + int GetDeltaX() const { return m_deltaX; } + int GetDeltaY() const { return m_deltaY; } void Reset(); @@ -39,10 +39,10 @@ private: BOOL *m_buttons; BOOL *m_lockedButtons; - uint16_t m_x; - uint16_t m_y; - int16_t m_deltaX; - int16_t m_deltaY; + uint m_x; + uint m_y; + int m_deltaX; + int m_deltaY; }; #endif diff --git a/src/framework/input/marmaladetouchscreen.cpp b/src/framework/input/marmaladetouchscreen.cpp index 64542e3..bc04210 100644 --- a/src/framework/input/marmaladetouchscreen.cpp +++ b/src/framework/input/marmaladetouchscreen.cpp @@ -27,7 +27,7 @@ void MarmaladeTouchPointer::ResetDeltas() m_deltaY = 0; } -BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint16_t left, uint16_t top, uint16_t right, uint16_t 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; @@ -43,12 +43,12 @@ BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Rect &area) const return FALSE; } -BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint16_t centerX, uint16_t centerY, uint16_t radius) const +BOOL MarmaladeTouchPointer::IsTouchingWithinArea(uint centerX, uint centerY, uint radius) const { if (m_isTouching) { - uint32_t squaredDistance = ((centerX - m_x) * (centerX - m_x)) + ((centerY - m_y) * (centerY - m_y)); - uint32_t squaredRadius = radius * radius; + uint squaredDistance = ((centerX - m_x) * (centerX - m_x)) + ((centerY - m_y) * (centerY - m_y)); + uint squaredRadius = radius * radius; if (squaredDistance <= squaredRadius) return TRUE; } @@ -60,8 +60,8 @@ BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Circle &area) const { if (m_isTouching) { - uint32_t squaredDistance = ((area.x - m_x) * (area.x - m_x)) + ((area.y - m_y) * (area.y - m_y)); - uint32_t squaredRadius = area.radius * area.radius; + 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; } @@ -69,7 +69,7 @@ BOOL MarmaladeTouchPointer::IsTouchingWithinArea(const Circle &area) const return FALSE; } -void MarmaladeTouchPointer::OnDown(int32_t id, uint16_t x, uint16_t y) +void MarmaladeTouchPointer::OnDown(int id, uint x, uint y) { m_isTouching = TRUE; m_x = x; @@ -79,7 +79,7 @@ void MarmaladeTouchPointer::OnDown(int32_t id, uint16_t x, uint16_t y) m_id = id; } -void MarmaladeTouchPointer::OnMove(int32_t id, uint16_t x, uint16_t y) +void MarmaladeTouchPointer::OnMove(int id, uint x, uint y) { // calculate the amount moved since the last time first... m_deltaX = x - m_x; @@ -123,7 +123,7 @@ MarmaladeTouchscreen::~MarmaladeTouchscreen() void MarmaladeTouchscreen::ResetDeltas() { - for (uint32_t i = 0; i < m_maxTouchPoints; ++i) + for (uint i = 0; i < m_maxTouchPoints; ++i) { if (m_pointers[i].GetId() != INVALID_TOUCH_POINTER) m_pointers[i].ResetDeltas(); @@ -157,8 +157,8 @@ BOOL MarmaladeTouchscreen::OnMultiTouchTapEvent(const s3ePointerTouchEvent *even MarmaladeTouchPointer *pointer = GetPointerByIdOrFirstAvailable(eventArgs->m_TouchID); if (pointer->GetId() == INVALID_TOUCH_POINTER) { - uint16_t x = Clamp(eventArgs->m_x, m_viewBounds.left, m_viewBounds.right) - m_viewBounds.left; - uint16_t y = Clamp(eventArgs->m_y, m_viewBounds.top, m_viewBounds.bottom) - m_viewBounds.top; + uint x = Clamp(eventArgs->m_x, m_viewBounds.left, m_viewBounds.right) - m_viewBounds.left; + uint y = Clamp(eventArgs->m_y, m_viewBounds.top, m_viewBounds.bottom) - m_viewBounds.top; pointer->OnDown(eventArgs->m_TouchID, x, y); // if no other touch points are currently down, then this one is to be @@ -225,8 +225,8 @@ BOOL MarmaladeTouchscreen::OnMultiTouchMotionEvent(const s3ePointerTouchMotionEv MarmaladeTouchPointer *pointer = GetPointerById_internal(eventArgs->m_TouchID); if (pointer != NULL) { - uint16_t x = Clamp(eventArgs->m_x, m_viewBounds.left, m_viewBounds.right) - m_viewBounds.left; - uint16_t y = Clamp(eventArgs->m_y, m_viewBounds.top, m_viewBounds.bottom) - m_viewBounds.top; + uint x = Clamp(eventArgs->m_x, m_viewBounds.left, m_viewBounds.right) - m_viewBounds.left; + 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; @@ -264,9 +264,9 @@ BOOL MarmaladeTouchscreen::WasTapped() return FALSE; } -const TouchPointer* MarmaladeTouchscreen::GetPointerById(int32_t id) const +const TouchPointer* MarmaladeTouchscreen::GetPointerById(int id) const { - for (uint32_t i = 0; i < m_maxTouchPoints; ++i) + for (uint i = 0; i < m_maxTouchPoints; ++i) { if (m_pointers[i].GetId() == id) return (TouchPointer*)&m_pointers[i]; @@ -275,9 +275,9 @@ const TouchPointer* MarmaladeTouchscreen::GetPointerById(int32_t id) const return NULL; } -MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerById_internal(int32_t id) +MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerById_internal(int id) { - for (uint32_t i = 0; i < m_maxTouchPoints; ++i) + for (uint i = 0; i < m_maxTouchPoints; ++i) { if (m_pointers[i].GetId() == id) return &m_pointers[i]; @@ -288,7 +288,7 @@ MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerById_internal(int32_t id) MarmaladeTouchPointer* MarmaladeTouchscreen::GetFirstAvailablePointer() { - for (uint32_t i = 0; i < m_maxTouchPoints; ++i) + for (uint i = 0; i < m_maxTouchPoints; ++i) { if (m_pointers[i].GetId() == INVALID_TOUCH_POINTER) return &m_pointers[i]; @@ -297,7 +297,7 @@ MarmaladeTouchPointer* MarmaladeTouchscreen::GetFirstAvailablePointer() return NULL; } -MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerByIdOrFirstAvailable(int32_t id) +MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerByIdOrFirstAvailable(int id) { MarmaladeTouchPointer *result = GetPointerById_internal(id); if (result == NULL) @@ -308,7 +308,7 @@ MarmaladeTouchPointer* MarmaladeTouchscreen::GetPointerByIdOrFirstAvailable(int3 MarmaladeTouchPointer* MarmaladeTouchscreen::GetNextDownPointer() { - for (uint32_t i = 0; i < m_maxTouchPoints; ++i) + for (uint i = 0; i < m_maxTouchPoints; ++i) { if (m_pointers[i].IsTouching()) return &m_pointers[i]; @@ -329,12 +329,12 @@ void MarmaladeTouchscreen::Reset() m_isLocked = FALSE; m_currentTouchPoints = 0; - for (uint32_t i = 0; i < m_maxTouchPoints; ++i) + for (uint i = 0; i < m_maxTouchPoints; ++i) { BOOL isPrimary = FALSE; if (oldPrimaryPointer == &m_pointers[i]) isPrimary = TRUE; - uint32_t id = m_pointers[i].GetId(); + 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 d1f9d6e..75b9e12 100644 --- a/src/framework/input/marmaladetouchscreen.h +++ b/src/framework/input/marmaladetouchscreen.h @@ -20,28 +20,28 @@ public: void ResetDeltas(); - int32_t GetId() const { return m_id; } - uint16_t GetX() const { return m_x; } - uint16_t GetY() const { return m_y; } - int16_t GetDeltaX() const { return m_deltaX; } - int16_t GetDeltaY() const { return m_deltaY; } + int GetId() const { return m_id; } + uint GetX() const { return m_x; } + 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 IsTouchingWithinArea(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) const; + BOOL IsTouchingWithinArea(uint left, uint top, uint right, uint bottom) const; BOOL IsTouchingWithinArea(const Rect &area) const; - BOOL IsTouchingWithinArea(uint16_t centerX, uint16_t centerY, uint16_t radius) const; + BOOL IsTouchingWithinArea(uint centerX, uint centerY, uint radius) const; BOOL IsTouchingWithinArea(const Circle &area) const; - void OnDown(int32_t id, uint16_t x, uint16_t y); - void OnMove(int32_t id, uint16_t x, uint16_t y); + void OnDown(int id, uint x, uint y); + void OnMove(int id, uint x, uint y); void OnUp(); private: - int32_t m_id; - uint16_t m_x; - uint16_t m_y; - int16_t m_deltaX; - int16_t m_deltaY; + int m_id; + uint m_x; + uint m_y; + int m_deltaX; + int m_deltaY; BOOL m_isTouching; }; @@ -60,13 +60,13 @@ public: BOOL OnMultiTouchMotionEvent(const s3ePointerTouchMotionEvent *eventArgs); BOOL IsMultitouchAvailable() const { return m_isMultitouchAvailable; } - uint32_t GetPointerCount() const { return m_maxTouchPoints; } - uint32_t GetCurrentPointerCount() const { return m_currentTouchPoints; } + uint GetPointerCount() const { return m_maxTouchPoints; } + uint GetCurrentPointerCount() const { return m_currentTouchPoints; } BOOL IsTouching() const { return m_isTouching; } BOOL WasTapped(); const TouchPointer* GetPrimaryPointer() const { return (TouchPointer*)m_primaryPointer; } - const TouchPointer* GetPointer(uint32_t index) const { return (TouchPointer*)&m_pointers[index]; } - const TouchPointer* GetPointerById(int32_t id) const; + const TouchPointer* GetPointer(uint index) const { return (TouchPointer*)&m_pointers[index]; } + const TouchPointer* GetPointerById(int id) const; void Reset(); @@ -74,10 +74,10 @@ public: void UnregisterListener(TouchscreenListener *listener); private: - MarmaladeTouchPointer* GetPointerById_internal(int32_t id); + MarmaladeTouchPointer* GetPointerById_internal(int id); MarmaladeTouchPointer* GetFirstAvailablePointer(); - MarmaladeTouchPointer* GetPointerByIdOrFirstAvailable(int32_t id); + MarmaladeTouchPointer* GetPointerByIdOrFirstAvailable(int id); MarmaladeTouchPointer* GetNextDownPointer(); Rect m_viewBounds; @@ -89,8 +89,8 @@ private: MarmaladeSystem *m_system; BOOL m_isMultitouchAvailable; - uint32_t m_maxTouchPoints; - uint32_t m_currentTouchPoints; + uint m_maxTouchPoints; + uint m_currentTouchPoints; }; #endif diff --git a/src/framework/input/mouse.h b/src/framework/input/mouse.h index bbc50db..1a6b4ea 100644 --- a/src/framework/input/mouse.h +++ b/src/framework/input/mouse.h @@ -42,22 +42,22 @@ public: /** * @return current X coordinate of the mouse cursor */ - virtual uint16_t GetX() const = 0; + virtual uint GetX() const = 0; /** * @return current Y coordinate of the mouse cursor */ - virtual uint16_t GetY() const = 0; + virtual uint GetY() const = 0; /** * @return amount the mouse cursor moved since the last update along the X axis */ - virtual int16_t GetDeltaX() const = 0; + virtual int GetDeltaX() const = 0; /** * @return amount the mouse cursor moved since the last update along the Y axis */ - virtual int16_t GetDeltaY() const = 0; + virtual int GetDeltaY() const = 0; /** * Resets the current mouse coordinates, button states and locked button states. diff --git a/src/framework/input/mouselistener.h b/src/framework/input/mouselistener.h index 8da3d7d..049ae55 100644 --- a/src/framework/input/mouselistener.h +++ b/src/framework/input/mouselistener.h @@ -19,7 +19,7 @@ public: * @return TRUE if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnMouseButtonDown(MOUSE_BUTTONS button, uint16_t x, uint16_t y) = 0; + virtual BOOL OnMouseButtonDown(MOUSE_BUTTONS button, uint x, uint y) = 0; /** * Callback for when a button is up (released). @@ -29,7 +29,7 @@ public: * @return TRUE if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnMouseButtonUp(MOUSE_BUTTONS button, uint16_t x, uint16_t y) = 0; + virtual BOOL OnMouseButtonUp(MOUSE_BUTTONS button, uint x, uint y) = 0; /** * Callback for when the mouse cursor moves. @@ -40,7 +40,7 @@ public: * @return TRUE if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnMouseMove(uint16_t x, uint16_t y, int16_t deltaX, int16_t 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 2c86d94..1dc0a33 100644 --- a/src/framework/input/sdlkeyboard.cpp +++ b/src/framework/input/sdlkeyboard.cpp @@ -24,7 +24,7 @@ SDLKeyboard::~SDLKeyboard() BOOL SDLKeyboard::OnKeyEvent(const SDL_KeyboardEvent *eventArgs) { - int32_t keyCode = (int32_t)eventArgs->keysym.sym; + int keyCode = (int)eventArgs->keysym.sym; if (eventArgs->state == SDL_PRESSED) { diff --git a/src/framework/input/sdlmouse.cpp b/src/framework/input/sdlmouse.cpp index 141ed27..915f5e2 100644 --- a/src/framework/input/sdlmouse.cpp +++ b/src/framework/input/sdlmouse.cpp @@ -6,7 +6,7 @@ #include // TODO: query hardware for number of buttons? -const int32_t NUM_BUTTONS = 5; +const int NUM_BUTTONS = 5; SDLMouse::SDLMouse(SDLSystem *system) { @@ -33,15 +33,15 @@ void SDLMouse::ResetDeltas() BOOL SDLMouse::OnButtonEvent(const SDL_MouseButtonEvent *eventArgs) { // translate from SDL's button values to our own MOUSE_BUTTONS enum - int32_t button = (int32_t)eventArgs->button - 1; + int button = (int)eventArgs->button - 1; if (eventArgs->state == SDL_PRESSED) { // Pressed only if not locked m_buttons[button] = !(m_lockedButtons[button]); - uint16_t x = eventArgs->x; - uint16_t y = eventArgs->y; + uint x = eventArgs->x; + uint y = eventArgs->y; // always report button down events // NOTE: we're ignoring the "locked button" state because listeners @@ -54,8 +54,8 @@ BOOL SDLMouse::OnButtonEvent(const SDL_MouseButtonEvent *eventArgs) } else { - uint16_t x = eventArgs->x; - uint16_t y = eventArgs->y; + uint x = eventArgs->x; + uint y = eventArgs->y; // if the button is just being released this tick, then trigger an event in all listeners if (m_buttons[button]) diff --git a/src/framework/input/sdlmouse.h b/src/framework/input/sdlmouse.h index 440466a..8587165 100644 --- a/src/framework/input/sdlmouse.h +++ b/src/framework/input/sdlmouse.h @@ -25,10 +25,10 @@ public: BOOL IsPressed(MOUSE_BUTTONS button); void Lock(MOUSE_BUTTONS button) { m_lockedButtons[button] = TRUE; } - uint16_t GetX() const { return m_x; } - uint16_t GetY() const { return m_y; } - int16_t GetDeltaX() const { return m_deltaX; } - int16_t GetDeltaY() const { return m_deltaY; } + uint GetX() const { return m_x; } + uint GetY() const { return m_y; } + int GetDeltaX() const { return m_deltaX; } + int GetDeltaY() const { return m_deltaY; } void Reset(); @@ -42,10 +42,10 @@ private: BOOL *m_buttons; BOOL *m_lockedButtons; - uint16_t m_x; - uint16_t m_y; - int16_t m_deltaX; - int16_t m_deltaY; + uint m_x; + uint m_y; + int m_deltaX; + int m_deltaY; }; #endif diff --git a/src/framework/input/touchscreen.h b/src/framework/input/touchscreen.h index 0888226..f3c185e 100644 --- a/src/framework/input/touchscreen.h +++ b/src/framework/input/touchscreen.h @@ -7,7 +7,7 @@ class TouchscreenListener; struct Rect; struct Circle; -const int32_t INVALID_TOUCH_POINTER = -1; +const int INVALID_TOUCH_POINTER = -1; /** * Interface for a touch point class associated with a touch screen input device. @@ -23,27 +23,27 @@ public: * regardless of what order it is in in the list of touch * points maintained by the touch screen device */ - virtual int32_t GetId() const = 0; + virtual int GetId() const = 0; /** * @return current X coordinate of the touch point */ - virtual uint16_t GetX() const = 0; + virtual uint GetX() const = 0; /** * @return current Y coordinate of the touch point */ - virtual uint16_t GetY() const = 0; + virtual uint GetY() const = 0; /** * @return amount the touch point moved since the last update along the X axis */ - virtual int16_t GetDeltaX() const = 0; + virtual int GetDeltaX() const = 0; /** * @return amount the touch point moved since the last update along the Y axis */ - virtual int16_t GetDeltaY() const = 0; + virtual int GetDeltaY() const = 0; /** * @return TRUE if this touch point is currently down @@ -58,7 +58,7 @@ public: * @param bottom bottom Y coordinate of the area to check * @return TRUE if the touch point is currently down within the given area */ - virtual BOOL IsTouchingWithinArea(uint16_t left, uint16_t top, uint16_t right, uint16_t 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. @@ -74,7 +74,7 @@ public: * @param radius the radius of the circular area to check * @return TRUE if the touch point is currently down within the given area */ - virtual BOOL IsTouchingWithinArea(uint16_t centerX, uint16_t centerY, uint16_t 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. @@ -101,7 +101,7 @@ public: /** * @return the maximum number of touch points supported (not necessarily the number currently down) */ - virtual uint32_t GetPointerCount() const = 0; + virtual uint GetPointerCount() const = 0; /** * @return TRUE if at least one touch point is currently down @@ -129,7 +129,7 @@ public: * range 0 .. (GetPointerCount() - 1) * @return the corresponding touch pointer */ - virtual const TouchPointer* GetPointer(uint32_t index) const = 0; + virtual const TouchPointer* GetPointer(uint index) const = 0; /** * Gets a touch pointer by it's unique ID. This will always return the @@ -137,7 +137,7 @@ public: * @param id the unique ID of the pointer to get * @return the corresponding touch pointer, or NULL if the ID doesn't match any existing touch pointer */ - virtual const TouchPointer* GetPointerById(int32_t id) const = 0; + virtual const TouchPointer* GetPointerById(int id) const = 0; /** * Resets the current touch screen and all touch point states. diff --git a/src/framework/input/touchscreenlistener.h b/src/framework/input/touchscreenlistener.h index 0f85b83..ebbcf8f 100644 --- a/src/framework/input/touchscreenlistener.h +++ b/src/framework/input/touchscreenlistener.h @@ -20,7 +20,7 @@ public: * @return TRUE if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnTouchDown(int32_t id, uint16_t x, uint16_t 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). @@ -30,7 +30,7 @@ public: * @return TRUE if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnTouchUp(int32_t id, BOOL isPrimary) = 0; + virtual BOOL OnTouchUp(int id, BOOL isPrimary) = 0; /** * Callback for when the touch point moves. @@ -44,7 +44,7 @@ public: * @return TRUE if no further listener callbacks of this kind should * be invoked until the next event occurs */ - virtual BOOL OnTouchMove(int32_t id, uint16_t x, uint16_t y, int16_t deltaX, int16_t 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 7cd06a6..a639e2f 100644 --- a/src/framework/marmaladegamewindow.cpp +++ b/src/framework/marmaladegamewindow.cpp @@ -57,7 +57,7 @@ BOOL MarmaladeGameWindow::Create(GameWindowParams *params) return TRUE; } -BOOL MarmaladeGameWindow::Resize(uint16_t width, uint16_t 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) diff --git a/src/framework/marmaladegamewindow.h b/src/framework/marmaladegamewindow.h index b9db539..f4cca8d 100644 --- a/src/framework/marmaladegamewindow.h +++ b/src/framework/marmaladegamewindow.h @@ -21,14 +21,14 @@ public: virtual ~MarmaladeGameWindow(); BOOL Create(GameWindowParams *params); - BOOL Resize(uint16_t width = IGNORE_DIMENSIONS, uint16_t height = IGNORE_DIMENSIONS); + BOOL Resize(uint width = IGNORE_DIMENSIONS, uint height = IGNORE_DIMENSIONS); BOOL ToggleFullscreen(); void Close(); - uint16_t GetWidth() const { return m_rect.GetWidth(); } - uint16_t GetHeight() const { return m_rect.GetHeight(); } + uint GetWidth() const { return m_rect.GetWidth(); } + uint GetHeight() const { return m_rect.GetHeight(); } const Rect& GetRect() const { return m_rect; } - uint8_t GetBPP() const { return m_bpp; } + uint GetBPP() const { return m_bpp; } BOOL IsWindowed() const { return !m_fullscreen; } SCREEN_ORIENTATION_ANGLE GetScreenOrientation() const { return m_screenOrientation; } @@ -56,7 +56,7 @@ private: BOOL m_closing; Rect m_rect; - uint8_t m_bpp; + uint m_bpp; BOOL m_fullscreen; SCREEN_ORIENTATION_ANGLE m_screenOrientation; diff --git a/src/framework/marmaladesystem.cpp b/src/framework/marmaladesystem.cpp index 36843bb..9dbb4d0 100644 --- a/src/framework/marmaladesystem.cpp +++ b/src/framework/marmaladesystem.cpp @@ -21,19 +21,19 @@ #include -int32 _MarmaladeEventCallback_Pause(void *systemData, void *userData); -int32 _MarmaladeEventCallback_Resume(void *systemData, void *userData); -int32 _MarmaladeEventCallback_Exit(void *systemData, void *userData); -int32 _MarmaladeEventCallback_GLSuspend(void *systemData, void *userData); -int32 _MarmaladeEventCallback_GLResume(void *systemData, void *userData); -int32 _MarmaladeEventCallback_ScreenResize(void *systemData, void *userData); -int32 _MarmaladeEventCallback_Key(void *systemData, void *userData); -int32 _MarmaladeEventCallback_KeyChar(void *systemData, void *userData); -int32 _MarmaladeEventCallback_PointerButton(void *systemData, void *userData); -int32 _MarmaladeEventCallback_PointerMotion(void *systemData, void *userData); -int32 _MarmaladeEventCallback_PointerMultitouchButton(void *systemData, void *userData); -int32 _MarmaladeEventCallback_PointerMultitouchMotion(void *systemData, void *userData); -int32_t _MarmaladeEvent_PassToSystem(MARMALADE_EVENT event, void *systemData, void *userData); +int _MarmaladeEventCallback_Pause(void *systemData, void *userData); +int _MarmaladeEventCallback_Resume(void *systemData, void *userData); +int _MarmaladeEventCallback_Exit(void *systemData, void *userData); +int _MarmaladeEventCallback_GLSuspend(void *systemData, void *userData); +int _MarmaladeEventCallback_GLResume(void *systemData, void *userData); +int _MarmaladeEventCallback_ScreenResize(void *systemData, void *userData); +int _MarmaladeEventCallback_Key(void *systemData, void *userData); +int _MarmaladeEventCallback_KeyChar(void *systemData, void *userData); +int _MarmaladeEventCallback_PointerButton(void *systemData, void *userData); +int _MarmaladeEventCallback_PointerMotion(void *systemData, void *userData); +int _MarmaladeEventCallback_PointerMultitouchButton(void *systemData, void *userData); +int _MarmaladeEventCallback_PointerMultitouchMotion(void *systemData, void *userData); +int _MarmaladeEvent_PassToSystem(MARMALADE_EVENT event, void *systemData, void *userData); MarmaladeSystem::MarmaladeSystem() { @@ -77,15 +77,15 @@ BOOL MarmaladeSystem::Initialize() const char* deviceID = s3eDeviceGetString(S3E_DEVICE_ID); const char* deviceOS = s3eDeviceGetString(S3E_DEVICE_OS); - int32 deviceOsVersion = s3eDeviceGetInt(S3E_DEVICE_OS_VERSION); + int deviceOsVersion = s3eDeviceGetInt(S3E_DEVICE_OS_VERSION); int osVersionMajor = (deviceOsVersion >> 16); int osVersionMinor = deviceOsVersion & 0xffff; const char* deviceClass = s3eDeviceGetString(S3E_DEVICE_CLASS); const char* deviceArch = s3eDeviceGetString(S3E_DEVICE_ARCHITECTURE); const char* deviceChipset = s3eDeviceGetString(S3E_DEVICE_CHIPSET); - int32 deviceTotalMemKB = s3eDeviceGetInt(S3E_DEVICE_MEM_TOTAL); - int32 deviceFreeMemKB = s3eDeviceGetInt(S3E_DEVICE_MEM_FREE); - int32 heapSize = s3eMemoryGetInt(S3E_MEMORY_SIZE); + int deviceTotalMemKB = s3eDeviceGetInt(S3E_DEVICE_MEM_TOTAL); + int deviceFreeMemKB = s3eDeviceGetInt(S3E_DEVICE_MEM_FREE); + int heapSize = s3eMemoryGetInt(S3E_MEMORY_SIZE); LOG_INFO(LOGCAT_SYSTEM, "Device ID: %s\n", deviceID); LOG_INFO(LOGCAT_SYSTEM, "Device OS: %s (%d.%d)\n", deviceOS, osVersionMajor, osVersionMinor); @@ -236,13 +236,13 @@ BOOL MarmaladeSystem::CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *p m_window = window; - int32 glVersion = s3eGLGetInt(S3E_GL_VERSION); + int glVersion = s3eGLGetInt(S3E_GL_VERSION); int glVersionMajor = (glVersion >> 8) & 0xff; int glVersionMinor = glVersion & 0xff; - int32 eglVersion = s3eGLGetInt(S3E_EGL_VERSION); + int eglVersion = s3eGLGetInt(S3E_EGL_VERSION); int eglVersionMajor = (eglVersion >> 8) & 0xff; int eglVersionMinor = eglVersion & 0xff; - int32 glMustSuspend = s3eGLGetInt(S3E_GL_MUST_SUSPEND); + int glMustSuspend = s3eGLGetInt(S3E_GL_MUST_SUSPEND); LOG_INFO(LOGCAT_SYSTEM, "GL Version: %d.%d\n", glVersionMajor, glVersionMinor); LOG_INFO(LOGCAT_SYSTEM, "EGL Version: %d.%d\n", eglVersionMajor, eglVersionMinor); @@ -302,7 +302,7 @@ void MarmaladeSystem::ProcessEvents() s3eDeviceYield(0); } -int32_t MarmaladeSystem::OnEvent(const MarmaladeSystemEvent *eventArgs) +int MarmaladeSystem::OnEvent(const MarmaladeSystemEvent *eventArgs) { switch (eventArgs->event) { @@ -394,7 +394,7 @@ void MarmaladeSystem::Quit() } } -void MarmaladeSystem::Delay(uint32_t milliseconds) const +void MarmaladeSystem::Delay(uint milliseconds) const { unsigned int start = GetTicks(); unsigned int elapsed = 0; @@ -406,67 +406,67 @@ void MarmaladeSystem::Delay(uint32_t milliseconds) const while (milliseconds > elapsed); } -int32 _MarmaladeEventCallback_Pause(void *systemData, void *userData) +int _MarmaladeEventCallback_Pause(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_PAUSE, systemData, userData); } -int32 _MarmaladeEventCallback_Resume(void *systemData, void *userData) +int _MarmaladeEventCallback_Resume(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_RESUME, systemData, userData); } -int32 _MarmaladeEventCallback_Exit(void *systemData, void *userData) +int _MarmaladeEventCallback_Exit(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_EXIT, systemData, userData); } -int32 _MarmaladeEventCallback_GLSuspend(void *systemData, void *userData) +int _MarmaladeEventCallback_GLSuspend(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_GLSUSPEND, systemData, userData); } -int32 _MarmaladeEventCallback_GLResume(void *systemData, void *userData) +int _MarmaladeEventCallback_GLResume(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_GLRESUME, systemData, userData); } -int32 _MarmaladeEventCallback_ScreenResize(void *systemData, void *userData) +int _MarmaladeEventCallback_ScreenResize(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_SCREENRESIZE, systemData, userData); } -int32 _MarmaladeEventCallback_Key(void *systemData, void *userData) +int _MarmaladeEventCallback_Key(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_KEY, systemData, userData); } -int32 _MarmaladeEventCallback_KeyChar(void *systemData, void *userData) +int _MarmaladeEventCallback_KeyChar(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_KEYCHAR, systemData, userData); } -int32 _MarmaladeEventCallback_PointerButton(void *systemData, void *userData) +int _MarmaladeEventCallback_PointerButton(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_POINTER_BUTTON, systemData, userData); } -int32 _MarmaladeEventCallback_PointerMotion(void *systemData, void *userData) +int _MarmaladeEventCallback_PointerMotion(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_POINTER_MOTION, systemData, userData); } -int32 _MarmaladeEventCallback_PointerMultitouchButton(void *systemData, void *userData) +int _MarmaladeEventCallback_PointerMultitouchButton(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_POINTER_MULTITOUCH_BUTTON, systemData, userData); } -int32 _MarmaladeEventCallback_PointerMultitouchMotion(void *systemData, void *userData) +int _MarmaladeEventCallback_PointerMultitouchMotion(void *systemData, void *userData) { return _MarmaladeEvent_PassToSystem(MARMALADE_EVENT_POINTER_MULTITOUCH_MOTION, systemData, userData); } -int32_t _MarmaladeEvent_PassToSystem(MARMALADE_EVENT event, void *systemData, void *userData) +int _MarmaladeEvent_PassToSystem(MARMALADE_EVENT event, void *systemData, void *userData) { MarmaladeSystemEvent eventArgs; eventArgs.event = event; diff --git a/src/framework/marmaladesystem.h b/src/framework/marmaladesystem.h index fcaf112..fedb079 100644 --- a/src/framework/marmaladesystem.h +++ b/src/framework/marmaladesystem.h @@ -30,7 +30,7 @@ public: BOOL Initialize(); BOOL CreateGameWindow(BaseGameApp *gameApp, GameWindowParams *params); void ProcessEvents(); - int32_t OnEvent(const MarmaladeSystemEvent *eventArgs); + int OnEvent(const MarmaladeSystemEvent *eventArgs); void Quit(); BOOL IsQuitting() const { return m_isQuitting; } @@ -44,8 +44,8 @@ public: Keyboard* GetKeyboard() const { return (Keyboard*)m_keyboard; } Touchscreen* GetTouchscreen() const { return (Touchscreen*)m_touchscreen; } - uint32_t GetTicks() const { return (uint32_t)s3eTimerGetMs(); } - void Delay(uint32_t milliseconds) const; + uint GetTicks() const { return (uint32_t)s3eTimerGetMs(); } + void Delay(uint milliseconds) const; private: BOOL m_isQuitting; diff --git a/src/framework/math/boundingbox.cpp b/src/framework/math/boundingbox.cpp index 33757ae..baa9e41 100644 --- a/src/framework/math/boundingbox.cpp +++ b/src/framework/math/boundingbox.cpp @@ -4,7 +4,7 @@ #include "../common.h" -BoundingBox::BoundingBox(const Vector3 *vertices, int numVertices) +BoundingBox::BoundingBox(const Vector3 *vertices, uint numVertices) { ASSERT(vertices != NULL); ASSERT(numVertices > 0); @@ -15,7 +15,7 @@ BoundingBox::BoundingBox(const Vector3 *vertices, int numVertices) float maxY = 0.0f; float maxZ = 0.0f; - for (int i = 0; i < numVertices; ++i) + for (uint i = 0; i < numVertices; ++i) { minX = Min(vertices[i].x, minX); minY = Min(vertices[i].y, minY); diff --git a/src/framework/math/boundingbox.h b/src/framework/math/boundingbox.h index 7756ecc..df90d20 100644 --- a/src/framework/math/boundingbox.h +++ b/src/framework/math/boundingbox.h @@ -45,7 +45,7 @@ struct BoundingBox * @param vertices an array of vertices to be fully enclosed within the box * @param numVertices the number of vertices being passed */ - BoundingBox(const Vector3 *vertices, int numVertices); + BoundingBox(const Vector3 *vertices, uint numVertices); /** * Creates a box with the specified properties. diff --git a/src/framework/math/boundingsphere.cpp b/src/framework/math/boundingsphere.cpp index 46066bf..6fe0be9 100644 --- a/src/framework/math/boundingsphere.cpp +++ b/src/framework/math/boundingsphere.cpp @@ -4,7 +4,7 @@ #include -BoundingSphere::BoundingSphere(const Vector3 *vertices, int numVertices) +BoundingSphere::BoundingSphere(const Vector3 *vertices, uint numVertices) { ASSERT(vertices != NULL); ASSERT(numVertices > 0); @@ -20,7 +20,7 @@ BoundingSphere::BoundingSphere(const Vector3 *vertices, int numVertices) int maxZ = 0; // find min & max points for x, y and z - for (int i = 0; i < numVertices; ++i) + for (uint i = 0; i < numVertices; ++i) { if (vertices[i].x < vertices[minX].x) minX = i; @@ -61,7 +61,7 @@ BoundingSphere::BoundingSphere(const Vector3 *vertices, int numVertices) // now expand the sphere to make sure it encompasses all the points (if it doesn't already) Vector3 d; - for (int i = 0; i < numVertices; ++i) + for (uint i = 0; i < numVertices; ++i) { d = vertices[i] - center; float distanceSq = Vector3::Dot(d, d); diff --git a/src/framework/math/boundingsphere.h b/src/framework/math/boundingsphere.h index 9ca7a91..37dcb4d 100644 --- a/src/framework/math/boundingsphere.h +++ b/src/framework/math/boundingsphere.h @@ -35,7 +35,7 @@ struct BoundingSphere * @param vertices an array of vertices to be fully enclosed within the sphere * @param numVertices the number of vertices being passed */ - BoundingSphere(const Vector3 *vertices, int numVertices); + BoundingSphere(const Vector3 *vertices, uint numVertices); Vector3 center; float radius; diff --git a/src/framework/math/camera.cpp b/src/framework/math/camera.cpp index 2f9a7fb..f72f07c 100644 --- a/src/framework/math/camera.cpp +++ b/src/framework/math/camera.cpp @@ -37,7 +37,7 @@ Camera::~Camera() SAFE_DELETE(m_frustum); } -void Camera::CalculateDefaultProjection(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom) +void Camera::CalculateDefaultProjection(uint left, uint top, uint right, uint bottom) { m_viewportWidth = right - left; m_viewportHeight = bottom - top; @@ -99,7 +99,7 @@ void Camera::UpdateProjectionMatrix() ); } -Ray Camera::Pick(uint16_t screenX, uint16_t screenY) const +Ray Camera::Pick(uint screenX, uint screenY) const { float nx = 2.0f * ((float)(screenX - (m_viewContext->GetViewportWidth() / 2))) / ((float)m_viewContext->GetViewportWidth()); float ny = 2.0f * -((float)(screenY - (m_viewContext->GetViewportHeight() / 2))) / ((float)m_viewContext->GetViewportHeight()); @@ -154,12 +154,12 @@ Point2 Camera::Project(const Vector3 &objectPosition, const Matrix4x4 &modelview // map to 2D viewport coordinates (ignoring Z) Point2 out; - out.x = (int32_t)(((transformedX * 0.5f) + 0.5f) * (float)m_viewContext->GetViewportWidth() + (float)m_viewContext->GetViewportLeft()); - out.y = (int32_t)(((transformedY * 0.5f) + 0.5f) * (float)m_viewContext->GetViewportHeight() + (float)m_viewContext->GetViewportTop()); + out.x = (int)(((transformedX * 0.5f) + 0.5f) * (float)m_viewContext->GetViewportWidth() + (float)m_viewContext->GetViewportLeft()); + out.y = (int)(((transformedY * 0.5f) + 0.5f) * (float)m_viewContext->GetViewportHeight() + (float)m_viewContext->GetViewportTop()); // float z = (1.0f + transformedZ) * 0.5f; // would be between 0.0f and 1.0f // adjust Y coordinate so that 0 is at the top of the screen instead of the bottom - out.y = (int32_t)m_viewContext->GetViewportHeight() - out.y; + out.y = (int)m_viewContext->GetViewportHeight() - out.y; return out; } diff --git a/src/framework/math/camera.h b/src/framework/math/camera.h index ae8f007..d8889bb 100644 --- a/src/framework/math/camera.h +++ b/src/framework/math/camera.h @@ -67,7 +67,7 @@ public: * @param screenY 2D Y coordinate in screen space * @return Ray a ray originating from the given 2D screen space coordinates */ - Ray Pick(uint16_t screenX, uint16_t screenY) const; + Ray Pick(uint screenX, uint screenY) const; /** * Projects the given 3D coordinates into 2D screen space coordinates. @@ -151,12 +151,12 @@ public: /** * @return the width of the camera's current viewport */ - uint16_t GetViewportWidth() const { return m_viewportWidth; } + uint GetViewportWidth() const { return m_viewportWidth; } /** * @return the height of the camera's current viewport */ - uint16_t GetViewportHeight() const { return m_viewportHeight; } + uint GetViewportHeight() const { return m_viewportHeight; } /** * @return the aspect ratio of the camera's current viewport @@ -181,7 +181,7 @@ protected: * @param right right X coordinate of the viewport * @param bottom bottom Y coordinate of the viewport */ - void CalculateDefaultProjection(uint16_t left, uint16_t top, uint16_t right, uint16_t bottom); + void CalculateDefaultProjection(uint left, uint top, uint right, uint bottom); /** * Calculates a default "look at" matrix to position and orient the camera. @@ -198,8 +198,8 @@ private: float m_nearHeight; float m_nearWidth; - uint16_t m_viewportWidth; - uint16_t m_viewportHeight; + uint m_viewportWidth; + uint m_viewportHeight; ViewContext *m_viewContext; Frustum *m_frustum; diff --git a/src/framework/math/circle.h b/src/framework/math/circle.h index c75c20b..327dfc6 100644 --- a/src/framework/math/circle.h +++ b/src/framework/math/circle.h @@ -19,7 +19,7 @@ struct Circle * @param y Y coordinate of the circle's center point * @param radius the radius of the circle */ - Circle(int32_t x, int32_t y, uint32_t radius); + Circle(int x, int y, uint radius); /** * Set new properties for this circle. @@ -27,37 +27,37 @@ struct Circle * @param y Y coordinate of the circle's center point * @param radius the radius of the circle */ - void Set(int32_t x, int32_t y, uint32_t radius); + void Set(int x, int y, uint radius); /** * @return the circle's diameter */ - int32_t GetDiameter() const; + uint GetDiameter() const; - int32_t x; - int32_t y; - uint32_t radius; + int x; + int y; + uint radius; }; inline Circle::Circle() { } -inline Circle::Circle(int32_t x, int32_t y, uint32_t radius) +inline Circle::Circle(int x, int y, uint radius) { this->x = x; this->y = y; this->radius = radius; } -inline void Circle::Set(int32_t x, int32_t y, uint32_t radius) +inline void Circle::Set(int x, int y, uint radius) { this->x = x; this->y = y; this->radius = radius; } -inline int32_t Circle::GetDiameter() const +inline uint Circle::GetDiameter() const { return radius * 2; } diff --git a/src/framework/math/frustum.h b/src/framework/math/frustum.h index 34b7716..5c3cd3c 100644 --- a/src/framework/math/frustum.h +++ b/src/framework/math/frustum.h @@ -18,7 +18,7 @@ enum FRUSTUM_SIDES FRUSTUM_FRONT = 5 }; -const int32_t NUM_FRUSTUM_SIDES = 6; +const int NUM_FRUSTUM_SIDES = 6; /** * A viewing frustum that can be used to test for geometry visibility diff --git a/src/framework/math/intersectiontester.cpp b/src/framework/math/intersectiontester.cpp index 766edaf..6251464 100644 --- a/src/framework/math/intersectiontester.cpp +++ b/src/framework/math/intersectiontester.cpp @@ -29,9 +29,9 @@ BOOL IntersectionTester::Test(const BoundingSphere &sphere, const Vector3 &point return FALSE; } -BOOL IntersectionTester::Test(const BoundingBox &box, const Vector3 *vertices, int numVertices, Vector3 *firstIntersection) +BOOL IntersectionTester::Test(const BoundingBox &box, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection) { - for (int i = 0; i < numVertices; ++i) + for (uint i = 0; i < numVertices; ++i) { if ((vertices[i].x >= box.min.x && vertices[i].x <= box.max.x) && (vertices[i].y >= box.min.y && vertices[i].y <= box.max.y) && @@ -46,9 +46,9 @@ BOOL IntersectionTester::Test(const BoundingBox &box, const Vector3 *vertices, i return FALSE; } -BOOL IntersectionTester::Test(const BoundingSphere &sphere, const Vector3 *vertices, int numVertices, Vector3 *firstIntersection) +BOOL IntersectionTester::Test(const BoundingSphere &sphere, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection) { - for (int i = 0; i < numVertices; ++i) + for (uint i = 0; i < numVertices; ++i) { if (fabsf(Vector3::Distance(vertices[i], sphere.center)) < sphere.radius) { diff --git a/src/framework/math/intersectiontester.h b/src/framework/math/intersectiontester.h index 42c77b4..0e0e43a 100644 --- a/src/framework/math/intersectiontester.h +++ b/src/framework/math/intersectiontester.h @@ -42,7 +42,7 @@ public: * point if an intersection is found at all * @return BOOL TRUE if a collision is found, FALSE if not */ - static BOOL Test(const BoundingBox &box, const Vector3 *vertices, int 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. @@ -53,7 +53,7 @@ public: * point if an intersection is found at all * @return BOOL TRUE if a collision is found, FALSE if not */ - static BOOL Test(const BoundingSphere &sphere, const Vector3 *vertices, int numVertices, Vector3 *firstIntersection); + static BOOL Test(const BoundingSphere &sphere, const Vector3 *vertices, uint numVertices, Vector3 *firstIntersection); /** * Tests for a collision between two boxes. diff --git a/src/framework/math/mathhelpers.cpp b/src/framework/math/mathhelpers.cpp index 1b2a289..5418730 100644 --- a/src/framework/math/mathhelpers.cpp +++ b/src/framework/math/mathhelpers.cpp @@ -91,9 +91,9 @@ void GetPointOnCircle(float radius, float angle, float &x, float &y) y = radius * sinf(angle); } -uint32_t GetNextPowerOf2(uint32_t n) +uint GetNextPowerOf2(uint n) { - uint32_t i = n & (~n + 1); + uint i = n & (~n + 1); while (i < n) i <<= 1; diff --git a/src/framework/math/mathhelpers.h b/src/framework/math/mathhelpers.h index e490d90..d51196b 100644 --- a/src/framework/math/mathhelpers.h +++ b/src/framework/math/mathhelpers.h @@ -82,9 +82,9 @@ BOOL GetLowestQuadraticRoot(float a, float b, float c, float maxR, float &root); /** * Gets the power of two value that comes after the given value. * @param n minimum value for which we want to get the power of two after - * @return uint32_t the first power of two that comes after n + * @return uint the first power of two that comes after n */ -uint32_t GetNextPowerOf2(uint32_t n); +uint GetNextPowerOf2(uint n); /** * Returns the 2D point on a circle's circumference given a radius and angle. @@ -141,7 +141,7 @@ inline BOOL IsCloseEnough(float a, float b, float tolerance = TOLERANCE) * @param n number to check * @return BOOL TRUE if a power of two, FALSE if not */ -inline BOOL IsPowerOf2(int32_t n) +inline BOOL IsPowerOf2(int n) { return (n != 0) && !(n & (n - 1)); } diff --git a/src/framework/math/point2.h b/src/framework/math/point2.h index 9375540..ff41188 100644 --- a/src/framework/math/point2.h +++ b/src/framework/math/point2.h @@ -17,20 +17,20 @@ struct Point2 * @param x X coordinate of the point * @param y Y coordinate of the point */ - Point2(int32_t x, int32_t y); + Point2(int x, int y); /** * Creates a point with the specified properties. * @param p an array with 2 values to use as the point's X and Y coordinates */ - Point2(const int32_t *p); + Point2(const int *p); /** * Sets new coordinates for this point. * @param x new X coordinate of the point * @param y new Y coordinate of the point */ - void Set(int32_t x, int32_t y); + void Set(int x, int y); /** * Sets new coordinates for this point. @@ -38,8 +38,8 @@ struct Point2 */ void Set(const Point2 &p); - int32_t x; - int32_t y; + int x; + int y; }; #define ZERO_POINT2 Point2(0, 0) @@ -50,10 +50,10 @@ Point2 operator+(const Point2 &left, const Point2 &right); Point2 &operator+=(Point2 &left, const Point2 &right); Point2 operator-(const Point2 &left, const Point2 &right); Point2 &operator-=(Point2 &left, const Point2 &right); -Point2 operator*(const Point2 &left, int32_t right); -Point2 &operator*=(Point2 &left, int32_t right); -Point2 operator/(const Point2 &left, int32_t right); -Point2 &operator/=(Point2 &left, int32_t right); +Point2 operator*(const Point2 &left, int right); +Point2 &operator*=(Point2 &left, int right); +Point2 operator/(const Point2 &left, int right); +Point2 &operator/=(Point2 &left, int right); Point2 operator*(const Point2 &left, const Point2 &right); Point2 &operator*=(Point2 &left, const Point2 &right); Point2 operator/(const Point2 &left, const Point2 &right); @@ -63,19 +63,19 @@ inline Point2::Point2() { } -inline Point2::Point2(int32_t x, int32_t y) +inline Point2::Point2(int x, int y) { this->x = x; this->y = y; } -inline Point2::Point2(const int32_t *p) +inline Point2::Point2(const int *p) { this->x = p[0]; this->y = p[1]; } -inline void Point2::Set(int32_t x, int32_t y) +inline void Point2::Set(int x, int y) { this->x = x; this->y = y; @@ -123,12 +123,12 @@ inline Point2 &operator-=(Point2 &left, const Point2 &right) return left; } -inline Point2 operator*(const Point2 &left, int32_t right) +inline Point2 operator*(const Point2 &left, int right) { return Point2(left.x * right, left.y * right); } -inline Point2 &operator*=(Point2 &left, int32_t right) +inline Point2 &operator*=(Point2 &left, int right) { left.x *= right; left.y *= right; @@ -136,12 +136,12 @@ inline Point2 &operator*=(Point2 &left, int32_t right) return left; } -inline Point2 operator/(const Point2 &left, int32_t right) +inline Point2 operator/(const Point2 &left, int right) { return Point2(left.x / right, left.y / right); } -inline Point2 &operator/=(Point2 &left, int32_t right) +inline Point2 &operator/=(Point2 &left, int right) { left.x /= right; left.y /= right; diff --git a/src/framework/math/point3.h b/src/framework/math/point3.h index 279e316..b2fe6fd 100644 --- a/src/framework/math/point3.h +++ b/src/framework/math/point3.h @@ -19,13 +19,13 @@ struct Point3 * @param y Y coordinate of the point * @param z Z coordinate of the point */ - Point3(int32_t x, int32_t y, int32_t z); + Point3(int x, int y, int z); /** * Creates a point with the specified properties. * @param p an array with 3 values to use as the point's X, Y and Z coordinates */ - Point3(const int32_t *p); + Point3(const int *p); /** * Sets new coordinates for this point. @@ -33,7 +33,7 @@ struct Point3 * @param y new Y coordinate of the point * @param z new Z coordinate of the point */ - void Set(int32_t x, int32_t y, int32_t z); + void Set(int x, int y, int z); /** * Sets new coordinates for this point. @@ -41,9 +41,9 @@ struct Point3 */ void Set(const Point3 &p); - int32_t x; - int32_t y; - int32_t z; + int x; + int y; + int z; }; #define ZERO_POINT Point3(0, 0, 0) @@ -54,10 +54,10 @@ Point3 operator+(const Point3 &left, const Point3 &right); Point3 &operator+=(Point3 &left, const Point3 &right); Point3 operator-(const Point3 &left, const Point3 &right); Point3 &operator-=(Point3 &left, const Point3 &right); -Point3 operator*(const Point3 &left, int32_t right); -Point3 &operator*=(Point3 &left, int32_t right); -Point3 operator/(const Point3 &left, int32_t right); -Point3 &operator/=(Point3 &left, int32_t right); +Point3 operator*(const Point3 &left, int right); +Point3 &operator*=(Point3 &left, int right); +Point3 operator/(const Point3 &left, int right); +Point3 &operator/=(Point3 &left, int right); Point3 operator*(const Point3 &left, const Point3 &right); Point3 &operator*=(Point3 &left, const Point3 &right); Point3 operator/(const Point3 &left, const Point3 &right); @@ -67,21 +67,21 @@ inline Point3::Point3() { } -inline Point3::Point3(int32_t x, int32_t y, int32_t z) +inline Point3::Point3(int x, int y, int z) { this->x = x; this->y = y; this->z = z; } -inline Point3::Point3(const int32_t *p) +inline Point3::Point3(const int *p) { this->x = p[0]; this->y = p[1]; this->z = p[2]; } -inline void Point3::Set(int32_t x, int32_t y, int32_t z) +inline void Point3::Set(int x, int y, int z) { this->x = x; this->y = y; @@ -133,12 +133,12 @@ inline Point3 &operator-=(Point3 &left, const Point3 &right) return left; } -inline Point3 operator*(const Point3 &left, int32_t right) +inline Point3 operator*(const Point3 &left, int right) { return Point3(left.x * right, left.y * right, left.z * right); } -inline Point3 &operator*=(Point3 &left, int32_t right) +inline Point3 &operator*=(Point3 &left, int right) { left.x *= right; left.y *= right; @@ -147,12 +147,12 @@ inline Point3 &operator*=(Point3 &left, int32_t right) return left; } -inline Point3 operator/(const Point3 &left, int32_t right) +inline Point3 operator/(const Point3 &left, int right) { return Point3(left.x / right, left.y / right, left.z / right); } -inline Point3 &operator/=(Point3 &left, int32_t right) +inline Point3 &operator/=(Point3 &left, int right) { left.x /= right; left.y /= right; diff --git a/src/framework/math/rect.h b/src/framework/math/rect.h index 7b027d3..53391d1 100644 --- a/src/framework/math/rect.h +++ b/src/framework/math/rect.h @@ -20,7 +20,7 @@ struct Rect * @param right right X coordinate * @param bottom bottom Y coordinate */ - Rect(int32_t left, int32_t top, int32_t right, int32_t bottom); + Rect(int left, int top, int right, int bottom); /** * Sets new rect dimensions. @@ -29,7 +29,7 @@ struct Rect * @param right new right X coordinate * @param bottom new bottom Y coordinate */ - void Set(int32_t left, int32_t top, int32_t right, int32_t bottom); + void Set(int left, int top, int right, int bottom); /** * Tests if a point is contained inside this rectangle. @@ -37,29 +37,29 @@ struct Rect * @param y y coordinate of the point to test * @return TRUE if the point is contained, FALSE if not */ - BOOL Contains(int32_t x, int32_t y) const; + BOOL Contains(int x, int y) const; /** * @return the rect's width */ - int32_t GetWidth() const; + int GetWidth() const; /** * @return the rect's height */ - int32_t GetHeight() const; + int GetHeight() const; - int32_t left; - int32_t top; - int32_t right; - int32_t bottom; + int left; + int top; + int right; + int bottom; }; inline Rect::Rect() { } -inline Rect::Rect(int32_t left, int32_t top, int32_t right, int32_t bottom) +inline Rect::Rect(int left, int top, int right, int bottom) { this->left = left; this->top = top; @@ -67,7 +67,7 @@ inline Rect::Rect(int32_t left, int32_t top, int32_t right, int32_t bottom) this->bottom = bottom; } -inline void Rect::Set(int32_t left, int32_t top, int32_t right, int32_t bottom) +inline void Rect::Set(int left, int top, int right, int bottom) { this->left = left; this->top = top; @@ -75,7 +75,7 @@ inline void Rect::Set(int32_t left, int32_t top, int32_t right, int32_t bottom) this->bottom = bottom; } -inline BOOL Rect::Contains(int32_t x, int32_t y) const +inline BOOL Rect::Contains(int x, int y) const { if (x >= left && y >= top && x <= right && y <= bottom) return TRUE; @@ -83,12 +83,12 @@ inline BOOL Rect::Contains(int32_t x, int32_t y) const return FALSE; } -inline int32_t Rect::GetWidth() const +inline int Rect::GetWidth() const { return right - left; } -inline int32_t Rect::GetHeight() const +inline int Rect::GetHeight() const { return bottom - top; } diff --git a/src/framework/operatingsystem.h b/src/framework/operatingsystem.h index c80ed19..8bd7747 100644 --- a/src/framework/operatingsystem.h +++ b/src/framework/operatingsystem.h @@ -92,12 +92,12 @@ public: /** * @return the number of milliseconds since program execution began */ - virtual uint32_t GetTicks() const = 0; + virtual uint GetTicks() const = 0; /** * Blocks execution until the specified number of milliseconds has passed. */ - virtual void Delay(uint32_t milliseconds) const = 0; + virtual void Delay(uint milliseconds) const = 0; }; #endif diff --git a/src/framework/sdlgamewindow.cpp b/src/framework/sdlgamewindow.cpp index b172ed6..5a0c5ab 100644 --- a/src/framework/sdlgamewindow.cpp +++ b/src/framework/sdlgamewindow.cpp @@ -51,7 +51,7 @@ BOOL SDLGameWindow::Create(GameWindowParams *params) LOG_INFO(LOGCAT_WINDOW, " windowed = %d\n", sdlParams->windowed); LOG_INFO(LOGCAT_WINDOW, " resizable = %d\n", sdlParams->resizable); - uint32_t flags = SDL_OPENGL; + uint flags = SDL_OPENGL; if (!sdlParams->windowed) flags |= SDL_FULLSCREEN; if (sdlParams->resizable) @@ -83,7 +83,7 @@ BOOL SDLGameWindow::Create(GameWindowParams *params) return TRUE; } -BOOL SDLGameWindow::Resize(uint16_t width, uint16_t height) +BOOL SDLGameWindow::Resize(uint width, uint height) { BOOL result = SetUpWindow(width, height); GetGameApp()->OnNewContext(); @@ -151,7 +151,7 @@ void SDLGameWindow::DisplaySdlHardwareInfo() LOG_INFO(LOGCAT_WINDOW, "SDL Video Flags selected: SDL_OPENGL%s%s\n", (m_SDLflags & SDL_FULLSCREEN) ? ", SDL_FULLSCREEN" : "", (m_SDLflags & SDL_RESIZABLE) ? ", SDL_RESIZABLE" : ""); - uint32_t tempFlags = m_SDLflags; + uint tempFlags = m_SDLflags; if (tempFlags & SDL_RESIZABLE) tempFlags ^= SDL_RESIZABLE; @@ -182,7 +182,7 @@ void SDLGameWindow::DisplaySdlHardwareInfo() } } -BOOL SDLGameWindow::SetUpWindow(uint16_t width, uint16_t height) +BOOL SDLGameWindow::SetUpWindow(uint width, uint height) { int ret; const SDL_VideoInfo *videoInfo = SDL_GetVideoInfo(); diff --git a/src/framework/sdlgamewindow.h b/src/framework/sdlgamewindow.h index c25bf2b..2d89218 100644 --- a/src/framework/sdlgamewindow.h +++ b/src/framework/sdlgamewindow.h @@ -15,9 +15,9 @@ class BaseGameApp; struct SDLGameWindowParams : GameWindowParams { stl::string title; - uint16_t width; - uint16_t height; - uint8_t bpp; + uint width; + uint height; + uint bpp; BOOL resizable; }; @@ -28,14 +28,14 @@ public: virtual ~SDLGameWindow(); BOOL Create(GameWindowParams *params); - BOOL Resize(uint16_t width, uint16_t height); + BOOL Resize(uint width, uint height); BOOL ToggleFullscreen(); void Close(); - uint16_t GetWidth() const { return m_width; } - uint16_t GetHeight() const { return m_height; } + uint GetWidth() const { return m_width; } + uint GetHeight() const { return m_height; } const Rect& GetRect() const { return m_rect; } - uint8_t GetBPP() const { return m_bpp; } + uint GetBPP() const { return m_bpp; } BOOL IsWindowed() const { return m_fullscreen; } SCREEN_ORIENTATION_ANGLE GetScreenOrientation() const { return m_screenOrientation; } @@ -49,7 +49,7 @@ public: private: void DisplaySdlHardwareInfo(); - BOOL SetUpWindow(uint16_t width, uint16_t height); + BOOL SetUpWindow(uint width, uint height); BOOL m_active; BOOL m_focused; @@ -57,13 +57,13 @@ private: BOOL m_hasCurrentGLContext; SCREEN_ORIENTATION_ANGLE m_screenOrientation; - uint32_t m_SDLflags; - uint16_t m_originalWidth; - uint16_t m_originalHeight; - uint16_t m_width; - uint16_t m_height; + uint m_SDLflags; + uint m_originalWidth; + uint m_originalHeight; + uint m_width; + uint m_height; Rect m_rect; - uint8_t m_bpp; + uint m_bpp; BOOL m_fullscreen; SDL_Surface *m_screen; }; diff --git a/src/framework/sdlsystem.h b/src/framework/sdlsystem.h index 6a4c85c..230c06b 100644 --- a/src/framework/sdlsystem.h +++ b/src/framework/sdlsystem.h @@ -43,8 +43,8 @@ public: Keyboard* GetKeyboard() const { return (Keyboard*)m_keyboard; } Touchscreen* GetTouchscreen() const { return NULL; } - uint32_t GetTicks() const { return SDL_GetTicks(); } - void Delay(uint32_t milliseconds) const { return SDL_Delay(milliseconds); } + uint GetTicks() const { return SDL_GetTicks(); } + void Delay(uint milliseconds) const { return SDL_Delay(milliseconds); } private: BOOL m_isQuitting; diff --git a/src/framework/support/animationsequence.h b/src/framework/support/animationsequence.h index 10f060b..2727847 100644 --- a/src/framework/support/animationsequence.h +++ b/src/framework/support/animationsequence.h @@ -7,14 +7,14 @@ struct AnimationSequence { - uint32_t start; - uint32_t stop; + uint start; + uint stop; float delay; BOOL tileIsMultiDirectional; - uint32_t tileDirectionFrameOffset; + uint tileDirectionFrameOffset; AnimationSequence(); - AnimationSequence(uint32_t start, uint32_t stop, float delay = 1.0f, BOOL tileIsMultiDirectional = FALSE, uint32_t tileDirectionFrameOffset = 0); + AnimationSequence(uint start, uint stop, float delay = 1.0f, BOOL tileIsMultiDirectional = FALSE, uint tileDirectionFrameOffset = 0); }; typedef stl::map AnimationList; @@ -29,7 +29,7 @@ inline AnimationSequence::AnimationSequence() this->tileDirectionFrameOffset = 0; } -inline AnimationSequence::AnimationSequence(uint32_t start, uint32_t stop, float delay, BOOL tileIsMultiDirectional, uint32_t 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/support/grid.cpp b/src/framework/support/grid.cpp index 86e259e..f8a3195 100644 --- a/src/framework/support/grid.cpp +++ b/src/framework/support/grid.cpp @@ -6,7 +6,7 @@ #include "../graphics/renderstate.h" #include "../graphics/vertexbuffer.h" -Grid::Grid(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height) +Grid::Grid(GraphicsDevice *graphicsDevice, uint width, uint height) { m_graphicsDevice = graphicsDevice; @@ -26,7 +26,7 @@ Grid::Grid(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height) ASSERT(m_verticalPoints != NULL); m_verticalPoints->Initialize(attribs, 2, height * 2 + 2, BUFFEROBJECT_USAGE_STATIC); - for (uint16_t i = 0; i < height + 1; ++i) + for (uint i = 0; i < height + 1; ++i) { m_horizontalPoints->SetPosition3((i * 2), -(width / 2.0f), 0.0f, i - (height / 2.0f)); m_horizontalPoints->SetColor((i * 2), 1.0f, 1.0f, 1.0f); @@ -34,7 +34,7 @@ Grid::Grid(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height) m_horizontalPoints->SetColor((i * 2) + 1, 1.0f, 1.0f, 1.0f); } - for (uint16_t i = 0; i < width + 1; ++i) + for (uint i = 0; i < width + 1; ++i) { m_verticalPoints->SetPosition3((i * 2), i - (width / 2.0f), 0.0f, -(height / 2.0f)); m_verticalPoints->SetColor((i * 2), 1.0f, 1.0f, 1.0f); diff --git a/src/framework/support/grid.h b/src/framework/support/grid.h index 319064e..1eb853e 100644 --- a/src/framework/support/grid.h +++ b/src/framework/support/grid.h @@ -10,7 +10,7 @@ class VertexBuffer; class Grid { public: - Grid(GraphicsDevice *graphicsDevice, uint16_t width, uint16_t height); + Grid(GraphicsDevice *graphicsDevice, uint width, uint height); virtual ~Grid(); void OnRender(); diff --git a/src/framework/support/text.cpp b/src/framework/support/text.cpp index 4960d72..3afaf42 100644 --- a/src/framework/support/text.cpp +++ b/src/framework/support/text.cpp @@ -64,10 +64,10 @@ Text::~Text() SAFE_DELETE(m_text); } -uint32_t Text::CountLines() +uint Text::CountLines() { - uint32_t numLines = 1; - for (uint32_t i = 0; i < m_length; ++i) + uint numLines = 1; + for (uint i = 0; i < m_length; ++i) { char c = m_text[i]; if (c == '\n') @@ -77,15 +77,15 @@ uint32_t Text::CountLines() return numLines; } -const char* Text::GetLine(uint32_t line, size_t &lineLength) const +const char* Text::GetLine(uint line, size_t &lineLength) const { ASSERT(line < m_numLines); // find the start of the requested line - uint32_t currentLine = 1; + uint currentLine = 1; const char* startOfLine = &m_text[0]; - uint32_t i = 0; + uint i = 0; while (line != currentLine && i < m_length) { char c = m_text[i]; diff --git a/src/framework/support/text.h b/src/framework/support/text.h index b867732..56a79bf 100644 --- a/src/framework/support/text.h +++ b/src/framework/support/text.h @@ -48,7 +48,7 @@ public: * retrieved line, not including new-line characters * @return pointer to the text starting at the specified line */ - const char* GetLine(uint32_t line, size_t &lineLength) const; + const char* GetLine(uint line, size_t &lineLength) const; /** * @return the total number of characters in this text object @@ -58,16 +58,16 @@ public: /** * @return the number of lines of text in this text object */ - uint32_t GetNumLines() const { return m_numLines; } + uint GetNumLines() const { return m_numLines; } private: Text(char *text, size_t length); - uint32_t CountLines(); + uint CountLines(); char *m_text; size_t m_length; - uint32_t m_numLines; + uint m_numLines; }; #endif diff --git a/src/framework/util/msgbox.cpp b/src/framework/util/msgbox.cpp index 6423ff8..1c9cd5c 100644 --- a/src/framework/util/msgbox.cpp +++ b/src/framework/util/msgbox.cpp @@ -24,7 +24,7 @@ enum MSGBOX_BUTTONS MSGBOX_BUTTON_IGNORE = 64 }; -uint32_t ConvertMsgBoxTypeToSysMsgBoxIcon(MSGBOX_TYPE type); +uint ConvertMsgBoxTypeToSysMsgBoxIcon(MSGBOX_TYPE type); #ifdef MSGBOX_WINDOWS @@ -47,7 +47,7 @@ uint32_t ConvertMsgBoxTypeToSysMsgBoxIcon(MSGBOX_TYPE type); MSGBOX_RESULT MsgBox_Ok(MSGBOX_TYPE type, const stl::string& message, const stl::string& caption) { MSGBOX_RESULT result = MSGBOX_RESULT_UNKNOWN; - uint32_t icon = ConvertMsgBoxTypeToSysMsgBoxIcon(type); + uint icon = ConvertMsgBoxTypeToSysMsgBoxIcon(type); #ifdef MSGBOX_WINDOWS result = SystemMessageBox(message, caption, MB_OK | icon); @@ -66,7 +66,7 @@ MSGBOX_RESULT MsgBox_Ok(MSGBOX_TYPE type, const stl::string& message, const stl: MSGBOX_RESULT MsgBox_OkCancel(MSGBOX_TYPE type, const stl::string& message, const stl::string& caption) { MSGBOX_RESULT result = MSGBOX_RESULT_UNKNOWN; - uint32_t icon = ConvertMsgBoxTypeToSysMsgBoxIcon(type); + uint icon = ConvertMsgBoxTypeToSysMsgBoxIcon(type); #ifdef MSGBOX_WINDOWS result = SystemMessageBox(message, caption, MB_OKCANCEL | icon); @@ -92,7 +92,7 @@ MSGBOX_RESULT MsgBox_OkCancel(MSGBOX_TYPE type, const stl::string& message, cons MSGBOX_RESULT MsgBox_YesNo(MSGBOX_TYPE type, const stl::string& message, const stl::string& caption) { MSGBOX_RESULT result = MSGBOX_RESULT_UNKNOWN; - uint32_t icon = ConvertMsgBoxTypeToSysMsgBoxIcon(type); + uint icon = ConvertMsgBoxTypeToSysMsgBoxIcon(type); #ifdef MSGBOX_WINDOWS result = SystemMessageBox(message, caption, MB_YESNO | icon); @@ -118,7 +118,7 @@ MSGBOX_RESULT MsgBox_YesNo(MSGBOX_TYPE type, const stl::string& message, const s MSGBOX_RESULT MsgBox_AbortRetryIgnore(MSGBOX_TYPE type, const stl::string& message, const stl::string& caption) { MSGBOX_RESULT result = MSGBOX_RESULT_UNKNOWN; - uint32_t icon = ConvertMsgBoxTypeToSysMsgBoxIcon(type); + uint icon = ConvertMsgBoxTypeToSysMsgBoxIcon(type); #ifdef MSGBOX_WINDOWS result = SystemMessageBox(message, caption, MB_ABORTRETRYIGNORE | icon); @@ -144,7 +144,7 @@ MSGBOX_RESULT MsgBox_AbortRetryIgnore(MSGBOX_TYPE type, const stl::string& messa return result; } -uint32_t ConvertMsgBoxTypeToSysMsgBoxIcon(MSGBOX_TYPE type) +uint ConvertMsgBoxTypeToSysMsgBoxIcon(MSGBOX_TYPE type) { switch (type) { @@ -198,7 +198,7 @@ uint32_t ConvertMsgBoxTypeToSysMsgBoxIcon(MSGBOX_TYPE type) } #ifdef MSGBOX_WINDOWS -MSGBOX_RESULT SystemMessageBox(const stl::string& message, const stl::string& caption, uint32_t flags) +MSGBOX_RESULT SystemMessageBox(const stl::string& message, const stl::string& caption, uint flags) { int result = MessageBoxA(NULL, message.c_str(), caption.c_str(), flags); diff --git a/src/game/debuginfoprocess.cpp b/src/game/debuginfoprocess.cpp index 3a3614d..8b23867 100644 --- a/src/game/debuginfoprocess.cpp +++ b/src/game/debuginfoprocess.cpp @@ -30,7 +30,7 @@ void DebugInfoProcess::OnRender(RenderContext *renderContext) { SpriteFont *font = GetGameApp()->GetContentCache()->GetUIFont(); - uint16_t y = 5; + int y = 5; renderContext->GetSpriteBatch()->Printf(font, 5, y, TEXT_COLOR, "Loops: %d\nFT: %.6fs\nRPS: %d (%d)\nUPS: %d (%d)", GetGameApp()->GetFPS(), GetGameApp()->GetFrameTime(), diff --git a/src/gameapp.cpp b/src/gameapp.cpp index 825601f..b979fea 100644 --- a/src/gameapp.cpp +++ b/src/gameapp.cpp @@ -151,7 +151,7 @@ void GameApp::OnUpdate(float delta) } } -uint32_t GameApp::GetScreenScale() const +uint GameApp::GetScreenScale() const { return m_renderContext->GetScreenScale(); } diff --git a/src/gameapp.h b/src/gameapp.h index 1780fdd..70bee8f 100644 --- a/src/gameapp.h +++ b/src/gameapp.h @@ -31,7 +31,7 @@ public: StateManager* GetStateManager() const { return m_stateManager; } EventManager* GetEventManager() const { return m_eventManager; } - uint32_t GetScreenScale() const; + uint GetScreenScale() const; private: ContentCache *m_contentCache; diff --git a/src/graphics/textureanimator.cpp b/src/graphics/textureanimator.cpp index 62b9405..428be12 100644 --- a/src/graphics/textureanimator.cpp +++ b/src/graphics/textureanimator.cpp @@ -32,7 +32,7 @@ void TextureAnimator::ResetAll() } if (sequence.frames != NULL) { - for (uint32_t i = 0; i < sequence.GetNumFrames(); ++i) + for (uint i = 0; i < sequence.GetNumFrames(); ++i) { Image *frame = sequence.frames[i]; SAFE_DELETE(frame); @@ -43,12 +43,12 @@ void TextureAnimator::ResetAll() m_textureAtlasAnimations.clear(); } -void TextureAnimator::AddTileSequence(TextureAtlas *atlas, uint32_t tileToBeAnimated, uint32_t start, uint32_t 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, uint32_t tileToBeAnimated, uint32_t start, uint32_t 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()); @@ -89,7 +89,7 @@ void TextureAnimator::AddTileSequence(const stl::string &name, TextureAtlas *atl sequence.originalAnimatingTile->Create(textureImage, originalTile.dimensions.left, originalTile.dimensions.top, originalTile.dimensions.GetWidth(), originalTile.dimensions.GetHeight()); // copy each frame ("start" to "stop") from the source texture image - for (uint32_t i = 0; i < sequence.GetNumFrames(); ++i) + for (uint i = 0; i < sequence.GetNumFrames(); ++i) { const TextureAtlasTile &tile = atlas->GetTile(i + sequence.start); sequence.frames[i] = new Image(); @@ -195,7 +195,7 @@ TextureAtlasAnimationSequence* TextureAnimator::FindTileSequenceByName(const stl void TextureAnimator::UpdateTextureWithCurrentTileFrame(TextureAtlasAnimationSequence &sequence) { - uint32_t frameIndex = sequence.current - sequence.start; + uint frameIndex = sequence.current - sequence.start; ASSERT(frameIndex < sequence.GetNumFrames()); Image *frameImage = sequence.frames[frameIndex]; const TextureAtlasTile &tile = sequence.atlas->GetTile(sequence.animatingIndex); diff --git a/src/graphics/textureanimator.h b/src/graphics/textureanimator.h index 0396cd2..ff4edbc 100644 --- a/src/graphics/textureanimator.h +++ b/src/graphics/textureanimator.h @@ -22,8 +22,8 @@ public: void ResetAll(); - void AddTileSequence(TextureAtlas *atlas, uint32_t tileToBeAnimated, uint32_t start, uint32_t stop, float delay, BOOL loop = TRUE); - void AddTileSequence(const stl::string &name, TextureAtlas *atlas, uint32_t tileToBeAnimated, uint32_t start, uint32_t 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); diff --git a/src/graphics/textureatlasanimationsequence.h b/src/graphics/textureatlasanimationsequence.h index 4d6e3dc..ed66feb 100644 --- a/src/graphics/textureatlasanimationsequence.h +++ b/src/graphics/textureatlasanimationsequence.h @@ -10,10 +10,10 @@ class TextureAtlas; struct TextureAtlasAnimationSequence { TextureAtlas *atlas; - uint32_t animatingIndex; - uint32_t start; - uint32_t stop; - uint32_t current; + uint animatingIndex; + uint start; + uint stop; + uint current; float delay; float currentFrameTime; BOOL isAnimating; @@ -24,7 +24,7 @@ struct TextureAtlasAnimationSequence TextureAtlasAnimationSequence(); - uint32_t GetNumFrames() const; + uint GetNumFrames() const; BOOL IsAnimationFinished() const; }; @@ -43,7 +43,7 @@ inline TextureAtlasAnimationSequence::TextureAtlasAnimationSequence() frames = NULL; } -inline uint32_t TextureAtlasAnimationSequence::GetNumFrames() const +inline uint TextureAtlasAnimationSequence::GetNumFrames() const { return stop - start + 1; } diff --git a/src/processes/gwengameprocessuicontroller.cpp b/src/processes/gwengameprocessuicontroller.cpp index 8215f09..f3dafaf 100644 --- a/src/processes/gwengameprocessuicontroller.cpp +++ b/src/processes/gwengameprocessuicontroller.cpp @@ -87,7 +87,7 @@ BOOL GwenGameProcessUIController::Handle(const Event *event) return FALSE; } -Gwen::Controls::Canvas* GwenGameProcessUIController::InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint8_t fontSize) +Gwen::Controls::Canvas* GwenGameProcessUIController::InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint fontSize) { ASSERT(m_renderer == NULL); ASSERT(m_skin == NULL); @@ -117,10 +117,10 @@ void GwenGameProcessUIController::ResizeAndScaleCanvas() // takes into account any recent viewport resizing, etc.) SetScale(m_scale); - uint16_t viewportWidth = GetGameProcess()->GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); - uint16_t viewportHeight = GetGameProcess()->GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); - uint16_t scaledViewportWidth = (float)viewportWidth / m_canvas->Scale(); - uint16_t scaledViewportHeight = (float)viewportHeight / m_canvas->Scale(); + uint viewportWidth = GetGameProcess()->GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); + uint viewportHeight = GetGameProcess()->GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); + uint scaledViewportWidth = (float)viewportWidth / m_canvas->Scale(); + uint scaledViewportHeight = (float)viewportHeight / m_canvas->Scale(); m_canvas->SetBounds(0, 0, scaledViewportWidth, scaledViewportHeight); } diff --git a/src/processes/gwengameprocessuicontroller.h b/src/processes/gwengameprocessuicontroller.h index 29df84a..e2a5b88 100644 --- a/src/processes/gwengameprocessuicontroller.h +++ b/src/processes/gwengameprocessuicontroller.h @@ -56,7 +56,7 @@ public: virtual BOOL Handle(const Event *event); protected: - Gwen::Controls::Canvas* InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint8_t fontSize); + Gwen::Controls::Canvas* InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint fontSize); void ResizeAndScaleCanvas(); GwenGameProcess* GetGameProcess() const { return m_gameProcess; } diff --git a/src/states/gamestate.cpp b/src/states/gamestate.cpp index 5990076..3a40845 100644 --- a/src/states/gamestate.cpp +++ b/src/states/gamestate.cpp @@ -132,7 +132,7 @@ void GameState::SetFinished() m_hasReturnValue = FALSE; } -void GameState::SetFinished(uint32_t returnValue) +void GameState::SetFinished(int returnValue) { m_isFinished = TRUE; m_returnValue = returnValue; diff --git a/src/states/gamestate.h b/src/states/gamestate.h index df696bc..a5c972a 100644 --- a/src/states/gamestate.h +++ b/src/states/gamestate.h @@ -47,13 +47,13 @@ public: BOOL IsTopState() const; BOOL IsFinished() const { return m_isFinished; } BOOL HasReturnValue() const { return m_hasReturnValue; } - uint32_t GetReturnValue() const { return m_returnValue; } + int GetReturnValue() const { return m_returnValue; } protected: StateManager* GetStateManager() const { return m_stateManager; } void SetFinished(); - void SetFinished(uint32_t returnValue); + void SetFinished(int returnValue); private: GameApp *m_gameApp; @@ -61,7 +61,7 @@ private: ProcessManager *m_processManager; EffectManager *m_effectManager; BOOL m_isFinished; - uint32_t m_returnValue; + int m_returnValue; BOOL m_hasReturnValue; }; diff --git a/src/states/gwengamestateuicontroller.cpp b/src/states/gwengamestateuicontroller.cpp index 6fe393b..5e70a62 100644 --- a/src/states/gwengamestateuicontroller.cpp +++ b/src/states/gwengamestateuicontroller.cpp @@ -88,7 +88,7 @@ BOOL GwenGameStateUIController::Handle(const Event *event) return FALSE; } -Gwen::Controls::Canvas* GwenGameStateUIController::InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint8_t fontSize) +Gwen::Controls::Canvas* GwenGameStateUIController::InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint fontSize) { ASSERT(m_renderer == NULL); ASSERT(m_skin == NULL); @@ -118,11 +118,11 @@ void GwenGameStateUIController::ResizeAndScaleCanvas() // takes into account any recent viewport resizing, etc.) SetScale(m_scale); - uint16_t viewportWidth = GetGameState()->GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); - uint16_t viewportHeight = GetGameState()->GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); + uint viewportWidth = GetGameState()->GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetViewportWidth(); + uint viewportHeight = GetGameState()->GetGameApp()->GetGraphicsDevice()->GetViewContext()->GetViewportHeight(); - uint16_t scaledViewportWidth = (float)viewportWidth / m_canvas->Scale(); - uint16_t scaledViewportHeight = (float)viewportHeight / m_canvas->Scale(); + uint scaledViewportWidth = (float)viewportWidth / m_canvas->Scale(); + uint scaledViewportHeight = (float)viewportHeight / m_canvas->Scale(); m_canvas->SetBounds(0, 0, scaledViewportWidth, scaledViewportHeight); } @@ -161,7 +161,7 @@ void GwenGameStateUIController::SetStateFinished() GetGameState()->SetFinished(); } -void GwenGameStateUIController::SetStateFinished(uint32_t returnValue) +void GwenGameStateUIController::SetStateFinished(int returnValue) { GetGameState()->SetFinished(returnValue); } diff --git a/src/states/gwengamestateuicontroller.h b/src/states/gwengamestateuicontroller.h index 15643ab..cccb7f0 100644 --- a/src/states/gwengamestateuicontroller.h +++ b/src/states/gwengamestateuicontroller.h @@ -55,7 +55,7 @@ public: virtual BOOL Handle(const Event *event); protected: - Gwen::Controls::Canvas* InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint8_t fontSize); + Gwen::Controls::Canvas* InitializeGwen(const stl::string &skinFilename, const stl::string &fontFilename, uint fontSize); void ResizeAndScaleCanvas(); GwenGameState* GetGameState() const { return m_gameState; } @@ -75,7 +75,7 @@ protected: StateManager* GetStateManager() const; void SetStateFinished(); - void SetStateFinished(uint32_t returnValue); + void SetStateFinished(int returnValue); private: GwenGameState *m_gameState; diff --git a/src/states/statemanager.h b/src/states/statemanager.h index 55f09dc..9183e55 100644 --- a/src/states/statemanager.h +++ b/src/states/statemanager.h @@ -50,7 +50,7 @@ public: GameState* GetTopState() const; GameState* GetTopNonOverlayState() const; - uint32_t GetLastReturnValue() const { return m_stateReturnValue; } + int GetLastReturnValue() const { return m_stateReturnValue; } BOOL HasLastReturnValue() const { return m_hasStateReturnValue; } private: @@ -77,7 +77,7 @@ private: StateInfoList m_states; StateInfoQueue m_pushQueue; StateInfoQueue m_swapQueue; - uint32_t m_stateReturnValue; + int m_stateReturnValue; BOOL m_hasStateReturnValue; BOOL m_pushQueueHasOverlay; BOOL m_swapQueueHasOverlay; diff --git a/src/tilemap/chunkrenderer.cpp b/src/tilemap/chunkrenderer.cpp index 2ef5437..100229d 100644 --- a/src/tilemap/chunkrenderer.cpp +++ b/src/tilemap/chunkrenderer.cpp @@ -27,11 +27,11 @@ ChunkRenderer::~ChunkRenderer() SAFE_DELETE(m_alphaBlendState); } -uint32_t ChunkRenderer::Render(const TileChunk *chunk) +uint ChunkRenderer::Render(const TileChunk *chunk) { const Texture *texture = chunk->GetTileMap()->GetMeshes()->GetTextureAtlas()->GetTexture(); - uint32_t numVertices = chunk->GetNumVertices(); + uint numVertices = chunk->GetNumVertices(); m_renderState->Apply(); m_defaultBlendState->Apply(); @@ -43,9 +43,9 @@ uint32_t ChunkRenderer::Render(const TileChunk *chunk) return numVertices; } -uint32_t ChunkRenderer::RenderAlpha(const TileChunk *chunk) +uint ChunkRenderer::RenderAlpha(const TileChunk *chunk) { - uint32_t numVertices = 0; + uint numVertices = 0; if (chunk->IsAlphaEnabled()) { diff --git a/src/tilemap/chunkrenderer.h b/src/tilemap/chunkrenderer.h index 342007d..593709c 100644 --- a/src/tilemap/chunkrenderer.h +++ b/src/tilemap/chunkrenderer.h @@ -14,8 +14,8 @@ public: ChunkRenderer(GraphicsDevice *graphicsDevice); virtual ~ChunkRenderer(); - uint32_t Render(const TileChunk *chunk); - uint32_t RenderAlpha(const TileChunk *chunk); + uint Render(const TileChunk *chunk); + uint RenderAlpha(const TileChunk *chunk); private: GraphicsDevice *m_graphicsDevice; diff --git a/src/tilemap/chunkvertexgenerator.cpp b/src/tilemap/chunkvertexgenerator.cpp index 4a8a0fc..c47e521 100644 --- a/src/tilemap/chunkvertexgenerator.cpp +++ b/src/tilemap/chunkvertexgenerator.cpp @@ -23,7 +23,7 @@ ChunkVertexGenerator::~ChunkVertexGenerator() { } -void ChunkVertexGenerator::Generate(TileChunk *chunk, uint32_t &numVertices, uint32_t &numAlphaVertices) +void ChunkVertexGenerator::Generate(TileChunk *chunk, uint &numVertices, uint &numAlphaVertices) { numVertices = 0; numAlphaVertices = 0; @@ -34,11 +34,11 @@ void ChunkVertexGenerator::Generate(TileChunk *chunk, uint32_t &numVertices, uin const TileMap *tileMap = chunk->GetTileMap(); - for (uint32_t y = 0; y < chunk->GetHeight(); ++y) + for (uint y = 0; y < chunk->GetHeight(); ++y) { - for (uint32_t z = 0; z < chunk->GetDepth(); ++z) + for (uint z = 0; z < chunk->GetDepth(); ++z) { - for (uint32_t x = 0; x < chunk->GetWidth(); ++x) + for (uint x = 0; x < chunk->GetWidth(); ++x) { Tile *tile = chunk->Get(x, y, z); if (tile->tile == NO_TILE) @@ -57,9 +57,9 @@ void ChunkVertexGenerator::Generate(TileChunk *chunk, uint32_t &numVertices, uin // "tilemap space" position that this tile is at Point3 position; - position.x = x + (int32_t)chunk->GetPosition().x; - position.y = y + (int32_t)chunk->GetPosition().y; - position.z = z + (int32_t)chunk->GetPosition().z; + position.x = x + (int)chunk->GetPosition().x; + position.y = y + (int)chunk->GetPosition().y; + position.z = z + (int)chunk->GetPosition().z; const Matrix4x4 *transform = tile->GetTransformationMatrix(); @@ -172,7 +172,7 @@ void ChunkVertexGenerator::Generate(TileChunk *chunk, uint32_t &numVertices, uin chunk->EnableAlphaVertices(FALSE); } -uint32_t ChunkVertexGenerator::AddMesh(const TileMesh *mesh, TileChunk *chunk, BOOL isAlpha, const Point3 &position, const Matrix4x4 *transform, const Color &color, uint32_t firstVertex, uint32_t 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(); @@ -187,7 +187,7 @@ uint32_t ChunkVertexGenerator::AddMesh(const TileMesh *mesh, TileChunk *chunk, B ASSERT((firstVertex + numVertices - 1) < sourceBuffer->GetNumElements()); // ensure there is enough space in the destination buffer - uint32_t verticesToAdd = numVertices; + uint verticesToAdd = numVertices; if (destBuffer->GetRemainingSpace() < verticesToAdd) { // not enough space, need to resize the destination buffer @@ -208,7 +208,7 @@ uint32_t ChunkVertexGenerator::AddMesh(const TileMesh *mesh, TileChunk *chunk, B // copy vertices sourceBuffer->MoveTo(firstVertex); - for (uint32_t i = 0; i < numVertices; ++i) + for (uint i = 0; i < numVertices; ++i) { CopyVertex(chunk, sourceBuffer, destBuffer, positionOffset, transform, color); diff --git a/src/tilemap/chunkvertexgenerator.h b/src/tilemap/chunkvertexgenerator.h index afcec42..311923f 100644 --- a/src/tilemap/chunkvertexgenerator.h +++ b/src/tilemap/chunkvertexgenerator.h @@ -20,10 +20,10 @@ public: ChunkVertexGenerator(); virtual ~ChunkVertexGenerator(); - void Generate(TileChunk *chunk, uint32_t &numVertices, uint32_t &numAlphaVertices); + void Generate(TileChunk *chunk, uint &numVertices, uint &numAlphaVertices); private: - uint32_t AddMesh(const TileMesh *mesh, TileChunk *chunk, BOOL isAlpha, const Point3 &position, const Matrix4x4 *transform, const Color &color, uint32_t firstVertex, uint32_t 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 b110ba2..9241d1a 100644 --- a/src/tilemap/cubetilemesh.cpp +++ b/src/tilemap/cubetilemesh.cpp @@ -26,7 +26,7 @@ CubeTileMesh::CubeTileMesh(CUBE_FACES faces, const RectF *textureAtlasTileBounda m_leftFaceVertexOffset = 0; m_rightFaceVertexOffset = 0; - uint32_t numVertices = 0; + uint numVertices = 0; if (HasFace(SIDE_TOP)) { @@ -81,7 +81,7 @@ CubeTileMesh::~CubeTileMesh() void CubeTileMesh::SetupFaceVertices(const RectF *textureAtlasTileBoundaries) { - uint32_t pos = 0; + uint pos = 0; Vector3 a(-0.5f, -0.5f, -0.5f); Vector3 b(0.5f, 0.5f, 0.5f); @@ -267,7 +267,7 @@ void CubeTileMesh::SetupCollisionVertices() m_collisionVertices = new Vector3[m_numCollisionVertices]; ASSERT(m_collisionVertices != NULL); - for (uint32_t i = 0; i < m_numCollisionVertices; ++i) + for (uint i = 0; i < m_numCollisionVertices; ++i) m_collisionVertices[i] = m_vertices->GetPosition3(i); } diff --git a/src/tilemap/cubetilemesh.h b/src/tilemap/cubetilemesh.h index b5f1457..de1159d 100644 --- a/src/tilemap/cubetilemesh.h +++ b/src/tilemap/cubetilemesh.h @@ -19,14 +19,14 @@ public: virtual ~CubeTileMesh(); VertexBuffer* GetBuffer() const { return m_vertices; } - uint32_t GetTopFaceVertexOffset() const { return m_topFaceVertexOffset; } - uint32_t GetBottomFaceVertexOffset() const { return m_bottomFaceVertexOffset; } - uint32_t GetFrontFaceVertexOffset() const { return m_frontFaceVertexOffset; } - uint32_t GetBackFaceVertexOffset() const { return m_backFaceVertexOffset; } - uint32_t GetLeftFaceVertexOffset() const { return m_leftFaceVertexOffset; } - uint32_t GetRightFaceVertexOffset() const { return m_rightFaceVertexOffset; } + uint GetTopFaceVertexOffset() const { return m_topFaceVertexOffset; } + uint GetBottomFaceVertexOffset() const { return m_bottomFaceVertexOffset; } + uint GetFrontFaceVertexOffset() const { return m_frontFaceVertexOffset; } + uint GetBackFaceVertexOffset() const { return m_backFaceVertexOffset; } + uint GetLeftFaceVertexOffset() const { return m_leftFaceVertexOffset; } + uint GetRightFaceVertexOffset() const { return m_rightFaceVertexOffset; } - uint32_t GetNumCollisionVertices() const { return m_numCollisionVertices; } + uint GetNumCollisionVertices() const { return m_numCollisionVertices; } const Vector3* GetCollisionVertices() const { return m_collisionVertices; } CUBE_FACES GetFaces() const { return m_faces; } @@ -41,13 +41,13 @@ private: Vector2 ScaleTexCoord(const Vector2 &texCoord, const RectF &tileBoundaries) const; VertexBuffer *m_vertices; - uint32_t m_topFaceVertexOffset; - uint32_t m_bottomFaceVertexOffset; - uint32_t m_frontFaceVertexOffset; - uint32_t m_backFaceVertexOffset; - uint32_t m_leftFaceVertexOffset; - uint32_t m_rightFaceVertexOffset; - uint32_t m_numCollisionVertices; + uint m_topFaceVertexOffset; + uint m_bottomFaceVertexOffset; + uint m_frontFaceVertexOffset; + uint m_backFaceVertexOffset; + uint m_leftFaceVertexOffset; + uint m_rightFaceVertexOffset; + uint m_numCollisionVertices; Vector3 *m_collisionVertices; CUBE_FACES m_faces; }; diff --git a/src/tilemap/litchunkvertexgenerator.cpp b/src/tilemap/litchunkvertexgenerator.cpp index 0e98951..fe2db42 100644 --- a/src/tilemap/litchunkvertexgenerator.cpp +++ b/src/tilemap/litchunkvertexgenerator.cpp @@ -65,9 +65,9 @@ void LitChunkVertexGenerator::CopyVertex(const TileChunk *chunk, VertexBuffer *s { // light source is within the boundaries of the world, get the // actual tile (may or may not be in a neighbouring chunk) - int32_t lightX = (int32_t)lightSource.x - chunk->GetX(); - int32_t lightY = (int32_t)lightSource.y - chunk->GetY(); - int32_t lightZ = (int32_t)lightSource.z - chunk->GetZ(); + int lightX = (int)lightSource.x - chunk->GetX(); + int lightY = (int)lightSource.y - chunk->GetY(); + int lightZ = (int)lightSource.z - chunk->GetZ(); const Tile *lightTile = chunk->GetWithinSelfOrNeighbourSafe(lightX, lightY, lightZ); if (lightTile == NULL) diff --git a/src/tilemap/positionandskytilemaplighter.cpp b/src/tilemap/positionandskytilemaplighter.cpp index b6e8888..c427b7e 100644 --- a/src/tilemap/positionandskytilemaplighter.cpp +++ b/src/tilemap/positionandskytilemaplighter.cpp @@ -24,11 +24,11 @@ void PositionAndSkyTileMapLighter::Light(TileMap *tileMap) void PositionAndSkyTileMapLighter::ResetLightValues(TileMap *tileMap) { - for (uint32_t y = 0; y < tileMap->GetHeight(); ++y) + for (uint y = 0; y < tileMap->GetHeight(); ++y) { - for (uint32_t z = 0; z < tileMap->GetDepth(); ++z) + for (uint z = 0; z < tileMap->GetDepth(); ++z) { - for (uint32_t x = 0; x < tileMap->GetWidth(); ++x) + for (uint x = 0; x < tileMap->GetWidth(); ++x) { Tile *tile = tileMap->Get(x, y, z); @@ -48,14 +48,14 @@ void PositionAndSkyTileMapLighter::SetupSkyLight(TileMap *tileMap) // doesn't require us to flood-fill 0 light values here for everything // that isn't sky-lit // go through each vertical column one at a time from top to bottom - for (uint32_t x = 0; x < tileMap->GetWidth(); ++x) + for (uint x = 0; x < tileMap->GetWidth(); ++x) { - for (uint32_t z = 0; z < tileMap->GetDepth(); ++z) + for (uint z = 0; z < tileMap->GetDepth(); ++z) { BOOL stillSkyLit = TRUE; TILE_LIGHT_VALUE currentSkyLightValue = tileMap->GetSkyLightValue(); - for (int32_t y = tileMap->GetHeight() - 1; y >= 0 && stillSkyLit; --y) + for (int y = tileMap->GetHeight() - 1; y >= 0 && stillSkyLit; --y) { Tile *tile = tileMap->Get(x, y, z); const TileMesh *mesh = tileMap->GetMeshes()->Get(tile); @@ -84,11 +84,11 @@ void PositionAndSkyTileMapLighter::ApplyLighting(TileMap *tileMap) { // for each light source (sky or not), recursively go through and set // appropriate lighting for each adjacent tile - for (uint32_t y = 0; y < tileMap->GetHeight(); ++y) + for (uint y = 0; y < tileMap->GetHeight(); ++y) { - for (uint32_t z = 0; z < tileMap->GetDepth(); ++z) + for (uint z = 0; z < tileMap->GetDepth(); ++z) { - for (uint32_t x = 0; x < tileMap->GetWidth(); ++x) + for (uint x = 0; x < tileMap->GetWidth(); ++x) { Tile *tile = tileMap->Get(x, y, z); if (tile->IsEmptySpace()) @@ -107,7 +107,7 @@ void PositionAndSkyTileMapLighter::ApplyLighting(TileMap *tileMap) } } -void PositionAndSkyTileMapLighter::SpreadSkyLight(int32_t x, int32_t y, int32_t z, Tile *tile, TILE_LIGHT_VALUE light, TileMap *tileMap) +void PositionAndSkyTileMapLighter::SpreadSkyLight(int x, int y, int z, Tile *tile, TILE_LIGHT_VALUE light, TileMap *tileMap) { if (light > 0) { @@ -166,7 +166,7 @@ void PositionAndSkyTileMapLighter::SpreadSkyLight(int32_t x, int32_t y, int32_t } } -void PositionAndSkyTileMapLighter::SpreadTileLight(int32_t x, int32_t y, int32_t z, Tile *tile, TILE_LIGHT_VALUE light, TileMap *tileMap) +void PositionAndSkyTileMapLighter::SpreadTileLight(int x, int y, int z, Tile *tile, TILE_LIGHT_VALUE light, TileMap *tileMap) { if (light > 0) { diff --git a/src/tilemap/positionandskytilemaplighter.h b/src/tilemap/positionandskytilemaplighter.h index 54b1f67..4ee55b5 100644 --- a/src/tilemap/positionandskytilemaplighter.h +++ b/src/tilemap/positionandskytilemaplighter.h @@ -21,8 +21,8 @@ private: void ResetLightValues(TileMap *tileMap); void SetupSkyLight(TileMap *tileMap); void ApplyLighting(TileMap *tileMap); - void SpreadSkyLight(int32_t x, int32_t y, int32_t z, Tile *tile, TILE_LIGHT_VALUE light, TileMap *tileMap); - void SpreadTileLight(int32_t x, int32_t y, int32_t z, Tile *tile, TILE_LIGHT_VALUE light, TileMap *tileMap); + void SpreadSkyLight(int x, int y, int z, Tile *tile, TILE_LIGHT_VALUE light, TileMap *tileMap); + void SpreadTileLight(int x, int y, int z, Tile *tile, TILE_LIGHT_VALUE light, TileMap *tileMap); }; #endif diff --git a/src/tilemap/simpletilemaplighter.cpp b/src/tilemap/simpletilemaplighter.cpp index f4f9180..38c4256 100644 --- a/src/tilemap/simpletilemaplighter.cpp +++ b/src/tilemap/simpletilemaplighter.cpp @@ -23,11 +23,11 @@ void SimpleTileMapLighter::Light(TileMap *tileMap) void SimpleTileMapLighter::ResetLightValues(TileMap *tileMap) { - for (uint32_t y = 0; y < tileMap->GetHeight(); ++y) + for (uint y = 0; y < tileMap->GetHeight(); ++y) { - for (uint32_t z = 0; z < tileMap->GetDepth(); ++z) + for (uint z = 0; z < tileMap->GetDepth(); ++z) { - for (uint32_t x = 0; x < tileMap->GetWidth(); ++x) + for (uint x = 0; x < tileMap->GetWidth(); ++x) { Tile *tile = tileMap->Get(x, y, z); @@ -47,14 +47,14 @@ void SimpleTileMapLighter::ApplySkyLight(TileMap *tileMap) // doesn't require us to flood-fill 0 light values here for everything // that isn't sky-lit // go through each vertical column one at a time from top to bottom - for (uint32_t x = 0; x < tileMap->GetWidth(); ++x) + for (uint x = 0; x < tileMap->GetWidth(); ++x) { - for (uint32_t z = 0; z < tileMap->GetDepth(); ++z) + for (uint z = 0; z < tileMap->GetDepth(); ++z) { BOOL stillSkyLit = TRUE; TILE_LIGHT_VALUE currentSkyLightValue = tileMap->GetSkyLightValue(); - for (int32_t y = tileMap->GetHeight() - 1; y >= 0 && stillSkyLit; --y) + for (int y = tileMap->GetHeight() - 1; y >= 0 && stillSkyLit; --y) { Tile *tile = tileMap->Get(x, y, z); const TileMesh *mesh = tileMap->GetMeshes()->Get(tile); diff --git a/src/tilemap/statictilemesh.cpp b/src/tilemap/statictilemesh.cpp index f69c79c..22edb55 100644 --- a/src/tilemap/statictilemesh.cpp +++ b/src/tilemap/statictilemesh.cpp @@ -25,7 +25,7 @@ StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlas // adjust texture coordinates, which are likely all within the full range 0.0f to 1.0f // to fit into the texture atlas tile's texture coordinate boundaries - for (uint32_t i = 0; i < m_vertices->GetNumElements(); ++i) + for (uint i = 0; i < m_vertices->GetNumElements(); ++i) { Vector2 texCoord = m_vertices->GetTexCoord(i); texCoord.x = ScaleRange(texCoord.x, 0.0f, 1.0f, textureAtlasTileBoundaries->left, textureAtlasTileBoundaries->right); @@ -36,20 +36,20 @@ StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlas SetupCollisionVertices(collisionMesh); } -StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlasTileBoundaries, uint32_t 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); // count up all the vertices needed for the number of subsets we're going to use - uint32_t numVertices = 0; - for (uint32_t i = 0; i < numTiles; ++i) + uint numVertices = 0; + for (uint i = 0; i < numTiles; ++i) numVertices += mesh->GetSubset(i)->GetVertices()->GetNumElements(); // create a copy of the mesh's vertex attributes as an array const VertexBuffer *meshVertices = mesh->GetSubset(0)->GetVertices(); VERTEX_ATTRIBS *attribs = new VERTEX_ATTRIBS[meshVertices->GetNumAttributes()]; - for (uint32_t i = 0; i < meshVertices->GetNumAttributes(); ++i) + for (uint i = 0; i < meshVertices->GetNumAttributes(); ++i) attribs[i] = meshVertices->GetAttributeInfo(i)->standardType; // create the vertex buffer using the same attribs as the source mesh @@ -64,8 +64,8 @@ StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlas SetTranslucency(translucency); SetLight(lightValue); - uint32_t currentVertex = 0; - for (uint32_t i = 0; i < numTiles; ++i) + uint currentVertex = 0; + for (uint i = 0; i < numTiles; ++i) { StaticMeshSubset *subset = mesh->GetSubset(i); const RectF *tileBoundaries = &textureAtlasTileBoundaries[i]; @@ -74,9 +74,9 @@ StaticTileMesh::StaticTileMesh(const StaticMesh *mesh, const RectF *textureAtlas m_vertices->Copy(subset->GetVertices(), currentVertex); // now we need to adjust the copied texture coordinates to match the tile boundaries - for (uint32_t t = 0; t < subset->GetVertices()->GetNumElements(); ++t) + for (uint t = 0; t < subset->GetVertices()->GetNumElements(); ++t) { - uint32_t position = t + currentVertex; + uint position = t + currentVertex; Vector2 texCoord = m_vertices->GetTexCoord(position); texCoord.x = ScaleRange(texCoord.x, 0.0f, 1.0f, tileBoundaries->left, tileBoundaries->right); @@ -103,7 +103,7 @@ void StaticTileMesh::SetupCollisionVertices(const StaticMesh *collisionMesh) m_collisionVertices = new Vector3[m_numCollisionVertices]; ASSERT(m_collisionVertices != NULL); - for (uint32_t i = 0; i < m_numCollisionVertices; ++i) + for (uint i = 0; i < m_numCollisionVertices; ++i) m_collisionVertices[i] = srcCollisionVertices->GetPosition3(i); } diff --git a/src/tilemap/statictilemesh.h b/src/tilemap/statictilemesh.h index 2aa5b92..9fd2726 100644 --- a/src/tilemap/statictilemesh.h +++ b/src/tilemap/statictilemesh.h @@ -16,11 +16,11 @@ 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, uint32_t 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, 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; } - uint32_t GetNumCollisionVertices() const { return m_numCollisionVertices; } + uint GetNumCollisionVertices() const { return m_numCollisionVertices; } const Vector3* GetCollisionVertices() const { return m_collisionVertices; } TILEMESH_TYPE GetType() const { return TILEMESH_STATIC; } @@ -29,7 +29,7 @@ private: void SetupCollisionVertices(const StaticMesh *collisionMesh); VertexBuffer *m_vertices; - uint32_t m_numCollisionVertices; + uint m_numCollisionVertices; Vector3 *m_collisionVertices; }; diff --git a/src/tilemap/tilechunk.cpp b/src/tilemap/tilechunk.cpp index eff52d3..f7629ba 100644 --- a/src/tilemap/tilechunk.cpp +++ b/src/tilemap/tilechunk.cpp @@ -16,7 +16,7 @@ #include -TileChunk::TileChunk(uint32_t x, uint32_t y, uint32_t z, uint32_t width, uint32_t height, uint32_t depth, const TileMap *tileMap, GraphicsDevice *graphicsDevice) +TileChunk::TileChunk(uint x, uint y, uint z, uint width, uint height, uint depth, const TileMap *tileMap, GraphicsDevice *graphicsDevice) { ASSERT(tileMap != NULL); ASSERT(graphicsDevice != NULL); @@ -67,7 +67,7 @@ TileChunk::~TileChunk() SAFE_DELETE(m_alphaVertices); } -void TileChunk::GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z, BoundingBox *box) const +void TileChunk::GetBoundingBoxFor(uint x, uint y, uint z, BoundingBox *box) const { ASSERT(box != NULL); @@ -80,7 +80,7 @@ void TileChunk::GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z, BoundingBo box->max += m_bounds.min; } -BoundingBox TileChunk::GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z) const +BoundingBox TileChunk::GetBoundingBoxFor(uint x, uint y, uint z) const { BoundingBox box; @@ -95,7 +95,7 @@ BoundingBox TileChunk::GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z) con return box; } -BOOL TileChunk::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint32_t &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; @@ -103,22 +103,22 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint return FALSE; // convert initial chunk collision point to tile coords (this is in "tilemap space") - int32_t currentX = (int32_t)position.x; - int32_t currentY = (int32_t)position.y; - int32_t currentZ = (int32_t)position.z; + int currentX = (int)position.x; + int currentY = (int)position.y; + int currentZ = (int)position.z; // make sure the coords are inrange of this chunk. due to some floating // point errors / decimal truncating from the above conversion we could // end up with one or more that are very slightly out of bounds. // this is still in "tilemap space" - currentX = Clamp(currentX, (int32_t)GetX(), (int32_t)(GetX() + GetWidth() - 1)); - currentY = Clamp(currentY, (int32_t)GetY(), (int32_t)(GetY() + GetHeight() - 1)); - currentZ = Clamp(currentZ, (int32_t)GetZ(), (int32_t)(GetZ() + GetDepth() - 1)); + currentX = Clamp(currentX, (int)GetX(), (int)(GetX() + GetWidth() - 1)); + currentY = Clamp(currentY, (int)GetY(), (int)(GetY() + GetHeight() - 1)); + currentZ = Clamp(currentZ, (int)GetZ(), (int)(GetZ() + GetDepth() - 1)); // convert to "chunk space" - currentX -= (int32_t)GetX(); - currentY -= (int32_t)GetY(); - currentZ -= (int32_t)GetZ(); + currentX -= (int)GetX(); + currentY -= (int)GetY(); + currentZ -= (int)GetZ(); // is the start position colliding with a solid tile? Tile *startTile = Get(currentX, currentY, currentZ); @@ -136,14 +136,14 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint // no collision initially, continue on with the rest ... // step increments in "chunk tile" units - int32_t stepX = (int32_t)Sign(ray.direction.x); - int32_t stepY = (int32_t)Sign(ray.direction.y); - int32_t stepZ = (int32_t)Sign(ray.direction.z); + int stepX = (int)Sign(ray.direction.x); + int stepY = (int)Sign(ray.direction.y); + int stepZ = (int)Sign(ray.direction.z); // tile boundary (needs to be in "tilemap space") - int32_t tileBoundaryX = (int32_t)GetX() + currentX + (stepX > 0 ? 1 : 0); - int32_t tileBoundaryY = (int32_t)GetY() + currentY + (stepY > 0 ? 1 : 0); - int32_t tileBoundaryZ = (int32_t)GetZ() + currentZ + (stepZ > 0 ? 1 : 0); + int tileBoundaryX = (int)GetX() + currentX + (stepX > 0 ? 1 : 0); + int tileBoundaryY = (int)GetY() + currentY + (stepY > 0 ? 1 : 0); + int tileBoundaryZ = (int)GetZ() + currentZ + (stepZ > 0 ? 1 : 0); // HACK: for the tMax and tDelta initial calculations below, if any of the // components of ray.direction are zero, it will result in "inf" @@ -224,9 +224,9 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint // the chunk before we can attempt to determine if the current tile is // solid if ( - currentX < 0 || currentX >= (int32_t)GetWidth() || - currentY < 0 || currentY >= (int32_t)GetHeight() || - currentZ < 0 || currentZ >= (int32_t)GetDepth() + currentX < 0 || currentX >= (int)GetWidth() || + currentY < 0 || currentY >= (int)GetHeight() || + currentZ < 0 || currentZ >= (int)GetDepth() ) outOfChunk = TRUE; else @@ -250,7 +250,7 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint return collided; } -BOOL TileChunk::CheckForCollision(const Ray &ray, Vector3 &point, uint32_t &x, uint32_t &y, uint32_t &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... @@ -262,12 +262,12 @@ BOOL TileChunk::CheckForCollision(const Ray &ray, Vector3 &point, uint32_t &x, u return CheckForCollisionWithTile(ray, point, x, y, z); } -BOOL TileChunk::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint32_t x, uint32_t y, uint32_t 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); - uint32_t numVertices = mesh->GetNumCollisionVertices(); + uint numVertices = mesh->GetNumCollisionVertices(); const Vector3 *vertices = mesh->GetCollisionVertices(); // world position of this tile, will be used to move each @@ -278,7 +278,7 @@ BOOL TileChunk::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint32 BOOL collided = FALSE; Vector3 collisionPoint = ZERO_VECTOR; - for (uint32_t i = 0; i < numVertices; i += 3) + for (uint i = 0; i < numVertices; i += 3) { // get the vertices making up this triangle Vector3 a = vertices[i]; @@ -308,7 +308,7 @@ BOOL TileChunk::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint32 return collided; } -BOOL TileChunk::GetOverlappedTiles(const BoundingBox &box, uint32_t &x1, uint32_t &y1, uint32_t &z1, uint32_t &x2, uint32_t &y2, uint32_t &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)) @@ -317,48 +317,48 @@ BOOL TileChunk::GetOverlappedTiles(const BoundingBox &box, uint32_t &x1, uint32_ // 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 // blocks. these were arrived at through observation - int32_t minX = (int32_t)box.min.x; - int32_t minY = (int32_t)box.min.y; - int32_t minZ = (int32_t)box.min.z; - int32_t maxX = (int32_t)ceil(box.max.x); - int32_t maxY = (int32_t)ceil(box.max.y - 1.0f); - int32_t maxZ = (int32_t)ceil(box.max.z); + int minX = (int)box.min.x; + int minY = (int)box.min.y; + int minZ = (int)box.min.z; + int maxX = (int)ceil(box.max.x); + int maxY = (int)ceil(box.max.y - 1.0f); + int maxZ = (int)ceil(box.max.z); // trim off the excess bounds so that we end up with a min-to-max area // that is completely within the bounds of this chunk // HACK: "-1"'s keep us from picking up too many blocks. these were arrived // at through observation - minX = Clamp(minX, (int32_t)GetX(), (int32_t)(GetX() + GetWidth())); - minY = Clamp(minY, (int32_t)GetY(), (int32_t)(GetY() + GetHeight() - 1)); - minZ = Clamp(minZ, (int32_t)GetZ(), (int32_t)(GetZ() + GetDepth())); - maxX = Clamp(maxX, (int32_t)GetX(), (int32_t)(GetX() + GetWidth())); - maxY = Clamp(maxY, (int32_t)GetY(), (int32_t)(GetY() + GetHeight() - 1)); - maxZ = Clamp(maxZ, (int32_t)GetZ(), (int32_t)(GetZ() + GetDepth())); + minX = Clamp(minX, (int)GetX(), (int)(GetX() + GetWidth())); + minY = Clamp(minY, (int)GetY(), (int)(GetY() + GetHeight() - 1)); + minZ = Clamp(minZ, (int)GetZ(), (int)(GetZ() + GetDepth())); + maxX = Clamp(maxX, (int)GetX(), (int)(GetX() + GetWidth())); + maxY = Clamp(maxY, (int)GetY(), (int)(GetY() + GetHeight() - 1)); + maxZ = Clamp(maxZ, (int)GetZ(), (int)(GetZ() + GetDepth())); // return the leftover area, converted to "chunk space" - x1 = minX - (int32_t)GetX(); - y1 = minY - (int32_t)GetY(); - z1 = minZ - (int32_t)GetZ(); - x2 = maxX - (int32_t)GetX(); - y2 = maxY - (int32_t)GetY(); - z2 = maxZ - (int32_t)GetZ(); + x1 = minX - (int)GetX(); + y1 = minY - (int)GetY(); + z1 = minZ - (int)GetZ(); + x2 = maxX - (int)GetX(); + y2 = maxY - (int)GetY(); + z2 = maxZ - (int)GetZ(); return TRUE; } -Tile* TileChunk::GetWithinSelfOrNeighbour(int32_t x, int32_t y, int32_t z) const +Tile* TileChunk::GetWithinSelfOrNeighbour(int x, int y, int z) const { - int32_t checkX = (int32_t)GetX() + x; - int32_t checkY = (int32_t)GetY() + y; - int32_t checkZ = (int32_t)GetZ() + z; + int checkX = (int)GetX() + x; + int checkY = (int)GetY() + y; + int checkZ = (int)GetZ() + z; return m_tileMap->Get(checkX, checkY, checkZ); } -Tile* TileChunk::GetWithinSelfOrNeighbourSafe(int32_t x, int32_t y, int32_t z) const +Tile* TileChunk::GetWithinSelfOrNeighbourSafe(int x, int y, int z) const { - int32_t checkX = (int32_t)GetX() + x; - int32_t checkY = (int32_t)GetY() + y; - int32_t checkZ = (int32_t)GetZ() + z; + int checkX = (int)GetX() + x; + int checkY = (int)GetY() + y; + int checkZ = (int)GetZ() + z; if (!m_tileMap->IsWithinBounds(checkX, checkY, checkZ)) return NULL; else diff --git a/src/tilemap/tilechunk.h b/src/tilemap/tilechunk.h index ae5966a..414d8fb 100644 --- a/src/tilemap/tilechunk.h +++ b/src/tilemap/tilechunk.h @@ -16,102 +16,102 @@ struct Vector3; class TileChunk { public: - TileChunk(uint32_t x, uint32_t y, uint32_t z, uint32_t width, uint32_t height, uint32_t depth, const TileMap *tileMap, GraphicsDevice *graphicsDevice); + 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 UpdateVertices(ChunkVertexGenerator *vertexGenerator); - Tile* Get(uint32_t x, uint32_t y, uint32_t z) const; - Tile* GetSafe(uint32_t x, uint32_t y, uint32_t z) const; - Tile* GetWithinSelfOrNeighbour(int32_t x, int32_t y, int32_t z) const; - Tile* GetWithinSelfOrNeighbourSafe(int32_t x, int32_t y, int32_t z) const; - void GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z, BoundingBox *box) const; - BoundingBox GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z) const; + Tile* Get(uint x, uint y, uint z) const; + Tile* GetSafe(uint x, uint y, uint z) const; + Tile* GetWithinSelfOrNeighbour(int x, int y, int z) const; + Tile* GetWithinSelfOrNeighbourSafe(int x, int y, int z) const; + 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, uint32_t &x, uint32_t &y, uint32_t &z) const; - BOOL CheckForCollision(const Ray &ray, Vector3 &point, uint32_t &x, uint32_t &y, uint32_t &z) const; - BOOL CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint32_t x, uint32_t y, uint32_t z) const; - BOOL GetOverlappedTiles(const BoundingBox &box, uint32_t &x1, uint32_t &y1, uint32_t &z1, uint32_t &x2, uint32_t &y2, uint32_t &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(int32_t x, int32_t y, int32_t z) const; - BOOL IsWithinLocalBounds(int32_t x, int32_t y, int32_t z) const; + BOOL IsWithinBounds(int x, int y, int z) const; + BOOL IsWithinLocalBounds(int x, int y, int z) const; - uint32_t GetX() const { return m_x; } - uint32_t GetY() const { return m_y; } - uint32_t GetZ() const { return m_z; } + uint GetX() const { return m_x; } + uint GetY() const { return m_y; } + uint GetZ() const { return m_z; } const Vector3& GetPosition() const { return m_position; } - uint32_t GetWidth() const { return m_width; } - uint32_t GetHeight() const { return m_height; } - uint32_t GetDepth() const { return m_depth; } + uint GetWidth() const { return m_width; } + uint GetHeight() const { return m_height; } + uint GetDepth() const { return m_depth; } const BoundingBox& GetBounds() const { return m_bounds; } const TileMap* GetTileMap() const { return m_tileMap; } VertexBuffer* GetVertices() const { return m_vertices; } VertexBuffer* GetAlphaVertices() const { return m_alphaVertices; } - uint32_t GetNumVertices() const { return m_numVertices; } - uint32_t GetNumAlphaVertices() const { return m_numAlphaVertices; } + uint GetNumVertices() const { return m_numVertices; } + uint GetNumAlphaVertices() const { return m_numAlphaVertices; } private: - uint32_t GetIndexOf(uint32_t x, uint32_t y, uint32_t z) const; + uint GetIndexOf(uint x, uint y, uint z) const; Tile *m_data; const TileMap *m_tileMap; GraphicsDevice *m_graphicsDevice; VertexBuffer *m_vertices; VertexBuffer *m_alphaVertices; - uint32_t m_numVertices; - uint32_t m_numAlphaVertices; + uint m_numVertices; + uint m_numAlphaVertices; - uint32_t m_x; - uint32_t m_y; - uint32_t m_z; - uint32_t m_width; - uint32_t m_height; - uint32_t m_depth; + uint m_x; + uint m_y; + uint m_z; + uint m_width; + uint m_height; + uint m_depth; BoundingBox m_bounds; Vector3 m_position; }; -inline Tile* TileChunk::Get(uint32_t x, uint32_t y, uint32_t z) const +inline Tile* TileChunk::Get(uint x, uint y, uint z) const { - uint32_t index = GetIndexOf(x, y, z); + uint index = GetIndexOf(x, y, z); return &m_data[index]; } -inline Tile* TileChunk::GetSafe(uint32_t x, uint32_t y, uint32_t z) const +inline Tile* TileChunk::GetSafe(uint x, uint y, uint z) const { - if (!IsWithinLocalBounds((int32_t)x, (int32_t)y, (int32_t)z)) + if (!IsWithinLocalBounds((int)x, (int)y, (int)z)) return NULL; else return Get(x, y, z); } -inline uint32_t TileChunk::GetIndexOf(uint32_t x, uint32_t y, uint32_t z) const +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(int32_t x, int32_t y, int32_t z) const +inline BOOL TileChunk::IsWithinBounds(int x, int y, int z) const { - if (x < (int32_t)GetX() || x >= (int32_t)(GetX() + m_width)) + if (x < (int)GetX() || x >= (int)(GetX() + m_width)) return FALSE; - if (y < (int32_t)GetY() || y >= (int32_t)(GetY() + m_height)) + if (y < (int)GetY() || y >= (int)(GetY() + m_height)) return FALSE; - if (z < (int32_t)GetZ() || z >= (int32_t)(GetZ() + m_depth)) + if (z < (int)GetZ() || z >= (int)(GetZ() + m_depth)) return FALSE; return TRUE; } -inline BOOL TileChunk::IsWithinLocalBounds(int32_t x, int32_t y, int32_t z) const +inline BOOL TileChunk::IsWithinLocalBounds(int x, int y, int z) const { - if (x < 0 || x >= (int32_t)m_width) + if (x < 0 || x >= (int)m_width) return FALSE; - if (y < 0 || y >= (int32_t)m_height) + if (y < 0 || y >= (int)m_height) return FALSE; - if (z < 0 || z >= (int32_t)m_depth) + if (z < 0 || z >= (int)m_depth) return FALSE; return TRUE; diff --git a/src/tilemap/tilemap.cpp b/src/tilemap/tilemap.cpp index 7a571a0..5b3acea 100644 --- a/src/tilemap/tilemap.cpp +++ b/src/tilemap/tilemap.cpp @@ -46,7 +46,7 @@ TileMap::~TileMap() Clear(); } -void TileMap::SetSize(uint32_t numChunksX, uint32_t numChunksY, uint32_t numChunksZ, uint32_t chunkSizeX, uint32_t chunkSizeY, uint32_t chunkSizeZ) +void TileMap::SetSize(uint numChunksX, uint numChunksY, uint numChunksZ, uint chunkSizeX, uint chunkSizeY, uint chunkSizeZ) { ASSERT(numChunksX > 0); ASSERT(numChunksY > 0); @@ -70,16 +70,16 @@ void TileMap::SetSize(uint32_t numChunksX, uint32_t numChunksY, uint32_t numChun ASSERT(m_chunks != NULL); // set each one up - for (uint32_t y = 0; y < numChunksY; ++y) + for (uint y = 0; y < numChunksY; ++y) { - for (uint32_t z = 0; z < numChunksZ; ++z) + for (uint z = 0; z < numChunksZ; ++z) { - for (uint32_t x = 0; x < numChunksX; ++x) + for (uint x = 0; x < numChunksX; ++x) { TileChunk *chunk = new TileChunk(x * m_chunkWidth, y * m_chunkHeight, z * m_chunkDepth, m_chunkWidth, m_chunkHeight, m_chunkDepth, this, m_graphicsDevice); ASSERT(chunk != NULL); - uint32_t index = GetChunkIndex(x, y, z); + uint index = GetChunkIndex(x, y, z); m_chunks[index] = chunk; } } @@ -91,7 +91,7 @@ void TileMap::SetSize(uint32_t numChunksX, uint32_t numChunksY, uint32_t numChun void TileMap::Clear() { - for (uint32_t i = 0; i < m_numChunks; ++i) + for (uint i = 0; i < m_numChunks; ++i) { TileChunk *chunk = m_chunks[i]; SAFE_DELETE(chunk); @@ -107,7 +107,7 @@ void TileMap::Clear() m_chunkDepth = 0; } -BOOL TileMap::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint32_t &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; @@ -116,16 +116,16 @@ BOOL TileMap::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint32 // 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 - int32_t currentX = (int32_t)position.x; - int32_t currentY = (int32_t)position.y; - int32_t currentZ = (int32_t)position.z; + int currentX = (int)position.x; + int currentY = (int)position.y; + int currentZ = (int)position.z; // make sure the coords are inrange of the map bounds. due to some floating // point errors / decimal truncating from the above conversion we could // end up with one or more that are very slightly out of bounds. - currentX = Clamp(currentX, 0, (int32_t)(GetWidth() - 1)); - currentY = Clamp(currentY, 0, (int32_t)(GetHeight() - 1)); - currentZ = Clamp(currentZ, 0, (int32_t)(GetDepth() - 1)); + currentX = Clamp(currentX, 0, (int)(GetWidth() - 1)); + currentY = Clamp(currentY, 0, (int)(GetHeight() - 1)); + currentZ = Clamp(currentZ, 0, (int)(GetDepth() - 1)); // is the start position colliding with a solid tile? Tile *startTile = Get(currentX, currentY, currentZ); @@ -143,14 +143,14 @@ BOOL TileMap::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint32 // no collision initially, continue on with the rest ... // step increments in whole tile units - int32_t stepX = (int32_t)Sign(ray.direction.x); - int32_t stepY = (int32_t)Sign(ray.direction.y); - int32_t stepZ = (int32_t)Sign(ray.direction.z); + int stepX = (int)Sign(ray.direction.x); + int stepY = (int)Sign(ray.direction.y); + int stepZ = (int)Sign(ray.direction.z); // tile boundary - int32_t tileBoundaryX = currentX + (stepX > 0 ? 1 : 0); - int32_t tileBoundaryY = currentY + (stepY > 0 ? 1 : 0); - int32_t tileBoundaryZ = currentZ + (stepZ > 0 ? 1 : 0); + int tileBoundaryX = currentX + (stepX > 0 ? 1 : 0); + int tileBoundaryY = currentY + (stepY > 0 ? 1 : 0); + int tileBoundaryZ = currentZ + (stepZ > 0 ? 1 : 0); // HACK: for the tMax and tDelta initial calculations below, if any of the // components of ray.direction are zero, it will result in "inf" @@ -231,9 +231,9 @@ BOOL TileMap::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint32 // the map before we can attempt to determine if the current tile is // solid if ( - currentX < 0 || currentX >= (int32_t)GetWidth() || - currentY < 0 || currentY >= (int32_t)GetHeight() || - currentZ < 0 || currentZ >= (int32_t)GetDepth() + currentX < 0 || currentX >= (int)GetWidth() || + currentY < 0 || currentY >= (int)GetHeight() || + currentZ < 0 || currentZ >= (int)GetDepth() ) outOfMap = TRUE; else @@ -257,7 +257,7 @@ BOOL TileMap::CheckForCollision(const Ray &ray, uint32_t &x, uint32_t &y, uint32 return collided; } -BOOL TileMap::CheckForCollision(const Ray &ray, Vector3 &point, uint32_t &x, uint32_t &y, uint32_t &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... @@ -269,12 +269,12 @@ BOOL TileMap::CheckForCollision(const Ray &ray, Vector3 &point, uint32_t &x, uin return CheckForCollisionWithTile(ray, point, x, y, z); } -BOOL TileMap::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint32_t x, uint32_t y, uint32_t 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); - uint32_t numVertices = mesh->GetNumCollisionVertices(); + uint numVertices = mesh->GetNumCollisionVertices(); const Vector3 *vertices = mesh->GetCollisionVertices(); // world position of this tile, will be used to move each @@ -285,7 +285,7 @@ BOOL TileMap::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint32_t BOOL collided = FALSE; Vector3 collisionPoint = ZERO_VECTOR; - for (uint32_t i = 0; i < numVertices; i += 3) + for (uint i = 0; i < numVertices; i += 3) { // get the vertices making up this triangle Vector3 a = vertices[i]; @@ -315,7 +315,7 @@ BOOL TileMap::CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint32_t return collided; } -BOOL TileMap::GetOverlappedTiles(const BoundingBox &box, uint32_t &x1, uint32_t &y1, uint32_t &z1, uint32_t &x2, uint32_t &y2, uint32_t &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)) @@ -324,23 +324,23 @@ BOOL TileMap::GetOverlappedTiles(const BoundingBox &box, uint32_t &x1, uint32_t // 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 // blocks. these were arrived at through observation - int32_t minX = (int32_t)box.min.x; - int32_t minY = (int32_t)box.min.y; - int32_t minZ = (int32_t)box.min.z; - int32_t maxX = (int32_t)ceil(box.max.x); - int32_t maxY = (int32_t)ceil(box.max.y - 1.0f); - int32_t maxZ = (int32_t)ceil(box.max.z); + int minX = (int)box.min.x; + int minY = (int)box.min.y; + int minZ = (int)box.min.z; + int maxX = (int)ceil(box.max.x); + int maxY = (int)ceil(box.max.y - 1.0f); + int maxZ = (int)ceil(box.max.z); // trim off the excess bounds so that we end up with a min-to-max area // that is completely within the bounds of the map // HACK: "-1"'s keep us from picking up too many blocks. these were arrived // at through observation - minX = Clamp(minX, 0, (int32_t)GetWidth()); - minY = Clamp(minY, 0, (int32_t)(GetHeight() - 1)); - minZ = Clamp(minZ, 0, (int32_t)GetDepth()); - maxX = Clamp(maxX, 0, (int32_t)GetWidth()); - maxY = Clamp(maxY, 0, (int32_t)(GetHeight() - 1)); - maxZ = Clamp(maxZ, 0, (int32_t)GetDepth()); + minX = Clamp(minX, 0, (int)GetWidth()); + minY = Clamp(minY, 0, (int)(GetHeight() - 1)); + minZ = Clamp(minZ, 0, (int)GetDepth()); + maxX = Clamp(maxX, 0, (int)GetWidth()); + maxY = Clamp(maxY, 0, (int)(GetHeight() - 1)); + maxZ = Clamp(maxZ, 0, (int)GetDepth()); // return the leftover area x1 = minX; @@ -353,7 +353,7 @@ BOOL TileMap::GetOverlappedTiles(const BoundingBox &box, uint32_t &x1, uint32_t return TRUE; } -BOOL TileMap::GetOverlappedChunks(const BoundingBox &box, uint32_t &x1, uint32_t &y1, uint32_t &z1, uint32_t &x2, uint32_t &y2, uint32_t &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)) @@ -362,31 +362,31 @@ BOOL TileMap::GetOverlappedChunks(const BoundingBox &box, uint32_t &x1, uint32_t // 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 // blocks. these were arrived at through observation - int32_t minX = (int32_t)box.min.x; - int32_t minY = (int32_t)box.min.y; - int32_t minZ = (int32_t)box.min.z; - int32_t maxX = (int32_t)ceil(box.max.x); - int32_t maxY = (int32_t)ceil(box.max.y - 1.0f); - int32_t maxZ = (int32_t)ceil(box.max.z); + int minX = (int)box.min.x; + int minY = (int)box.min.y; + int minZ = (int)box.min.z; + int maxX = (int)ceil(box.max.x); + int maxY = (int)ceil(box.max.y - 1.0f); + int maxZ = (int)ceil(box.max.z); // now convert to chunk coords - int32_t minChunkX = minX / (int32_t)GetChunkWidth(); - int32_t minChunkY = minY / (int32_t)GetChunkHeight(); - int32_t minChunkZ = minZ / (int32_t)GetChunkDepth(); - int32_t maxChunkX = maxX / (int32_t)GetChunkWidth(); - int32_t maxChunkY = maxY / (int32_t)GetChunkHeight(); - int32_t maxChunkZ = maxZ / (int32_t)GetChunkDepth(); + int minChunkX = minX / (int)GetChunkWidth(); + int minChunkY = minY / (int)GetChunkHeight(); + int minChunkZ = minZ / (int)GetChunkDepth(); + int maxChunkX = maxX / (int)GetChunkWidth(); + int maxChunkY = maxY / (int)GetChunkHeight(); + int maxChunkZ = maxZ / (int)GetChunkDepth(); // trim off the excess bounds so that we end up with a min-to-max area // that is completely within the chunk bounds of the map // HACK: "-1"'s keep us from picking up too many chunks. these were arrived // at through observation - minChunkX = Clamp(minChunkX, 0, (int32_t)GetWidthInChunks()); - minChunkY = Clamp(minChunkY, 0, (int32_t)(GetHeightInChunks() - 1)); - minChunkZ = Clamp(minChunkZ, 0, (int32_t)GetDepthInChunks()); - maxChunkX = Clamp(maxChunkX, 0, (int32_t)GetWidthInChunks()); - maxChunkY = Clamp(maxChunkY, 0, (int32_t)(GetHeightInChunks() - 1)); - maxChunkZ = Clamp(maxChunkZ, 0, (int32_t)GetDepthInChunks()); + minChunkX = Clamp(minChunkX, 0, (int)GetWidthInChunks()); + minChunkY = Clamp(minChunkY, 0, (int)(GetHeightInChunks() - 1)); + minChunkZ = Clamp(minChunkZ, 0, (int)GetDepthInChunks()); + maxChunkX = Clamp(maxChunkX, 0, (int)GetWidthInChunks()); + maxChunkY = Clamp(maxChunkY, 0, (int)(GetHeightInChunks() - 1)); + maxChunkZ = Clamp(maxChunkZ, 0, (int)GetDepthInChunks()); // return the leftover area x1 = minChunkX; @@ -403,7 +403,7 @@ void TileMap::UpdateVertices() { ASSERT(m_numChunks > 0); - for (uint32_t i = 0; i < m_numChunks; ++i) + for (uint i = 0; i < m_numChunks; ++i) { TileChunk *chunk = m_chunks[i]; UpdateChunkVertices(chunk); diff --git a/src/tilemap/tilemap.h b/src/tilemap/tilemap.h index 071e6a0..725542e 100644 --- a/src/tilemap/tilemap.h +++ b/src/tilemap/tilemap.h @@ -27,49 +27,49 @@ public: TileMap(TileMeshCollection *tileMeshes, ChunkVertexGenerator *vertexGenerator, TileMapLighter *lighter, GraphicsDevice *graphicsDevice); virtual ~TileMap(); - void SetSize(uint32_t numChunksX, uint32_t numChunksY, uint32_t numChunksZ, uint32_t chunkSizeX, uint32_t chunkSizeY, uint32_t chunkSizeZ); + void SetSize(uint numChunksX, uint numChunksY, uint numChunksZ, uint chunkSizeX, uint chunkSizeY, uint chunkSizeZ); TileMeshCollection* GetMeshes() const { return m_tileMeshes; } ChunkVertexGenerator* GetVertexGenerator() const { return m_vertexGenerator; } TileMapLighter* GetLighter() const { return m_lighter; } - Tile* Get(uint32_t x, uint32_t y, uint32_t z) const; - Tile* GetSafe(uint32_t x, uint32_t y, uint32_t z) const; - TileChunk* GetChunk(uint32_t chunkX, uint32_t chunkY, uint32_t chunkZ) const; - TileChunk* GetChunkSafe(uint32_t chunkX, uint32_t chunkY, uint32_t chunkZ) const; - TileChunk* GetChunkNextTo(TileChunk *chunk, int32_t offsetX, int32_t offsetY, int32_t offsetZ) const; - TileChunk* GetChunkContaining(uint32_t x, uint32_t y, uint32_t z) const; + Tile* Get(uint x, uint y, uint z) const; + Tile* GetSafe(uint x, uint y, uint z) const; + TileChunk* GetChunk(uint chunkX, uint chunkY, uint chunkZ) const; + TileChunk* GetChunkSafe(uint chunkX, uint chunkY, uint chunkZ) const; + TileChunk* GetChunkNextTo(TileChunk *chunk, int offsetX, int offsetY, int offsetZ) const; + TileChunk* GetChunkContaining(uint x, uint y, uint z) const; - void GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z, BoundingBox *box) const; - BoundingBox GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z) const; + 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, uint32_t &x, uint32_t &y, uint32_t &z) const; - BOOL CheckForCollision(const Ray &ray, Vector3 &point, uint32_t &x, uint32_t &y, uint32_t &z) const; - BOOL CheckForCollisionWithTile(const Ray &ray, Vector3 &point, uint32_t x, uint32_t y, uint32_t z) const; - BOOL GetOverlappedTiles(const BoundingBox &box, uint32_t &x1, uint32_t &y1, uint32_t &z1, uint32_t &x2, uint32_t &y2, uint32_t &z2) const; - BOOL GetOverlappedChunks(const BoundingBox &box, uint32_t &x1, uint32_t &y1, uint32_t &z1, uint32_t &x2, uint32_t &y2, uint32_t &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(uint32_t chunkX, uint32_t chunkY, uint32_t chunkZ); + void UpdateChunkVertices(uint chunkX, uint chunkY, uint chunkZ); void UpdateVertices(); void UpdateLighting(); - BOOL IsWithinBounds(int32_t x, int32_t y, int32_t z) const; + BOOL IsWithinBounds(int x, int y, int z) const; - uint32_t GetWidth() const { return m_widthInChunks * m_chunkWidth; } - uint32_t GetHeight() const { return m_heightInChunks * m_chunkHeight; } - uint32_t GetDepth() const { return m_depthInChunks * m_chunkDepth; } + uint GetWidth() const { return m_widthInChunks * m_chunkWidth; } + uint GetHeight() const { return m_heightInChunks * m_chunkHeight; } + uint GetDepth() const { return m_depthInChunks * m_chunkDepth; } - uint32_t GetChunkWidth() const { return m_chunkWidth; } - uint32_t GetChunkHeight() const { return m_chunkHeight; } - uint32_t GetChunkDepth() const { return m_chunkDepth; } + uint GetChunkWidth() const { return m_chunkWidth; } + uint GetChunkHeight() const { return m_chunkHeight; } + uint GetChunkDepth() const { return m_chunkDepth; } - uint32_t GetWidthInChunks() const { return m_widthInChunks; } - uint32_t GetHeightInChunks() const { return m_heightInChunks; } - uint32_t GetDepthInChunks() const { return m_depthInChunks; } + uint GetWidthInChunks() const { return m_widthInChunks; } + uint GetHeightInChunks() const { return m_heightInChunks; } + uint GetDepthInChunks() const { return m_depthInChunks; } const BoundingBox& GetBounds() const { return m_bounds; } - uint32_t GetNumChunks() const { return m_numChunks; } + uint GetNumChunks() const { return m_numChunks; } void SetAmbientLightValue(TILE_LIGHT_VALUE value) { m_ambientLightValue = value; } TILE_LIGHT_VALUE GetAmbientLightValue() const { return m_ambientLightValue; } @@ -79,8 +79,8 @@ public: private: void Clear(); - uint32_t GetChunkIndexAt(uint32_t x, uint32_t y, uint32_t z) const; - uint32_t GetChunkIndex(uint32_t chunkX, uint32_t chunkY, uint32_t chunkZ) const; + uint GetChunkIndexAt(uint x, uint y, uint z) const; + uint GetChunkIndex(uint chunkX, uint chunkY, uint chunkZ) const; void UpdateChunkVertices(TileChunk *chunk); @@ -90,46 +90,46 @@ private: ChunkVertexGenerator *m_vertexGenerator; TileMapLighter *m_lighter; - uint32_t m_chunkWidth; - uint32_t m_chunkHeight; - uint32_t m_chunkDepth; + uint m_chunkWidth; + uint m_chunkHeight; + uint m_chunkDepth; - uint32_t m_widthInChunks; - uint32_t m_heightInChunks; - uint32_t m_depthInChunks; + uint m_widthInChunks; + uint m_heightInChunks; + uint m_depthInChunks; BoundingBox m_bounds; - uint32_t m_numChunks; + uint m_numChunks; TILE_LIGHT_VALUE m_ambientLightValue; TILE_LIGHT_VALUE m_skyLightValue; }; -inline Tile* TileMap::Get(uint32_t x, uint32_t y, uint32_t z) const +inline Tile* TileMap::Get(uint x, uint y, uint z) const { TileChunk *chunk = GetChunkContaining(x, y, z); - uint32_t chunkX = x - chunk->GetX(); - uint32_t chunkY = y - chunk->GetY(); - uint32_t chunkZ = z - chunk->GetZ(); + uint chunkX = x - chunk->GetX(); + uint chunkY = y - chunk->GetY(); + uint chunkZ = z - chunk->GetZ(); return chunk->Get(chunkX, chunkY, chunkZ); } -inline Tile* TileMap::GetSafe(uint32_t x, uint32_t y, uint32_t z) const +inline Tile* TileMap::GetSafe(uint x, uint y, uint z) const { - if (!IsWithinBounds((int32_t)x, (int32_t)y, (int32_t)z)) + if (!IsWithinBounds((int)x, (int)y, (int)z)) return NULL; else return Get(x, y, z); } -inline TileChunk* TileMap::GetChunk(uint32_t chunkX, uint32_t chunkY, uint32_t chunkZ) const +inline TileChunk* TileMap::GetChunk(uint chunkX, uint chunkY, uint chunkZ) const { - uint32_t index = GetChunkIndex(chunkX, chunkY, chunkZ); + uint index = GetChunkIndex(chunkX, chunkY, chunkZ); return m_chunks[index]; } -inline TileChunk* TileMap::GetChunkSafe(uint32_t chunkX, uint32_t chunkY, uint32_t chunkZ) const +inline TileChunk* TileMap::GetChunkSafe(uint chunkX, uint chunkY, uint chunkZ) const { if ( (chunkX >= m_widthInChunks) || @@ -141,69 +141,69 @@ inline TileChunk* TileMap::GetChunkSafe(uint32_t chunkX, uint32_t chunkY, uint32 return GetChunk(chunkX, chunkY, chunkZ); } -inline TileChunk* TileMap::GetChunkNextTo(TileChunk *chunk, int32_t offsetX, int32_t offsetY, int32_t offsetZ) const +inline TileChunk* TileMap::GetChunkNextTo(TileChunk *chunk, int offsetX, int offsetY, int offsetZ) const { - int32_t checkX = chunk->GetX() + offsetX; - int32_t checkY = chunk->GetY() + offsetY; - int32_t checkZ = chunk->GetZ() + offsetZ; + int checkX = chunk->GetX() + offsetX; + int checkY = chunk->GetY() + offsetY; + int checkZ = chunk->GetZ() + offsetZ; if ( - (checkX < 0 || (uint32_t)checkX >= m_widthInChunks) || - (checkY < 0 || (uint32_t)checkY >= m_heightInChunks) || - (checkZ < 0 || (uint32_t)checkZ >= m_depthInChunks) + (checkX < 0 || (uint)checkX >= m_widthInChunks) || + (checkY < 0 || (uint)checkY >= m_heightInChunks) || + (checkZ < 0 || (uint)checkZ >= m_depthInChunks) ) return NULL; else return GetChunk(checkX, checkY, checkZ); } -inline TileChunk* TileMap::GetChunkContaining(uint32_t x, uint32_t y, uint32_t z) const +inline TileChunk* TileMap::GetChunkContaining(uint x, uint y, uint z) const { - uint32_t index = GetChunkIndexAt(x, y, z); + uint index = GetChunkIndexAt(x, y, z); return m_chunks[index]; } -inline void TileMap::GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z, BoundingBox *box) const +inline void TileMap::GetBoundingBoxFor(uint x, uint y, uint z, BoundingBox *box) const { TileChunk *chunk = GetChunkContaining(x, y, z); - uint32_t chunkX = x - chunk->GetX(); - uint32_t chunkY = y - chunk->GetY(); - uint32_t chunkZ = z - chunk->GetZ(); + uint chunkX = x - chunk->GetX(); + uint chunkY = y - chunk->GetY(); + uint chunkZ = z - chunk->GetZ(); chunk->GetBoundingBoxFor(chunkX, chunkY, chunkZ, box); } -inline BoundingBox TileMap::GetBoundingBoxFor(uint32_t x, uint32_t y, uint32_t z) const +inline BoundingBox TileMap::GetBoundingBoxFor(uint x, uint y, uint z) const { BoundingBox box; GetBoundingBoxFor(x, y, z, &box); return box; } -inline void TileMap::UpdateChunkVertices(uint32_t chunkX, uint32_t chunkY, uint32_t chunkZ) +inline void TileMap::UpdateChunkVertices(uint chunkX, uint chunkY, uint chunkZ) { - uint32_t index = GetChunkIndex(chunkX, chunkY, chunkZ); + uint index = GetChunkIndex(chunkX, chunkY, chunkZ); TileChunk *chunk = m_chunks[index]; UpdateChunkVertices(chunk); } -inline uint32_t TileMap::GetChunkIndexAt(uint32_t x, uint32_t y, uint32_t z) const +inline uint TileMap::GetChunkIndexAt(uint x, uint y, uint z) const { return GetChunkIndex(x / m_chunkWidth, y / m_chunkHeight, z / m_chunkDepth); } -inline uint32_t TileMap::GetChunkIndex(uint32_t chunkX, uint32_t chunkY, uint32_t chunkZ) const +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(int32_t x, int32_t y, int32_t z) const +inline BOOL TileMap::IsWithinBounds(int x, int y, int z) const { - if (x < 0 || x >= (int32_t)GetWidth()) + if (x < 0 || x >= (int)GetWidth()) return FALSE; - if (y < 0 || y >= (int32_t)GetHeight()) + if (y < 0 || y >= (int)GetHeight()) return FALSE; - if (z < 0 || z >= (int32_t)GetDepth()) + if (z < 0 || z >= (int)GetDepth()) return FALSE; return TRUE; diff --git a/src/tilemap/tilemaprenderer.cpp b/src/tilemap/tilemaprenderer.cpp index 4c51133..dfa107c 100644 --- a/src/tilemap/tilemaprenderer.cpp +++ b/src/tilemap/tilemaprenderer.cpp @@ -45,11 +45,11 @@ void TileMapRenderer::Render(const TileMap *tileMap, Shader *shader) m_graphicsDevice->BindShader(shader); } - for (uint32_t y = 0; y < tileMap->GetHeightInChunks(); ++y) + for (uint y = 0; y < tileMap->GetHeightInChunks(); ++y) { - for (uint32_t z = 0; z < tileMap->GetDepthInChunks(); ++z) + for (uint z = 0; z < tileMap->GetDepthInChunks(); ++z) { - for (uint32_t x = 0; x < tileMap->GetWidthInChunks(); ++x) + for (uint x = 0; x < tileMap->GetWidthInChunks(); ++x) { TileChunk *chunk = tileMap->GetChunk(x, y, z); if (m_graphicsDevice->GetViewContext()->GetCamera()->GetFrustum()->Test(chunk->GetBounds())) @@ -81,11 +81,11 @@ void TileMapRenderer::RenderAlpha(const TileMap *tileMap, Shader *shader) m_graphicsDevice->BindShader(shader); } - for (uint32_t y = 0; y < tileMap->GetHeightInChunks(); ++y) + for (uint y = 0; y < tileMap->GetHeightInChunks(); ++y) { - for (uint32_t z = 0; z < tileMap->GetDepthInChunks(); ++z) + for (uint z = 0; z < tileMap->GetDepthInChunks(); ++z) { - for (uint32_t x = 0; x < tileMap->GetWidthInChunks(); ++x) + for (uint x = 0; x < tileMap->GetWidthInChunks(); ++x) { TileChunk *chunk = tileMap->GetChunk(x, y, z); if (chunk->IsAlphaEnabled() && m_graphicsDevice->GetViewContext()->GetCamera()->GetFrustum()->Test(chunk->GetBounds())) diff --git a/src/tilemap/tilemaprenderer.h b/src/tilemap/tilemaprenderer.h index b5b451a..82145e6 100644 --- a/src/tilemap/tilemaprenderer.h +++ b/src/tilemap/tilemaprenderer.h @@ -18,22 +18,22 @@ public: void Render(const TileMap *tileMap, Shader *shader = NULL); void RenderAlpha(const TileMap *tileMap, Shader *shader = NULL); - uint32_t GetNumVerticesRendered() const { return m_numVerticesRendered; } - uint32_t GetNumAlphaVerticesRendered() const { return m_numAlphaVerticesRendered; } - uint32_t GetNumChunksRendered() const { return m_numChunksRendered; } - uint32_t GetNumAlphaChunksRendered() const { return m_numAlphaChunksRendered; } + uint GetNumVerticesRendered() const { return m_numVerticesRendered; } + uint GetNumAlphaVerticesRendered() const { return m_numAlphaVerticesRendered; } + uint GetNumChunksRendered() const { return m_numChunksRendered; } + uint GetNumAlphaChunksRendered() const { return m_numAlphaChunksRendered; } - uint32_t GetTotalVerticesRendered() const { return m_numVerticesRendered + m_numAlphaVerticesRendered; } - uint32_t GetTotalChunksRendered() const { return m_numChunksRendered + m_numAlphaChunksRendered; } + uint GetTotalVerticesRendered() const { return m_numVerticesRendered + m_numAlphaVerticesRendered; } + uint GetTotalChunksRendered() const { return m_numChunksRendered + m_numAlphaChunksRendered; } private: GraphicsDevice *m_graphicsDevice; ChunkRenderer *m_chunkRenderer; - uint32_t m_numVerticesRendered; - uint32_t m_numAlphaVerticesRendered; - uint32_t m_numChunksRendered; - uint32_t m_numAlphaChunksRendered; + uint m_numVerticesRendered; + uint m_numAlphaVerticesRendered; + uint m_numChunksRendered; + uint m_numAlphaChunksRendered; }; #endif diff --git a/src/tilemap/tilemesh.h b/src/tilemap/tilemesh.h index 9d81479..b6c3df7 100644 --- a/src/tilemap/tilemesh.h +++ b/src/tilemap/tilemesh.h @@ -24,7 +24,7 @@ public: virtual ~TileMesh() {} virtual VertexBuffer* GetBuffer() const = 0; - virtual uint32_t GetNumCollisionVertices() const = 0; + virtual uint GetNumCollisionVertices() const = 0; virtual const Vector3* GetCollisionVertices() const = 0; virtual TILEMESH_TYPE GetType() const = 0; diff --git a/src/tilemap/tilemeshcollection.cpp b/src/tilemap/tilemeshcollection.cpp index 063c8e1..811a71f 100644 --- a/src/tilemap/tilemeshcollection.cpp +++ b/src/tilemap/tilemeshcollection.cpp @@ -22,19 +22,19 @@ TileMeshCollection::TileMeshCollection(const TextureAtlas *textureAtlas) TileMeshCollection::~TileMeshCollection() { - for (size_t i = 0; i < m_meshes.size(); ++i) + for (uint i = 0; i < m_meshes.size(); ++i) { TileMesh *mesh = m_meshes[i]; SAFE_DELETE(mesh); } } -uint32_t TileMeshCollection::Add(const StaticMesh *mesh, uint32_t 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); } -uint32_t TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint32_t 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,18 +42,18 @@ uint32_t TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *colli return AddMesh(tileMesh); } -uint32_t TileMeshCollection::Add(const StaticMesh *mesh, uint32_t *textureIndexes, uint32_t 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); } -uint32_t TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint32_t *textureIndexes, uint32_t 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]; ASSERT(tileBoundaries != NULL); - for (uint32_t i = 0; i < numIndexes; ++i) + for (uint i = 0; i < numIndexes; ++i) tileBoundaries[i] = m_textureAtlas->GetTile(textureIndexes[i]).texCoords; StaticTileMesh *tileMesh = new StaticTileMesh(mesh, tileBoundaries, numIndexes, opaqueSides, lightValue, alpha, translucency, color, collisionMesh); @@ -64,7 +64,7 @@ uint32_t TileMeshCollection::Add(const StaticMesh *mesh, const StaticMesh *colli return AddMesh(tileMesh); } -uint32_t TileMeshCollection::AddCube(uint32_t 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); @@ -72,7 +72,7 @@ uint32_t TileMeshCollection::AddCube(uint32_t textureIndex, MESH_SIDES opaqueSid return AddMesh(tileMesh); } -uint32_t TileMeshCollection::AddMesh(TileMesh *mesh) +uint TileMeshCollection::AddMesh(TileMesh *mesh) { m_meshes.push_back(mesh); return m_meshes.size() - 1; diff --git a/src/tilemap/tilemeshcollection.h b/src/tilemap/tilemeshcollection.h index a361d0e..5360ffc 100644 --- a/src/tilemap/tilemeshcollection.h +++ b/src/tilemap/tilemeshcollection.h @@ -22,18 +22,18 @@ public: const TextureAtlas* GetTextureAtlas() const { return m_textureAtlas; } - uint32_t Add(const StaticMesh *mesh, uint32_t textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); - uint32_t Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint32_t textureIndex, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); - uint32_t Add(const StaticMesh *mesh, uint32_t *textureIndexes, uint32_t numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); - uint32_t Add(const StaticMesh *mesh, const StaticMesh *collisionMesh, uint32_t *textureIndexes, uint32_t numIndexes, MESH_SIDES opaqueSides, TILE_LIGHT_VALUE lightValue = 0, BOOL alpha = FALSE, float translucency = 1.0f, const Color &color = COLOR_WHITE); - uint32_t AddCube(uint32_t 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(uint32_t index) const { return m_meshes[index]; } - uint32_t GetCount() const { return m_meshes.size(); } + TileMesh* Get(uint index) const { return m_meshes[index]; } + uint GetCount() const { return m_meshes.size(); } private: - uint32_t AddMesh(TileMesh *mesh); + uint AddMesh(TileMesh *mesh); const TextureAtlas *m_textureAtlas; TileMeshList m_meshes; diff --git a/src/tilemap/tilemeshdefs.h b/src/tilemap/tilemeshdefs.h index db2dab3..91138b2 100644 --- a/src/tilemap/tilemeshdefs.h +++ b/src/tilemap/tilemeshdefs.h @@ -19,7 +19,7 @@ enum SIDES typedef uint8_t CUBE_FACES; typedef uint8_t MESH_SIDES; -const uint32_t CUBE_VERTICES_PER_FACE = 6; +const uint CUBE_VERTICES_PER_FACE = 6; #endif