-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWindow.h
More file actions
44 lines (33 loc) · 1.08 KB
/
Window.h
File metadata and controls
44 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef WINDOW_H
#define WINDOW_H
#include <stdio.h>
#include <iostream>
#include <GL/glew.h>
#include <SDL2/SDL.h>
class Window {
public:
Window();
Window(GLint windowWidth, GLint windowHeight);
int initialize();
GLfloat getBufferWidth() { return bufferWidth; }
GLfloat getBufferHeight() { return bufferHeight; }
bool getShouldClose() { return quit; }
void setShouldClose(bool should) { quit = should; }
bool* getKeys() { return keys; }
GLfloat getMouseX() { GLfloat tempX = mouseX; mouseX = 0.0f; return tempX; }
GLfloat getMouseY() { GLfloat tempY = mouseY; mouseY = 0.0f; return tempY; }
void pollEvent();
void swapBuffers() { SDL_GL_SwapWindow(window); }
~Window();
private:
void handleKey(int code, bool down);
void handleMouse(float x, float y);
SDL_Window *window;
GLint width, height;
GLint bufferWidth, bufferHeight;
bool quit;
SDL_GLContext glContext;
bool keys[1024];
GLfloat mouseX, mouseY;
};
#endif