My Project
Loading...
Searching...
No Matches
window.hh
Go to the documentation of this file.
1#pragma once
2#include <GL/glew.h>
3#include <GLFW/glfw3.h>
4#include "inputs.hh"
6
7class Window
8{
9private:
10 GLFWwindow *m_window;
17
18 inline void
20 {
21 float current_frame = get_time();
22 m_deltatime = current_frame - m_lastframe;
23 m_lastframe = current_frame;
24 // TODO - Creating a accumulator time;
25 // m_accumulator = current_frame;
26 // tldr; implement accumulator in the game loop logic,
27 // this will prevent logic game upate bugs related
28 // to frametime/fps and will made it deterministic.
29 // https://www.youtube.com/watch?v=lW6ZtvQVzyg
30 }
31
32public:
33 Window(char *window_name, float width, float height);
34 ~Window();
35 void begin_frame() const;
36 void end_frame();
37 float get_time();
38 bool running();
39 void setup(Keyboard keyboard);
40
41 inline GLFWwindow *
42 get_window() const
43 {
44 return m_window;
45 };
46 inline int
47 get_width() const
48 {
49 return m_width;
50 };
51 inline int
52 get_height() const
53 {
54 return m_height;
55 };
56 inline float
58 {
59 return m_deltatime;
60 };
61};
Definition inputs.hh:38
Definition inputs.hh:68
Definition opengl_middleware.hh:7
Definition window.hh:8
~Window()
Definition window.cpp:48
int get_height() const
Definition window.hh:52
float m_deltatime
Definition window.hh:13
void update_deltatime_frame()
Definition window.hh:19
void end_frame()
Definition window.cpp:57
void setup(Keyboard keyboard)
int get_width() const
Definition window.hh:47
void begin_frame() const
Definition window.cpp:74
int m_height
Definition window.hh:12
float get_time()
Definition window.cpp:51
int m_width
Definition window.hh:11
Mouse & _mouse
Definition window.hh:15
OpenGLCallback & _opengl
Definition window.hh:16
float m_lastframe
Definition window.hh:14
bool running()
Definition window.cpp:68
float get_deltatime()
Definition window.hh:57
GLFWwindow * m_window
Definition window.hh:10
GLFWwindow * get_window() const
Definition window.hh:42