This commit is contained in:
Marc
2023-01-21 12:55:27 +01:00
parent 7af164dd20
commit 781f4ba7be
8 changed files with 64 additions and 38 deletions
+15
View File
@@ -0,0 +1,15 @@
#include "renderer.h"
#include <SDL2/SDL_surface.h>
#include "scaller.h"
void scaller(SDL_Surface * surface, float scale, float * width, float * height) {
MonitorSize_t size = renderer_getMonitorSize();
*width = (float)surface->w / size.width * scale;
*height = (float)surface->h / size.height * scale;
}
void placer(SDL_Surface * surface, float scale, float * x, float * y) {
MonitorSize_t size = renderer_getMonitorSize();
*x = *x - scale * surface->w / (2.f * (float)size.width);
*y = *y - scale * surface->h / (2.f * (float)size.height);
}