Skip to content

Commit

Permalink
Merge pull request #130 from caiiiycuk/html5
Browse files Browse the repository at this point in the history
gpx-release 3.1.0
  • Loading branch information
IonAgorria committed Apr 24, 2024
2 parents ec2f36a + ac0e14f commit fad4fce
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 14 deletions.
15 changes: 10 additions & 5 deletions Source/Game/Runtime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@
#include "GraphicsOptions.h"
#include "GameContent.h"

#ifdef GPX
extern void pollGpxEvents();
#endif

const char* currentShortVersion = PERIMETER_VERSION;

const char* currentVersion =
Expand Down Expand Up @@ -590,14 +594,12 @@ cInterfaceRenderDevice* SetGraph()
terScreenSizeX = gpx()->sys()->getWidth();
terScreenSizeY = gpx()->sys()->getHeight();
#ifdef EMSCRIPTEN
SDL_DisplayMode dm;
SDL_GetCurrentDisplayMode(0, &dm);
auto minHeight = min(dm.h, 960);
float minHeight = 600;
if (terScreenSizeY < minHeight) {
terScreenSizeY = minHeight;
terScreenSizeX = (float) minHeight * gpx()->sys()->getWidth() / gpx()->sys()->getHeight();
terScreenSizeX = minHeight * gpx()->sys()->getWidth() / gpx()->sys()->getHeight();
}
printf("Display size: %dx%d, screen height %d, min height %d\n", terScreenSizeX, terScreenSizeY, dm.h, minHeight);
printf("Display size: %dx%d\n", terScreenSizeX, terScreenSizeY);
#endif
int ModeRender = RENDERDEVICE_MODE_RGB32 | RENDERDEVICE_MODE_WINDOW;
#else
Expand Down Expand Up @@ -1186,6 +1188,9 @@ void app_event_poll() {
//Iterate each SDL event that we may have queued since last poll
SDL_Event event;
bool closing = false;
#ifdef GPX
pollGpxEvents();
#endif
while (SDL_PollEvent(&event) == 1) {
if (sdlWindow && event.window.windowID && event.window.windowID != windowID) {
//Event is for a window that is not current or window is not available
Expand Down
3 changes: 2 additions & 1 deletion Source/Network/P2P_interface1Th.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const char* PNetCenter::getStrState() const
PNetCenter::PNetCenter() :
in_ClientBuf(PNETCENTER_BUFFER_SIZE, true), out_ClientBuf(PNETCENTER_BUFFER_SIZE, true),
in_HostBuf(PNETCENTER_BUFFER_SIZE, true), out_HostBuf(PNETCENTER_BUFFER_SIZE, true),
connectionHandler(this)
connectionHandler(this),
flag_connected(false)
{
hostConnection=NetAddress();

Expand Down
2 changes: 1 addition & 1 deletion Source/Render/src/RenderDeviceDraw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ void cInterfaceRenderDevice::OutText(int x,int y,const char *string,const sColor
// 2D primitives

float cInterfaceRenderDevice::getThinLineWidth() const {
return static_cast<float>(ScreenSize.y * (1.0 / 768.0) / 2.0);
return static_cast<float>(max(600, ScreenSize.y) * (1.0 / 600.0) / 2.0);
}

void cInterfaceRenderDevice::DrawLine(int x1,int y1,int x2,int y2,const sColor4c& color, float width) {
Expand Down
6 changes: 6 additions & 0 deletions Source/UserInterface/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -743,6 +743,12 @@ int SwitchMenuBGQuant2( float, float ) {
case SQSH_MM_SINGLE_SCR:
//Only enable if user didn't choose a specific content
_shellIconManager.GetWnd(SQSH_MM_BATTLE_BTN)->Enable(terGameContentAvailable == terGameContentSelect);
#ifdef EMSCRIPTEN
_shellIconManager.GetWnd(SQSH_MM_BACK_FROM_SINGLE_BTN)->Enable(false);
#endif
#ifdef GPX
_shellIconManager.GetWnd(SQSH_MM_CONTENT_CHOOSER_BTN)->Enable(false);
#endif
if (!debug_allow_replay) {
_shellIconManager.GetWnd(SQSH_MM_REPLAY_LINE)->Show(0);
_shellIconManager.GetWnd(SQSH_MM_REPLAY_BORDER)->Show(0);
Expand Down
2 changes: 1 addition & 1 deletion Source/UserInterface/PerimeterShellUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#include "codepages/codepages.h"

#ifdef GPX
const static float TOP_LEFT_SCALE = 1.5f;
extern float TOP_LEFT_SCALE;
#else
const static float TOP_LEFT_SCALE = 1.1f;
#endif
Expand Down
6 changes: 3 additions & 3 deletions Source/XTool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ ENDIF ()

#GameMath retrieval
FetchContent_Declare(gamemath
GIT_REPOSITORY https://github.com/TheAssemblyArmada/GameMath
GIT_TAG "59f7ccd494f7e7c916a784ac26ef266f9f09d78d"
GIT_SHALLOW OFF
GIT_REPOSITORY https://github.com/caiiiycuk/perimeter-gamemath
GIT_TAG "155ab00471b10b0a1e19c18588e6ccf9a356cb8a"
GIT_SHALLOW OFF
)
FetchContent_MakeAvailable(gamemath)

Expand Down
2 changes: 0 additions & 2 deletions Source/XTool/xmath.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ const int INT_INF = 0x7fffffff;
// give different result and cause desync on multiplayer
///////////////////////////////////////////////////////////////////////////////

#ifndef GPX
//Use gamemath instead of stdlib
#define XMATH_USE_GAMEMATH
#endif

namespace xm {
//Math functions
Expand Down
2 changes: 1 addition & 1 deletion docker/linux/prepare_pkgs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

# Add backports to sources and update
echo "deb http://deb.debian.org/debian buster-backports main" >> /etc/apt/sources.list
echo "deb http://archive.debian.org/debian buster-backports main" >> /etc/apt/sources.list
apt-get update

#Backport git version doesn't work properly
Expand Down

0 comments on commit fad4fce

Please sign in to comment.