Merge pull request #432 from Azaezel/alpha40/sdlwebGeneralization

sdl usage standards proposal 3
This commit is contained in:
Brian Roberts 2021-01-02 11:09:52 -06:00 committed by GitHub
commit a0ba345095
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 41 additions and 3 deletions

View file

@ -132,6 +132,7 @@ void Platform::outputDebugString( const char *string, ... )
fflush(stderr); fflush(stderr);
#endif #endif
} }
#ifndef TORQUE_SDL
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool Platform::openWebBrowser( const char* webAddress ) bool Platform::openWebBrowser( const char* webAddress )
{ {
@ -142,7 +143,7 @@ bool Platform::openWebBrowser( const char* webAddress )
return(err==noErr); return(err==noErr);
} }
#endif
#pragma mark ---- Administrator ---- #pragma mark ---- Administrator ----
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
bool Platform::getUserIsAdministrator() bool Platform::getUserIsAdministrator()

View file

@ -0,0 +1,30 @@
//-----------------------------------------------------------------------------
// Copyright (c) 2012 GarageGames, LLC
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
// deal in the Software without restriction, including without limitation the
// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
//-----------------------------------------------------------------------------
#include "platform/platform.h"
/// Spawn the User default web browser with a URL
/// @param webAddress URL to pass to browser
/// @return true if browser successfully spawned
bool Platform::openWebBrowser(const char* webAddress)
{
return !SDL_OpenURL(webAddress);
}

View file

@ -511,6 +511,7 @@ F32 Platform::getRandom()
return sgPlatRandom.randF(); return sgPlatRandom.randF();
} }
#ifndef TORQUE_SDL
////-------------------------------------- ////--------------------------------------
/// Spawn the default Operating System web browser with a URL /// Spawn the default Operating System web browser with a URL
/// @param webAddress URL to pass to browser /// @param webAddress URL to pass to browser
@ -585,6 +586,7 @@ bool Platform::openWebBrowser( const char* webAddress )
return( true ); return( true );
} }
#endif
//-------------------------------------- //--------------------------------------
// Login password routines: // Login password routines:

View file

@ -1,5 +1,5 @@
#include "platform/platform.h" #include "platform/platform.h"
#ifndef TORQUE_SDL
bool Platform::openWebBrowser(const char* webAddress) bool Platform::openWebBrowser(const char* webAddress)
{ {
String startingURL(webAddress); String startingURL(webAddress);
@ -23,7 +23,7 @@ bool Platform::openWebBrowser(const char* webAddress)
return false; return false;
} }
#endif
#ifdef TORQUE_DEDICATED #ifdef TORQUE_DEDICATED
// XA: New class for the unix unicode font // XA: New class for the unix unicode font
class PlatformFont; class PlatformFont;

View file

@ -197,3 +197,8 @@
#else #else
# define TORQUE_INSTANCE_EXCLUSION "TorqueTest" # define TORQUE_INSTANCE_EXCLUSION "TorqueTest"
#endif #endif
//use sdl backend?
#if defined(TORQUE_SDL)
#include <SDL.h>
#endif