Initial GLFW support

This commit is contained in:
eray orçunus
2020-04-26 13:25:03 +03:00
parent ea79cc4469
commit 6c1a1f7cd2
21 changed files with 1983 additions and 83 deletions

View File

@ -1,5 +1,61 @@
#include <time.h>
// This is the common include for platform/renderer specific skeletons(glfw, win etc.) and cross platform things (like Windows directories wrapper, platform specific global arrays etc.)
// This only has <windef.h> as Win header.
#ifdef _WIN32
#include "win.h"
#endif
#ifdef RW_GL3
typedef struct
{
GLFWwindow* window;
RwBool fullScreen;
RwV2d lastMousePos;
double mouseWheel; // glfw doesn't cache it
int8 joy1id;
int8 joy2id;
}
psGlobalType;
#define PSGLOBAL(var) (((psGlobalType *)(RsGlobal.ps))->var)
void CapturePad(RwInt32 padID);
void joysChangeCB(int jid, int event);
#endif
enum eGameState
{
GS_START_UP = 0,
GS_INIT_LOGO_MPEG,
GS_LOGO_MPEG,
GS_INIT_INTRO_MPEG,
GS_INTRO_MPEG,
GS_INIT_ONCE,
GS_INIT_FRONTEND,
GS_FRONTEND,
GS_INIT_PLAYING_GAME,
GS_PLAYING_GAME,
#ifndef MASTER
GS_ANIMVIEWER,
#endif
};
extern RwUInt32 gGameState;
RwBool IsForegroundApp();
void InitialiseLanguage();
RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode);
RwChar** _psGetVideoModeList();
RwInt32 _psGetNumVideModes();
void _psSelectScreenVM(RwInt32 videoMode);
void HandleExit();
void _InputTranslateShiftKeyUpDown(RsKeyCodes* rs);
// Mostly wrappers around Windows functions
#ifndef MAX_PATH
#if !defined _WIN32 || defined __MINGW32__
#define MAX_PATH PATH_MAX
@ -8,8 +64,6 @@
#endif
#endif
// Mostly wrappers around Windows functions
// TODO: Remove USEALTERNATIVEWINFUNCS and don't use it anywhere when re3 becomes fully cross-platform, this is for testing
// Codes compatible with Windows and Linux
#if defined USEALTERNATIVEWINFUNCS || !defined _WIN32 || defined __MINGW32__
@ -27,18 +81,13 @@ struct SYSTEMTIME {
uint16 wMilliseconds;
};
#define GetLocalTime GetLocalTime_CP
#else
#include <Windows.h>
#endif
void GetLocalTime_CP(SYSTEMTIME* out);
#define GetLocalTime GetLocalTime_CP
#define OutputDebugString(s) re3_debug("[DBG-2]: " s "\n")
#endif
// Only runs on GNU/POSIX/etc.
#if !defined _WIN32 || defined __MINGW32__
#define OutputDebugString(s) re3_debug("[DBG-2]: " s "\n")
#include <iostream>
#include <dirent.h>
#include <sys/types.h>

View File

@ -1,13 +1,14 @@
#include "rwcore.h"
#include "skeleton.h"
#include "events.h"
#include "common.h"
#include "Pad.h"
#include "ControllerConfig.h"
#include "Frontend.h"
#include "Camera.h"
#include "rwcore.h"
#include "skeleton.h"
#include "events.h"
/*
*****************************************************************************
*/

1651
src/skel/glfw/glfw.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -293,7 +293,7 @@ RwBool
RsRwInitialise(void *displayID)
{
RwEngineOpenParams openParams;
/*
* Start RenderWare...
*/

View File

@ -1,3 +1,5 @@
#if defined RW_D3D9 || defined RWLIBS
#define _WIN32_WINDOWS 0x0500
#define WINVER 0x0500
#define DIRECTINPUT_VERSION 0x0800
@ -40,7 +42,7 @@
#include "resource.h"
#include "skeleton.h"
#include "platform.h"
#include "win.h"
#include "crossplatform.h"
#define MAX_SUBSYSTEMS (16)
@ -3033,3 +3035,4 @@ int strcasecmp(const char *str1, const char *str2)
return _strcmpi(str1, str2);
}
#endif
#endif

View File

@ -1,3 +1,6 @@
// DON'T include directly. crossplatform.h includes this if you're on Windows.
#if (!defined(_PLATFORM_WIN_H))
#define _PLATFORM_WIN_H
@ -10,23 +13,6 @@
#include <windef.h>
#endif
enum eGameState
{
GS_START_UP = 0,
GS_INIT_LOGO_MPEG,
GS_LOGO_MPEG,
GS_INIT_INTRO_MPEG,
GS_INTRO_MPEG,
GS_INIT_ONCE,
GS_INIT_FRONTEND,
GS_FRONTEND,
GS_INIT_PLAYING_GAME,
GS_PLAYING_GAME,
#ifndef MASTER
GS_ANIMVIEWER,
#endif
};
enum eWinVersion
{
OS_WIN95 = 0,
@ -38,8 +24,6 @@ enum eWinVersion
extern DWORD _dwOperatingSystemVersion;
extern RwUInt32 gGameState;
#ifdef __DINPUT_INCLUDED__
/* platform specfic global data */
typedef struct
@ -101,12 +85,10 @@ extern "C"
{
#endif /* __cplusplus */
#ifdef __DINPUT_INCLUDED__
extern LRESULT CALLBACK
MainWndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam);
RwBool IsForegroundApp();
#ifdef __DINPUT_INCLUDED__
HRESULT _InputInitialise();
HRESULT _InputInitialiseMouse();
HRESULT CapturePad(RwInt32 padID);
@ -117,26 +99,15 @@ HRESULT _InputGetMouseState(DIMOUSESTATE2 *state);
void _InputShutdown();
BOOL CALLBACK _InputEnumDevicesCallback( const DIDEVICEINSTANCE* pdidInstance, VOID* pContext );
BOOL _InputTranslateKey(RsKeyCodes *rs, UINT flag, UINT key);
void _InputTranslateShiftKeyUpDown(RsKeyCodes *rs);;
BOOL _InputTranslateShiftKey(RsKeyCodes *rs, UINT key, BOOLEAN bDown);
BOOL _InputIsExtended(INT flag);
#endif
void InitialiseLanguage();
RwBool _psSetVideoMode(RwInt32 subSystem, RwInt32 videoMode);
void CenterVideo(void);
void CloseClip(void);
RwChar **_psGetVideoModeList();
RwInt32 _psGetNumVideModes();
void _psSelectScreenVM(RwInt32 videoMode);
void HandleExit();
#ifdef __cplusplus
}
#endif /* __cplusplus */
extern DWORD _dwOperatingSystemVersion;
#endif /* (!defined(_PLATFORM_WIN_H)) */