diff --git a/Source/SysGL/Graphics/DrawTextSDL.cpp b/Source/SysGL/Graphics/DrawTextSDL.cpp index 2a37b1b53..0d8a170dc 100644 --- a/Source/SysGL/Graphics/DrawTextSDL.cpp +++ b/Source/SysGL/Graphics/DrawTextSDL.cpp @@ -49,7 +49,7 @@ u32 CDrawText::Render(EFont font_type, s32 x, s32 y, float scale, const char *p_ { SDL_Color c {colour.GetR(), colour.GetG(), colour.GetB()}; SDL_Color dc {drop_colour.GetR(), drop_colour.GetG(), drop_colour.GetB()}; - SDL_Surface *surface = TTF_RenderUTF8_Shaded(font, p_str, c, dc); + SDL_Surface *surface = TTF_RenderUTF8_Blended(font, p_str, c); SDL_Texture* Message = SDL_CreateTextureFromSurface(gSdlRenderer, surface); SDL_Rect Message_rect; //create a rect diff --git a/Source/SysGL/Graphics/GraphicsContextGL.cpp b/Source/SysGL/Graphics/GraphicsContextGL.cpp index afde92c73..471445951 100644 --- a/Source/SysGL/Graphics/GraphicsContextGL.cpp +++ b/Source/SysGL/Graphics/GraphicsContextGL.cpp @@ -85,15 +85,7 @@ bool GraphicsContextGL::Initialise() return false; } - // Decide GL+GLSL versions -#if defined(IMGUI_IMPL_OPENGL_ES2) - // GL ES 2.0 + GLSL 100 - const char* glsl_version = "#version 100"; - SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 0); -#elif defined(__APPLE__) +#if defined(__APPLE__) // GL 3.2 Core + GLSL 150 const char* glsl_version = "#version 150"; SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_FORWARD_COMPATIBLE_FLAG); // Always required on Mac @@ -101,16 +93,12 @@ bool GraphicsContextGL::Initialise() SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); #else - // GL 3.0 + GLSL 130 - const char* glsl_version = "#version 130"; + // Simplified context creation SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, 0); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3); - SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 3); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 2); + SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 1); #endif - // SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 3 ); - // SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 3 ); - // SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE ); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); @@ -225,10 +213,11 @@ void GraphicsContextGL::UpdateFrame( bool wait_for_vbl ) { glBindFramebuffer(GL_FRAMEBUFFER, 0); + if (gSdlRenderer == nullptr) { SDL_GL_SwapWindow(gWindow); } - + // if( gCleanSceneEnabled ) //TODO: This should be optional // { // ClearColBuffer( c32(0xff000000) ); // ToDo : Use gFillColor instead? diff --git a/Source/SysGL/Input/InputManagerGL.cpp b/Source/SysGL/Input/InputManagerGL.cpp index 2a3276ff5..9983c776d 100644 --- a/Source/SysGL/Input/InputManagerGL.cpp +++ b/Source/SysGL/Input/InputManagerGL.cpp @@ -32,78 +32,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include SDL_GameController *controller; -//Windows Xinput support -#ifdef DAEDALUS_W32 - -#include -#include - -class CXBOXController -{ -private: - XINPUT_STATE _controllerState; - int _controllerNum; -public: - CXBOXController(int playerNumber); - XINPUT_STATE GetState(); - bool IsConnected(); - void Vibrate(int leftVal = 0, int rightVal = 0); -}; - -CXBOXController::CXBOXController(int playerNumber) -{ - // Set the Controller Number - _controllerNum = playerNumber - 1; -} - -XINPUT_STATE CXBOXController::GetState() -{ - // Zeroise the state - ZeroMemory(&_controllerState, sizeof(XINPUT_STATE)); - - // Get the state - XInputGetState(_controllerNum, &_controllerState); - - return _controllerState; -} - -bool CXBOXController::IsConnected() -{ - // Zeroise the state - ZeroMemory(&_controllerState, sizeof(XINPUT_STATE)); - - // Get the state - DWORD Result = XInputGetState(_controllerNum, &_controllerState); - - if (Result == ERROR_SUCCESS) - { - return true; - } - else - { - return false; - } -} - -void CXBOXController::Vibrate(int leftVal, int rightVal) -{ - // Create a Vibraton State - XINPUT_VIBRATION Vibration; - - // Zeroise the Vibration - ZeroMemory(&Vibration, sizeof(XINPUT_VIBRATION)); - - // Set the Vibration Values - Vibration.wLeftMotorSpeed = leftVal; - Vibration.wRightMotorSpeed = rightVal; - - // Vibrate the controller - XInputSetState(_controllerNum, &Vibration); -} - -#endif - - class IInputManager : public CInputManager { public: @@ -128,15 +56,6 @@ class IInputManager : public CInputManager bool mGamePadAvailable; //SDL_GameController *controller; -#ifdef DAEDALUS_W32 - - CXBOXController* Player1; - CXBOXController* Player2; - CXBOXController* Player3; - CXBOXController* Player4; - -#endif - }; IInputManager::~IInputManager() @@ -168,16 +87,6 @@ static void CheckPadStatusVblHandler( void * arg ) bool IInputManager::Initialise() { -#ifdef DAEDALUS_W32 - Player1 = new CXBOXController(1); - if (Player1->IsConnected()){ - std::cout << "Xinput device detected! "; - } - else{ - std::cout << "Xinput device not detected!"; - } -#endif - //Init Joystick / Gamepad CPU_RegisterVblCallback( &CheckPadStatusVblHandler, this ); @@ -288,6 +197,13 @@ void IInputManager::GetState( OSContPad pPad[4] ) { const u8* keys = SDL_GetKeyboardState( NULL ); + // Override the keyboard with the gamepad if it's available. + //if(mGamePadAvailable) + //{ + GetJoyPad(&pPad[0]); + //} + + if (keys [ SDL_SCANCODE_UP ] ) {pPad[0].stick_y = +80;} if (keys [ SDL_SCANCODE_DOWN ] ) {pPad[0].stick_y = -80;} if (keys [ SDL_SCANCODE_LEFT ] ) {pPad[0].stick_x = -80;} @@ -313,42 +229,7 @@ void IInputManager::GetState( OSContPad pPad[4] ) if (keys [ SDL_SCANCODE_PAGEDOWN ] ){ pPad[0].button |= R_CBUTTONS;} } -#ifdef DAEDALUS_W32 - if (Player1->IsConnected()) - { -#define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849 -#define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689 - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_A){ pPad[0].button |= A_BUTTON;} - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_B){ pPad[0].button |= B_BUTTON;} - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_START) { pPad[0].button |= START_BUTTON; } - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_LEFT_SHOULDER) { pPad[0].button |= L_TRIG; } - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_RIGHT_SHOULDER) { pPad[0].button |= R_TRIG; } - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_LEFT) { pPad[0].button |= L_JPAD; } - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_RIGHT) { pPad[0].button |= R_JPAD; } - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_UP) { pPad[0].button |= U_JPAD; } - if (Player1->GetState().Gamepad.wButtons & XINPUT_GAMEPAD_DPAD_DOWN) { pPad[0].button |= D_JPAD; } - - if (Player1->GetState().Gamepad.bLeftTrigger > 30) { pPad[0].button |= Z_TRIG; } - if (Player1->GetState().Gamepad.bRightTrigger > 30 ) { pPad[0].button |= Z_TRIG; } - - pPad[0].stick_x = s8(Player1->GetState().Gamepad.sThumbLX / 500); - pPad[0].stick_y = s8(Player1->GetState().Gamepad.sThumbLY / 500); - - //Xinput Righstick to C buttons - if (s8(Player1->GetState().Gamepad.sThumbRX / 500 ) < -40) pPad[0].button |= L_CBUTTONS; - if (s8(Player1->GetState().Gamepad.sThumbRX / 500 ) > 40) pPad[0].button |= R_CBUTTONS; - if (s8(Player1->GetState().Gamepad.sThumbRY / 500 ) < -40) pPad[0].button |= D_CBUTTONS; - if (s8(Player1->GetState().Gamepad.sThumbRY / 500 ) > 40) pPad[0].button |= U_CBUTTONS; - - } -#endif - - // Override the keyboard with the gamepad if it's available. - //if(mGamePadAvailable) - //{ - GetJoyPad(&pPad[0]); - //} }