35 lines
817 B
C++
35 lines
817 B
C++
//
|
|
// Window.hpp
|
|
// gui
|
|
//
|
|
// Created by Bob Polis at 2020-10-14
|
|
// Copyright (c) 2020 SwiftCoder. All rights reserved.
|
|
//
|
|
|
|
#ifndef __WINDOW_H_
|
|
#define __WINDOW_H_
|
|
|
|
#include <SDL2/SDL.h>
|
|
#include <string>
|
|
#include <memory>
|
|
#include <stdexcept>
|
|
|
|
class Window {
|
|
public:
|
|
Window(const char* title);
|
|
|
|
SDL_Window* get_window() const { return _w.get(); }
|
|
void set_size(int w, int h);
|
|
|
|
void update() const;
|
|
void load_image();
|
|
|
|
private:
|
|
std::string _path;
|
|
std::unique_ptr<SDL_Window, void(*)(SDL_Window*)> _w {nullptr, SDL_DestroyWindow};
|
|
std::unique_ptr<SDL_Renderer, void(*)(SDL_Renderer*)> _r {nullptr, SDL_DestroyRenderer};
|
|
std::unique_ptr<SDL_Texture, void(*)(SDL_Texture*)> _t {nullptr, SDL_DestroyTexture};
|
|
};
|
|
|
|
#endif // __WINDOW_H_
|