From 1365020302a77b592bc61af6df1eb0f928089762 Mon Sep 17 00:00:00 2001 From: mittorn Date: Mon, 4 Nov 2019 20:27:46 +0700 Subject: [PATCH] ref: add enum for screen rotation --- engine/platform/android/vid_android.c | 3 ++- engine/platform/linux/vid_fbdev.c | 4 +++- engine/ref_api.h | 10 +++++++++- ref_gl/gl_context.c | 2 +- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/engine/platform/android/vid_android.c b/engine/platform/android/vid_android.c index 6746f237..65904097 100644 --- a/engine/platform/android/vid_android.c +++ b/engine/platform/android/vid_android.c @@ -332,7 +332,8 @@ rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen ) Android_GetScreenRes(&width, &height); - render_w = width, render_h = height; + render_w = width; + render_h = height; Con_Reportf( "R_ChangeDisplaySettings: forced resolution to %dx%d)\n", width, height); diff --git a/engine/platform/linux/vid_fbdev.c b/engine/platform/linux/vid_fbdev.c index f9915db7..065a211c 100644 --- a/engine/platform/linux/vid_fbdev.c +++ b/engine/platform/linux/vid_fbdev.c @@ -125,7 +125,9 @@ rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen ) uint rotate = vid_rotate->value; FB_GetScreenRes( &width, &height ); - render_w = width, render_h = height; + + render_w = width; + render_h = height; Con_Reportf( "R_ChangeDisplaySettings: forced resolution to %dx%d)\n", width, height ); diff --git a/engine/ref_api.h b/engine/ref_api.h index 2566c2fb..09e5321d 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -212,6 +212,14 @@ enum REF_GL_CONTEXT_RESET_ISOLATION_FLAG = 0x0008 }; +typedef enum ref_screen_rotation_e +{ + REF_ROTATE_NONE = 0, + REF_ROTATE_CW = 1, + REF_ROTATE_UD = 2, + REF_ROTATE_CCW = 3, +} ref_screen_rotation_t; + typedef struct remap_info_s { unsigned short textures[MAX_SKINS];// alias textures @@ -436,7 +444,7 @@ typedef struct ref_interface_s // const char *(*R_GetInitError)( void ); void (*R_Shutdown)( void ); const char *(*R_GetConfigName)( void ); // returns config name without extension - qboolean (*R_SetDisplayTransform)( uint rotate, int x, int y, float scale_x, float scale_y ); + qboolean (*R_SetDisplayTransform)( ref_screen_rotation_t rotate, int x, int y, float scale_x, float scale_y ); // only called for GL contexts void (*GL_SetupAttributes)( int safegl ); diff --git a/ref_gl/gl_context.c b/ref_gl/gl_context.c index 66d1eaec..e356f7fd 100644 --- a/ref_gl/gl_context.c +++ b/ref_gl/gl_context.c @@ -308,7 +308,7 @@ void R_ProcessEntData( qboolean allocate ) gEngfuncs.drawFuncs->R_ProcessEntData( allocate ); } -qboolean R_SetDisplayTransform( uint rotate, int offset_x, int offset_y, float scale_x, float scale_y ) +qboolean R_SetDisplayTransform( ref_screen_rotation_t rotate, int offset_x, int offset_y, float scale_x, float scale_y ) { qboolean ret = true; if( rotate > 0 )