Threading for renderer, textures, entities, game state
This commit is contained in:
@@ -1,19 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include <SDL3/SDL.h>
|
||||
#include <iostream>
|
||||
#include <thread>
|
||||
#include <utils.hpp>
|
||||
|
||||
namespace Game::Renderer {
|
||||
class Renderer {
|
||||
public:
|
||||
Renderer();
|
||||
DISABLE_COPY_AND_MOVE(Renderer);
|
||||
~Renderer();
|
||||
|
||||
bool init(SDL_Window* window);
|
||||
void clear();
|
||||
void present();
|
||||
void run(std::stop_token stoken);
|
||||
void destroy();
|
||||
|
||||
SDL_Renderer* getSDLRenderer() { return mRenderer; }
|
||||
|
||||
private:
|
||||
void mClear();
|
||||
void mPresent();
|
||||
|
||||
SDL_Renderer* mRenderer;
|
||||
};
|
||||
}
|
||||
21
include/renderer/texture.hpp
Normal file
21
include/renderer/texture.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3_image/SDL_image.h>
|
||||
#include <string>
|
||||
#include <utils.hpp>
|
||||
#include <renderer/renderer.hpp>
|
||||
|
||||
namespace Game::Renderer {
|
||||
class Texture {
|
||||
public:
|
||||
Texture(std::string& path, Renderer* renderer, std::string id = "noname");
|
||||
Texture(const Texture&);
|
||||
Texture& operator=(const Texture&);
|
||||
DISABLE_MOVE(Texture);
|
||||
~Texture();
|
||||
private:
|
||||
SDL_Texture* mTex;
|
||||
std::string mId;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user