From 25f07ddb97552cc7576c2cb7354770eb894e5904 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Sun, 21 Oct 2018 23:52:14 +0300 Subject: [PATCH] platform: introduce common header for platform-dependent functions. To keep clean code and engine platform-agnostic, now including headers from platform folder, except this one, is strictly prohibited. --- engine/platform/platform.h | 71 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 engine/platform/platform.h diff --git a/engine/platform/platform.h b/engine/platform/platform.h new file mode 100644 index 00000000..dd81ca8a --- /dev/null +++ b/engine/platform/platform.h @@ -0,0 +1,71 @@ +/* +platform.h - common platform-dependent function defines +Copyright (C) 2018 a1batross + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. +*/ + +#pragma once +#ifndef PLATFORM_H +#define PLATFORM_H + +/* +============================================================================== + + MOBILE API + +============================================================================== +*/ +void Platform_Vibrate( float life, char flags ); + +/* +============================================================================== + + INPUT + +============================================================================== +*/ +// Gamepad support +int Platform_JoyInit( int numjoy ); // returns number of connected gamepads, negative if error +// Text input +void Platform_EnableTextInput( qboolean enable ); +// System events +void Platform_RunEvents( void ); + +/* +============================================================================== + + WINDOW MANAGEMENT + +============================================================================== +*/ +typedef enum +{ + rserr_ok, + rserr_invalid_fullscreen, + rserr_invalid_mode, + rserr_unknown +} rserr_t; + +typedef struct vidmode_s vidmode_t; + +// Window +qboolean R_Init_Video( void ); +void R_Free_Video( void ); +qboolean VID_SetMode( void ); +rserr_t R_ChangeDisplaySettings( int width, int height, qboolean fullscreen ); +int R_MaxVideoModes(); +vidmode_t*R_GetVideoMode( int num ); +void* GL_GetProcAddress( const char *name ); // RenderAPI requirement + + + +#endif // PLATFORM_H