Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tumble1999/cinnabar
Browse files Browse the repository at this point in the history
  • Loading branch information
SArpnt committed Feb 16, 2021
2 parents c1f4c7e + 6a2b42d commit 59b00e8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ Linux: /build/run/engine
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

## Todo
* Window Class
* ~~Window Class~~
* Resize context on window resize
* Time Class
* ~~Time Class~~
* Camera Class
* Input System
* Render System
Expand Down
15 changes: 15 additions & 0 deletions engine/ce_event_handler.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

#ifndef _CE_EVENT_HANDLER_H_
#define _CE_EVENT_HANDLER_H_

#include <SDL_events.h>

namespace ce {
class IEventHandler {
private:
public:
virtual void onEvent(SDL_Event& event)=0;
};
}

#endif // _CE_EVENT_HANDLER_H_
2 changes: 1 addition & 1 deletion engine/core/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ glm::vec2 ce::Window::getWindowSize()
{
int w,h;
SDL_GetWindowSize(m_window,&w, &h);
return glm::vec2(w,h);
return glm::vec2((float)w,(float)h);
}
float ce::Window::getAspectRatio()
{
Expand Down
1 change: 1 addition & 0 deletions engine/core/window.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <ce_math.h>
#include <ce_rendering.h>
#include <ce_event_handler.h>

namespace ce {
class Window {
Expand Down
12 changes: 6 additions & 6 deletions engine/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,6 @@ int main(int argc, char* argv[]) {

//Time
ce::Time* time = new ce::Time();
/*float
deltaTime = 0.0f,
last = 0.0f;*/

ce::Transform transform;
ce::Shader* shader = new ce::Shader("basic");
Expand All @@ -101,8 +98,6 @@ int main(int argc, char* argv[]) {
mesh->sendToShader(shader);
ce::Texture* texture = new ce::Texture("uv-map.png");
shader->setInt("uTex",0);

bool mouseLocked = true;
float
mouseSensitivity = 0.1f,
cameraPitch = 0.0f,
Expand Down Expand Up @@ -168,6 +163,12 @@ int main(int argc, char* argv[]) {
running = 0;
break;
}
case SDL_WINDOWEVENT:
{
glm::vec2 size = window->getWindowSize();
glViewport(0, 0, size.x,size.y);
break;
}
}
}

Expand All @@ -180,7 +181,6 @@ int main(int argc, char* argv[]) {
transform.pitch(100.0f*time->getDeltaTime());
transform.saveToShader(shader);


// Camera
glm::vec3
cameraDirection(
Expand Down

0 comments on commit 59b00e8

Please sign in to comment.