- [FIX] Arreglat un warning en Windows, coses de les putes llibreries STL, que son de tot menos estandar
- [WIP] En Windows, després de redimensionar finestra, es veu mal, treballant en ello, pero a Windows li ha pegat per actualiztar-se a Windows 11 i a vore qui li diu que no
This commit is contained in:
@@ -9,6 +9,7 @@ namespace draw
|
|||||||
SDL_Renderer *sdl_renderer {nullptr}; // El renderer de SDL
|
SDL_Renderer *sdl_renderer {nullptr}; // El renderer de SDL
|
||||||
SDL_Texture *sdl_texture {nullptr}; // La textura a la que ho renderitze tot
|
SDL_Texture *sdl_texture {nullptr}; // La textura a la que ho renderitze tot
|
||||||
SDL_Texture *sdl_source {nullptr};
|
SDL_Texture *sdl_source {nullptr};
|
||||||
|
SDL_FRect window_rect {0,0,0,0};
|
||||||
|
|
||||||
void init(const char *titol, const uint16_t width, const uint16_t height)
|
void init(const char *titol, const uint16_t width, const uint16_t height)
|
||||||
{
|
{
|
||||||
@@ -18,20 +19,29 @@ namespace draw
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
sdl_renderer = SDL_CreateRenderer(sdl_window, NULL);
|
printf("AVAILABLE RENDER DRIVERS:\n");
|
||||||
|
for (int i=0; i<SDL_GetNumRenderDrivers(); ++i) {
|
||||||
|
printf("%i: %s\n", i, SDL_GetRenderDriver(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
sdl_renderer = SDL_CreateRenderer(sdl_window, nullptr);
|
||||||
if (!sdl_renderer) {
|
if (!sdl_renderer) {
|
||||||
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "ERROR (draw::init): Failed to initialize renderer!\n");
|
SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "ERROR (draw::init): Failed to initialize renderer!\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("Using: %s\n", SDL_GetRendererName(sdl_renderer));
|
||||||
|
|
||||||
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, width, height);
|
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, width, height);
|
||||||
//SDL_SetRenderDrawBlendMode(sdl_renderer, SDL_BLENDMODE_BLEND);
|
|
||||||
|
window_rect = {0,0,float(width),float(height)};
|
||||||
}
|
}
|
||||||
|
|
||||||
void resizeSystemTexture(const uint16_t width, const uint16_t height)
|
void resizeSystemTexture(const uint16_t width, const uint16_t height)
|
||||||
{
|
{
|
||||||
SDL_DestroyTexture(sdl_texture);
|
SDL_DestroyTexture(sdl_texture);
|
||||||
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, width, height);
|
sdl_texture = SDL_CreateTexture(sdl_renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_TARGET, width, height);
|
||||||
|
window_rect = {0,0,float(width),float(height)};
|
||||||
}
|
}
|
||||||
|
|
||||||
void quit()
|
void quit()
|
||||||
@@ -199,7 +209,7 @@ namespace draw
|
|||||||
void render()
|
void render()
|
||||||
{
|
{
|
||||||
SDL_SetRenderTarget(sdl_renderer, nullptr);
|
SDL_SetRenderTarget(sdl_renderer, nullptr);
|
||||||
SDL_RenderTexture(sdl_renderer, sdl_texture, nullptr, nullptr);
|
SDL_RenderTexture(sdl_renderer, sdl_texture, &window_rect, &window_rect);
|
||||||
SDL_RenderPresent(sdl_renderer);
|
SDL_RenderPresent(sdl_renderer);
|
||||||
SDL_SetRenderTarget(sdl_renderer, sdl_texture);
|
SDL_SetRenderTarget(sdl_renderer, sdl_texture);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -50,14 +50,14 @@ void game::init()
|
|||||||
draw::init("DILEMMAKER v0.1", 800, 600);
|
draw::init("DILEMMAKER v0.1", 800, 600);
|
||||||
game::setState(loop);
|
game::setState(loop);
|
||||||
font::load("font/8bithud");
|
font::load("font/8bithud");
|
||||||
draw::cls(0x00000000);
|
draw::cls(0xffff0000);
|
||||||
tilemap::init();
|
tilemap::init();
|
||||||
|
|
||||||
std::vector<std::string> room_names;
|
std::vector<std::string> room_names;
|
||||||
|
|
||||||
for (const auto& entry : fs::directory_iterator("./data/room")) {
|
for (const auto& entry : fs::directory_iterator("./data/room")) {
|
||||||
if (entry.is_regular_file() && entry.path().extension() == ".yaml") {
|
if (entry.is_regular_file() && entry.path().extension() == ".yaml") {
|
||||||
room_names.emplace_back(entry.path().stem());
|
room_names.emplace_back(entry.path().stem().string());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::sort(room_names.begin(), room_names.end(), [](const fs::path& a, const fs::path& b) {
|
std::sort(room_names.begin(), room_names.end(), [](const fs::path& a, const fs::path& b) {
|
||||||
|
|||||||
Reference in New Issue
Block a user