Skip to content

Commit

Permalink
fix: browser compiling after UIGraph and import changes (#1046)
Browse files Browse the repository at this point in the history
* browser support

* CMake: WASM should be tested and else left for Linux as before

* Remove conflicting vcpkg.json files

* Use existing base64 encoder

* Check for emscripten before includes and declarations

* Improve CMakeLists

* Fix case-sensitivity issues

* Implement bitlib and restore original .lua files bit operations

* Support older protocols and improvements

* Set correct numpad keys

* Intercept all browser keys

* Allow pasting and writing symbols with shift

* Improve networking
No need to reinvent the wheel

* Reload page on client exit

* Reduce CPU usage and connection improvements
Drop g_ioService to avoid doing work during polling and make the thread sleep a bit if no message ready

* Disable Emscripten's text decoder
emscripten-core/emscripten#18034

* Basic mobile support
- Handle touch events and longpress for right click
- Check user agent to determine isMobile
- Use VirtualKeyboardAPI to show keyboard (iOS not supported https://developer.mozilla.org/en-US/docs/Web/API/VirtualKeyboard_API)

* Improve performance
Drop manually swapping buffers to reduce CPU overhead

* Case insensitive FS and properly return if websocket fails to be created

* Fix Vorbis Linking (7cd3c82)

* Allow gameWorld port to be set without rebuilding
As servers and login servers are not adapted to send correct information when using the web client, it's necessary to override the world port and ip address that is received.
Before, the world port was being forced to what was defined in the WEBPORT variable, not matter what port was informed when connect() was called. Now, you can override the port using lua (characterlist.lua) and avoid rebuilding the client.
OBS: Port 7172 will still be overriden to 443 by the client.

* Remove unused definition

* Remove '&'
#894 (comment)

* Remove swapBuffers call, we no longer use it
3c6bc5a

* Properly encode json
#894 (comment)

* Update src/framework/net/webconnection.cpp

Co-authored-by: divinity76 <[email protected]>

* Update src/framework/net/webconnection.cpp

Co-authored-by: divinity76 <[email protected]>

* Update src/framework/net/webconnection.cpp

Co-authored-by: divinity76 <[email protected]>

* Update src/framework/platform/browserplatform.cpp

Co-authored-by: divinity76 <[email protected]>

* Update src/framework/platform/browserplatform.cpp

Co-authored-by: divinity76 <[email protected]>

* Update src/framework/platform/browserplatform.cpp

Co-authored-by: divinity76 <[email protected]>

* Update src/framework/platform/browserplatform.cpp

Co-authored-by: divinity76 <[email protected]>

* c++17 remove file

* Recommended improvements
#894 (comment)
#894 (comment)
#894 (comment)
#894 (comment)

* Remove uneeded link libs

* remove regex

* Cleanup shell.html

* Make compiling easier
- We can now use vcpkg.json with an adapted cmake command
(check guide)
- Update overlay-ports to the current baseline

* Add baseline to overlay-ports vcpkg.json files

* Workflows: ignore overlay-ports vcpkg.json

* Bot V8 basic fixes
Adapt load() calls to lua 5.1

* Disable UIGraph while the browser building issue is not found

* Fix broken regex

* Fix broken regex

* Fix compiling after include changes

---------

Co-authored-by: Ivan Clementino <[email protected]>
Co-authored-by: Renato Machado <[email protected]>
Co-authored-by: Rodrigo Paixão <[email protected]>
Co-authored-by: Luan Luciano <[email protected]>
Co-authored-by: divinity76 <[email protected]>
  • Loading branch information
6 people authored Jan 15, 2025
1 parent 262d238 commit 28ecde8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/client/luafunctions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,7 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<UIProgressRect>("setPercent", &UIProgressRect::setPercent);
g_lua.bindClassMemberFunction<UIProgressRect>("getPercent", &UIProgressRect::getPercent);

#ifndef __EMSCRIPTEN__
g_lua.registerClass<UIGraph, UIWidget>();
g_lua.bindClassStaticFunction<UIGraph>("create", [] { return std::make_shared<UIGraph>(); });
g_lua.bindClassMemberFunction<UIGraph>("clear", &UIGraph::clear);
Expand All @@ -1074,6 +1075,7 @@ void Client::registerLuaFunctions()
g_lua.bindClassMemberFunction<UIGraph>("setInfoLineColor", &UIGraph::setInfoLineColor);
g_lua.bindClassMemberFunction<UIGraph>("setTextBackground", &UIGraph::setTextBackground);
g_lua.bindClassMemberFunction<UIGraph>("setGraphVisible", &UIGraph::setGraphVisible);
#endif

g_lua.registerClass<UIMapAnchorLayout, UIAnchorLayout>();
}
1 change: 1 addition & 0 deletions src/framework/platform/browserwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include <framework/core/eventdispatcher.h>
#include <framework/core/resourcemanager.h>
#include <framework/util/crypt.h>
#include "framework/core/graphicalapplication.h"

BrowserWindow& g_browserWindow = (BrowserWindow&)g_window;

Expand Down
2 changes: 1 addition & 1 deletion src/framework/platform/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class Platform
return m_device.type == Mobile;
#else
return MAIN_THREAD_EM_ASM_INT({
return (/ iphone | ipod | ipad | android / i).test(navigator.userAgent);
return (/iphone|ipod|ipad|android/i).test(navigator.userAgent);
}) == 1;
#endif
}
Expand Down

0 comments on commit 28ecde8

Please sign in to comment.