16 lines
570 B
C
16 lines
570 B
C
#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);
|
|
}
|