Scaller
This commit is contained in:
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user