diff options
Diffstat (limited to 'inc/sdl')
| -rw-r--r-- | inc/sdl/event.hpp | 22 | ||||
| -rw-r--r-- | inc/sdl/timer.hpp | 25 | ||||
| -rw-r--r-- | inc/sdl/window.hpp | 27 | 
3 files changed, 74 insertions, 0 deletions
diff --git a/inc/sdl/event.hpp b/inc/sdl/event.hpp new file mode 100644 index 0000000..3a0a868 --- /dev/null +++ b/inc/sdl/event.hpp @@ -0,0 +1,22 @@ +#ifndef event_h +#define event_h + +#include <SDL2/SDL.h> + +class Event +{ +        public: +	        Event(); + +		int             Poll(); +		void            off(); +		bool            gRun(); +		SDL_Event&      gEvent(); +		int             gEventType(); + +	private: +		bool run; +		SDL_Event v; +}; + +#endif diff --git a/inc/sdl/timer.hpp b/inc/sdl/timer.hpp new file mode 100644 index 0000000..d4e46e8 --- /dev/null +++ b/inc/sdl/timer.hpp @@ -0,0 +1,25 @@ +#ifndef timer_h +#define timer_h + +#include <SDL2/SDL.h> + +class Timer +{ + public: +    Timer(); +    void Start(); +    void Stop(); +    void Pause(); +    void unPause(); +    int  getTicks(); +    bool isStarted(){return started;}; +    bool isPaused(){return paused;}; + + private: +    int startTicks; +    int pausedTicks; +    bool paused; +    bool started; +}; + +#endif diff --git a/inc/sdl/window.hpp b/inc/sdl/window.hpp new file mode 100644 index 0000000..fc0f325 --- /dev/null +++ b/inc/sdl/window.hpp @@ -0,0 +1,27 @@ +#ifndef window_h +#define window_h + +#include <SDL2/SDL.h> +#include <string> +#include <iostream> +#include <GL/glew.h> + +#include "constants.hpp" + +class Window +{ +	public: +		Window(int width, int height, const std::string& title); +        void Clear(float r, float g, float b, float a); +        void swapBuffers(); +        bool getClosed(){return closed;}; + +        virtual ~Window(); + +	private: +		SDL_Window* main; +        SDL_GLContext glContext; +        bool closed; +}; + +#endif  | 
