Merge pull request #438 from s4Ys369/revert-434-patch-1
[sm64pc.git] / include / gfx_dimensions.h
blobf3a5ee238da4371c50fefcb9534ba4dc60e5927a
1 #ifndef GFX_DIMENSIONS_H
2 #define GFX_DIMENSIONS_H
4 #include <math.h>
5 #include "pc/gfx/gfx_pc.h"
6 #define GFX_DIMENSIONS_FROM_LEFT_EDGE(v) (SCREEN_WIDTH / 2 - SCREEN_HEIGHT / 2 * gfx_current_dimensions.aspect_ratio + (v))
7 #define GFX_DIMENSIONS_FROM_RIGHT_EDGE(v) (SCREEN_WIDTH / 2 + SCREEN_HEIGHT / 2 * gfx_current_dimensions.aspect_ratio - (v))
8 #define GFX_DIMENSIONS_RECT_FROM_LEFT_EDGE(v) ((int)floorf(GFX_DIMENSIONS_FROM_LEFT_EDGE(v)))
9 #define GFX_DIMENSIONS_RECT_FROM_RIGHT_EDGE(v) ((int)ceilf(GFX_DIMENSIONS_FROM_RIGHT_EDGE(v)))
10 #define GFX_DIMENSIONS_ASPECT_RATIO (gfx_current_dimensions.aspect_ratio)
12 #endif