todo list and camera class
This commit is contained in:
@@ -3,6 +3,8 @@ First off, we thank you for taking the time to contribute to the crumpet engine
|
||||
|
||||
When contributing or submitting pull requests follow these guidelines or your contribution will not be taken seriously.
|
||||
|
||||
If you want to contribute but don't know what to do, see TODO.txt for a list of tasks that need to be complete, but make sure when you complete one you mark it as such, do not remove it from the list.
|
||||
|
||||
## Make sure your code is
|
||||
- Functional
|
||||
- Maintainable and Scalable
|
||||
|
||||
8
TODO.txt
8
TODO.txt
@@ -1,10 +1,14 @@
|
||||
CURRENT TODO LIST FOR THE DEVELOPMENT OF THE CRUMPET GAME ENGINE
|
||||
|
||||
[ ] Fix entity / sprite resizing
|
||||
[ ] Add sprite methods to entity
|
||||
[ ] Game camera class and redo rendering pipeline
|
||||
[ ] Add rotation and flipping for entities and sprites
|
||||
[ ] Camera class
|
||||
[x] Camera class
|
||||
[ ] Make the camera class control the rendering of the active scene
|
||||
[ ] Change every class to use vector pointers and remove the initalization lists
|
||||
[ ] Game coordinate system
|
||||
[ ] Render to game coordinates instead of screen coordinates
|
||||
[ ] Render to GameWorld coordinates instead of screen coordinates
|
||||
[ ] Each entity and sprite should store a reference to Camera
|
||||
[ ] GameWorld class with coordinate system
|
||||
[ ] Switch between camera modes on GameWorld
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
#include "camera.h"
|
||||
|
||||
Camera::Camera() {
|
||||
|
||||
}
|
||||
|
||||
Camera::~Camera() {
|
||||
|
||||
}
|
||||
@@ -4,10 +4,24 @@
|
||||
#include <SDL.h>
|
||||
#include "mathHelper.h"
|
||||
|
||||
struct AspectRatio {
|
||||
int w, h;
|
||||
AspectRatio(int w, int h) : w(w), h(h) {}
|
||||
};
|
||||
|
||||
class Camera {
|
||||
public:
|
||||
Camera();
|
||||
Camera() {
|
||||
this->Zoom = 1.0f;
|
||||
this->Pos = new Vec2(0, 0);
|
||||
this->Rotation = 1.0f;
|
||||
this->Aspectratio = new AspectRatio(16, 9);
|
||||
}
|
||||
Vec2* Pos;
|
||||
float Zoom;
|
||||
float Rotation;
|
||||
AspectRatio* Aspectratio;
|
||||
|
||||
virtual ~Camera();
|
||||
private:
|
||||
SDL_Rect* m_veiw;
|
||||
|
||||
@@ -125,7 +125,6 @@
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="camera.cpp" />
|
||||
<ClCompile Include="entity.cpp" />
|
||||
<ClCompile Include="game.cpp" />
|
||||
<ClCompile Include="gameWorld.cpp" />
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
<ClCompile Include="game.cpp" />
|
||||
<ClCompile Include="sprite.cpp" />
|
||||
<ClCompile Include="logger.cpp" />
|
||||
<ClCompile Include="camera.cpp" />
|
||||
<ClCompile Include="gameWorld.cpp" />
|
||||
<ClCompile Include="level.cpp" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -45,8 +45,8 @@ public:
|
||||
|
||||
virtual ~Entity();
|
||||
protected:
|
||||
// std::string PATH = "C:/Users/Ben/Desktop/crumpet-engine";
|
||||
std::string PATH = "E:/Games/crumpet-engine";
|
||||
std::string PATH = "C:/Users/Ben/Desktop/crumpet-engine";
|
||||
//std::string PATH = "E:/Games/crumpet-engine";
|
||||
private:
|
||||
std::string m_name;
|
||||
|
||||
|
||||
@@ -9,6 +9,9 @@ int main(int argc, char** argv) {
|
||||
Game game("Crumpet engine", SCREEN_WIDTH, SCREEN_HEIGHT, 0, 1000 / 60); // 1000 / 60);
|
||||
Timer timer;
|
||||
|
||||
Entity bay("bay", game.SDLRenderer);
|
||||
bay.LoadTexture("/resources/bay.jpg");
|
||||
|
||||
Sprite sans("sans", game.SDLRenderer, SpriteType::SPRITE_ANIMATED);
|
||||
sans.LoadSpriteTextures("/resources/sans-undertale-spritesheet.png");
|
||||
sans.UseSpriteSheet(SpriteState::STATE_FRONT, 30, 9, 230, 300, 10, 4);
|
||||
@@ -45,6 +48,7 @@ int main(int argc, char** argv) {
|
||||
|
||||
game.RenderClear();
|
||||
game.RenderSprite(&sans);
|
||||
game.RenderEntity(&bay);
|
||||
game.RenderSprite(&explosion);
|
||||
game.RenderUpdate();
|
||||
}
|
||||
|
||||
@@ -15,6 +15,9 @@ Renderer::Renderer(std::string title, int width, int height, int targetFramerate
|
||||
if (targetFramerate == 1)
|
||||
SDLRenderer = SDL_CreateRenderer(m_window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_ACCELERATED);
|
||||
|
||||
this->Width = width;
|
||||
this->Height = height;
|
||||
|
||||
isClosed = false;
|
||||
}
|
||||
|
||||
@@ -31,6 +34,14 @@ void Renderer::RenderSprite(Sprite* sprite) {
|
||||
sprite->Render();
|
||||
}
|
||||
|
||||
void Renderer::SetRendererColour(Vec4* col) {
|
||||
|
||||
}
|
||||
|
||||
void Renderer::RenderEmptyRect() {
|
||||
|
||||
}
|
||||
|
||||
void Renderer::RenderUpdate() {
|
||||
SDL_SetRenderDrawColor(SDLRenderer, 66, 134, 244, 255);
|
||||
SDL_RenderPresent(SDLRenderer);
|
||||
|
||||
@@ -14,15 +14,24 @@ public:
|
||||
|
||||
void RenderEntity(Entity* entity);
|
||||
|
||||
void TickSpriteAnimation(Sprite* sprite);
|
||||
void RenderSprite(Sprite* sprite, SpriteState state);
|
||||
void RenderSprite(Sprite* sprite);
|
||||
|
||||
void SetRendererColour(Vec4* col);
|
||||
|
||||
void RenderEmptyRect();
|
||||
void RenderFilledRect();
|
||||
void RenderLines();
|
||||
void RenderTexture();
|
||||
|
||||
void RenderUpdate();
|
||||
void RenderClear();
|
||||
|
||||
bool IsDisplayClosed();
|
||||
void CloseDisplay();
|
||||
|
||||
int Width, Height;
|
||||
|
||||
virtual ~Renderer();
|
||||
private:
|
||||
SDL_Window *m_window;
|
||||
|
||||
BIN
resources/bay.jpg
Normal file
BIN
resources/bay.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 468 KiB |
Reference in New Issue
Block a user