Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3094fc6112 | ||
|
|
9e6ff5e08f | ||
|
|
24526efb8d | ||
|
|
e5d7885a12 | ||
|
|
d151d4bfaf | ||
|
|
147aa266d5 | ||
|
|
2884865b53 | ||
|
|
a1a7f714d9 | ||
|
|
03323638e1 | ||
|
|
bd17d0ff9e |
@ -323,7 +323,7 @@ set(_have_freetype TRUE)
|
|||||||
foreach(cfg IN LISTS BUILD_CONFIGS)
|
foreach(cfg IN LISTS BUILD_CONFIGS)
|
||||||
if(NOT EXISTS "${FREETYPE_BASE_DIR}-${cfg}/lib/freetype.lib" AND
|
if(NOT EXISTS "${FREETYPE_BASE_DIR}-${cfg}/lib/freetype.lib" AND
|
||||||
NOT EXISTS "${FREETYPE_BASE_DIR}-${cfg}/lib/freetyped.lib")
|
NOT EXISTS "${FREETYPE_BASE_DIR}-${cfg}/lib/freetyped.lib")
|
||||||
set(_have_freetype FALSE)
|
#set(_have_freetype FALSE)
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
@ -391,7 +391,7 @@ foreach(cand
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(_ft_debug_lib STREQUAL "" OR _ft_release_lib STREQUAL "")
|
if(_ft_debug_lib STREQUAL "" OR _ft_release_lib STREQUAL "")
|
||||||
message(FATAL_ERROR "FreeType libs not found in ${FREETYPE_BASE_DIR}-Debug/Release")
|
# message(FATAL_ERROR "FreeType libs not found in ${FREETYPE_BASE_DIR}-Debug/Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(freetype_external_lib UNKNOWN IMPORTED GLOBAL)
|
add_library(freetype_external_lib UNKNOWN IMPORTED GLOBAL)
|
||||||
@ -441,7 +441,7 @@ if(NOT _have_sdl2ttf)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(_FT_LIB STREQUAL "")
|
if(_FT_LIB STREQUAL "")
|
||||||
message(FATAL_ERROR "FreeType library not found for ${cfg}")
|
# message(FATAL_ERROR "FreeType library not found for ${cfg}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
log("Configuring SDL_ttf (${cfg}) ...")
|
log("Configuring SDL_ttf (${cfg}) ...")
|
||||||
@ -462,7 +462,7 @@ if(NOT _have_sdl2ttf)
|
|||||||
RESULT_VARIABLE _ttf_cfg_res
|
RESULT_VARIABLE _ttf_cfg_res
|
||||||
)
|
)
|
||||||
if(NOT _ttf_cfg_res EQUAL 0)
|
if(NOT _ttf_cfg_res EQUAL 0)
|
||||||
message(FATAL_ERROR "SDL_ttf configure failed for ${cfg}")
|
#message(FATAL_ERROR "SDL_ttf configure failed for ${cfg}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
log("Building SDL_ttf (${cfg}) ...")
|
log("Building SDL_ttf (${cfg}) ...")
|
||||||
@ -472,7 +472,7 @@ if(NOT _have_sdl2ttf)
|
|||||||
RESULT_VARIABLE _ttf_build_res
|
RESULT_VARIABLE _ttf_build_res
|
||||||
)
|
)
|
||||||
if(NOT _ttf_build_res EQUAL 0)
|
if(NOT _ttf_build_res EQUAL 0)
|
||||||
message(FATAL_ERROR "SDL_ttf build failed for ${cfg}")
|
#message(FATAL_ERROR "SDL_ttf build failed for ${cfg}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
log("Installing SDL_ttf (${cfg}) ...")
|
log("Installing SDL_ttf (${cfg}) ...")
|
||||||
@ -482,7 +482,7 @@ if(NOT _have_sdl2ttf)
|
|||||||
RESULT_VARIABLE _ttf_inst_res
|
RESULT_VARIABLE _ttf_inst_res
|
||||||
)
|
)
|
||||||
if(NOT _ttf_inst_res EQUAL 0)
|
if(NOT _ttf_inst_res EQUAL 0)
|
||||||
message(FATAL_ERROR "SDL_ttf install failed for ${cfg}")
|
#message(FATAL_ERROR "SDL_ttf install failed for ${cfg}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -510,7 +510,7 @@ foreach(cand
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
if(_ttf_debug_lib STREQUAL "" OR _ttf_release_lib STREQUAL "")
|
if(_ttf_debug_lib STREQUAL "" OR _ttf_release_lib STREQUAL "")
|
||||||
message(FATAL_ERROR "SDL_ttf libs not found in install-Debug / install-Release")
|
# message(FATAL_ERROR "SDL_ttf libs not found in install-Debug / install-Release")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(SDL2_ttf_external_lib UNKNOWN IMPORTED GLOBAL)
|
add_library(SDL2_ttf_external_lib UNKNOWN IMPORTED GLOBAL)
|
||||||
|
|||||||
@ -30,52 +30,13 @@
|
|||||||
border-radius: 5px;
|
border-radius: 5px;
|
||||||
}
|
}
|
||||||
#status { color: white; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
|
#status { color: white; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
|
||||||
|
|
||||||
/* Nick modal */
|
|
||||||
#nickOverlay {
|
|
||||||
position: absolute;
|
|
||||||
inset: 0;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: rgba(0,0,0,0.85);
|
|
||||||
z-index: 9999;
|
|
||||||
}
|
|
||||||
#nickBox {
|
|
||||||
background: #111;
|
|
||||||
border: 1px solid #444;
|
|
||||||
padding: 24px;
|
|
||||||
width: 320px;
|
|
||||||
box-shadow: 0 8px 24px rgba(0,0,0,0.6);
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
#nickBox h2 { margin: 0 0 12px 0; font-size: 18px; color: #eee; }
|
|
||||||
#nickBox input[type="text"] {
|
|
||||||
width: 100%;
|
|
||||||
padding: 10px;
|
|
||||||
font-size: 16px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
border: 1px solid #333;
|
|
||||||
background: #000;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
#nickBox button {
|
|
||||||
padding: 10px 16px;
|
|
||||||
font-size: 16px;
|
|
||||||
background: #2a9fd6;
|
|
||||||
border: none;
|
|
||||||
color: #fff;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
#nickSkip { margin-left: 8px; background: #666; }
|
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<button id="fs-button">Fullscreen</button>
|
<button id="fs-button">Fullscreen</button>
|
||||||
<div id="status">Downloading...</div>
|
<div id="status">Downloading...</div>
|
||||||
<canvas id="canvas" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
|
<canvas id="canvas" oncontextmenu="event.preventDefault()" tabindex="-1"></canvas>
|
||||||
<!--
|
|
||||||
<script>
|
<script>
|
||||||
var statusElement = document.getElementById("status");
|
var statusElement = document.getElementById("status");
|
||||||
var canvas = document.getElementById("canvas");
|
var canvas = document.getElementById("canvas");
|
||||||
@ -105,112 +66,6 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<script async src="space-game001.js"></script>-->
|
<script async src="space-game001.js"></script>
|
||||||
|
|
||||||
<div id="nickOverlay" style="display:none;">
|
|
||||||
<div id="nickBox">
|
|
||||||
<h2>Enter your nickname</h2>
|
|
||||||
<input id="nickInput" type="text" maxlength="32" placeholder="Player" />
|
|
||||||
<div>
|
|
||||||
<button id="nickSubmit">Start</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Utility: подготовить глобальный Module до загрузки Emscripten-скрипта
|
|
||||||
function prepareModuleEnvironment() {
|
|
||||||
window.Module = window.Module || {};
|
|
||||||
var canvasEl = document.getElementById('canvas');
|
|
||||||
// Устанавливаем canvas для Emscripten, чтобы createContext не падал
|
|
||||||
window.Module.canvas = canvasEl;
|
|
||||||
// Подготовим заглушку setStatus, если ещё нет
|
|
||||||
window.Module.setStatus = window.Module.setStatus || function (text) {
|
|
||||||
var statusElement = document.getElementById("status");
|
|
||||||
statusElement.innerHTML = text;
|
|
||||||
statusElement.style.display = text ? 'block' : 'none';
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show overlay only if no nickname saved.
|
|
||||||
function loadGameScript() {
|
|
||||||
var s = document.createElement('script');
|
|
||||||
s.src = 'space-game001.js';
|
|
||||||
s.async = true;
|
|
||||||
document.body.appendChild(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
function showNickOverlay() {
|
|
||||||
var overlay = document.getElementById('nickOverlay');
|
|
||||||
overlay.style.display = 'flex';
|
|
||||||
var input = document.getElementById('nickInput');
|
|
||||||
input.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
function hideNickOverlay() {
|
|
||||||
var overlay = document.getElementById('nickOverlay');
|
|
||||||
overlay.style.display = 'none';
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveNickAndStart(nick) {
|
|
||||||
try {
|
|
||||||
if (!nick || nick.trim() === '') nick = 'Player';
|
|
||||||
localStorage.setItem('spacegame_nick', nick);
|
|
||||||
} catch (e) {
|
|
||||||
console.warn('localStorage not available', e);
|
|
||||||
}
|
|
||||||
hideNickOverlay();
|
|
||||||
// перед загрузкой скрипта гарантируем, что Module.canvas задан
|
|
||||||
prepareModuleEnvironment();
|
|
||||||
loadGameScript();
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
// Готовим Module сразу — даже если откроется модалка, поле canvas будет доступно для скрипта (если он загружается позже)
|
|
||||||
prepareModuleEnvironment();
|
|
||||||
|
|
||||||
var stored = null;
|
|
||||||
try {
|
|
||||||
stored = localStorage.getItem('spacegame_nick');
|
|
||||||
} catch (e) {
|
|
||||||
console.warn('localStorage not available', e);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (stored && stored.trim() !== '') {
|
|
||||||
// Nick is present — start immediately
|
|
||||||
loadGameScript();
|
|
||||||
} else {
|
|
||||||
// Show modal to request nickname before loading WASM
|
|
||||||
showNickOverlay();
|
|
||||||
var submit = document.getElementById('nickSubmit');
|
|
||||||
var skip = document.getElementById('nickSkip');
|
|
||||||
var input = document.getElementById('nickInput');
|
|
||||||
|
|
||||||
submit.addEventListener('click', function() {
|
|
||||||
saveNickAndStart(input.value);
|
|
||||||
});
|
|
||||||
skip.addEventListener('click', function() {
|
|
||||||
saveNickAndStart('Player');
|
|
||||||
});
|
|
||||||
|
|
||||||
input.addEventListener('keydown', function(e) {
|
|
||||||
if (e.key === 'Enter') {
|
|
||||||
saveNickAndStart(input.value);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
window.addEventListener("orientationchange", function() {
|
|
||||||
// Chrome на Android обновляет innerWidth/Height не мгновенно.
|
|
||||||
// Ждем завершения анимации поворота.
|
|
||||||
setTimeout(() => {
|
|
||||||
// В Emscripten это вызовет ваш onWindowResized в C++
|
|
||||||
window.dispatchEvent(new Event('resize'));
|
|
||||||
}, 200);
|
|
||||||
});
|
|
||||||
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@ -41,22 +41,6 @@
|
|||||||
"disabled": "resources/button_players.png"
|
"disabled": "resources/button_players.png"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "Button",
|
|
||||||
"name": "inverseMouseButton",
|
|
||||||
"x": 0,
|
|
||||||
"y": 100,
|
|
||||||
"width": 150,
|
|
||||||
"height": 150,
|
|
||||||
"horizontal_gravity": "right",
|
|
||||||
"vertical_gravity": "top",
|
|
||||||
"textures": {
|
|
||||||
"normal": "resources/fire.png",
|
|
||||||
"hover": "resources/fire.png",
|
|
||||||
"pressed": "resources/fire2.png",
|
|
||||||
"disabled": "resources/fire.png"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "Button",
|
"type": "Button",
|
||||||
"name": "shootButton",
|
"name": "shootButton",
|
||||||
|
|||||||
@ -125,6 +125,8 @@ void Session::sendBoxesToClient() {
|
|||||||
|
|
||||||
void Session::init()
|
void Session::init()
|
||||||
{
|
{
|
||||||
|
sendBoxesToClient();
|
||||||
|
|
||||||
auto timer = std::make_shared<net::steady_timer>(ws_.get_executor());
|
auto timer = std::make_shared<net::steady_timer>(ws_.get_executor());
|
||||||
timer->expires_after(std::chrono::milliseconds(100));
|
timer->expires_after(std::chrono::milliseconds(100));
|
||||||
timer->async_wait([self = shared_from_this(), timer](const boost::system::error_code& ec) {
|
timer->async_wait([self = shared_from_this(), timer](const boost::system::error_code& ec) {
|
||||||
@ -133,8 +135,6 @@ void Session::init()
|
|||||||
uint64_t now_ms = static_cast<uint64_t>(
|
uint64_t now_ms = static_cast<uint64_t>(
|
||||||
std::chrono::duration_cast<std::chrono::milliseconds>(now_tp.time_since_epoch()).count());
|
std::chrono::duration_cast<std::chrono::milliseconds>(now_tp.time_since_epoch()).count());
|
||||||
|
|
||||||
self->sendBoxesToClient();
|
|
||||||
|
|
||||||
self->send_message("ID:" + std::to_string(self->id_) + ":" + std::to_string(now_ms));
|
self->send_message("ID:" + std::to_string(self->id_) + ":" + std::to_string(now_ms));
|
||||||
self->do_read();
|
self->do_read();
|
||||||
}
|
}
|
||||||
@ -938,14 +938,14 @@ void Server::accept()
|
|||||||
int main() {
|
int main() {
|
||||||
try {
|
try {
|
||||||
net::io_context ioc;
|
net::io_context ioc;
|
||||||
tcp::acceptor acceptor{ ioc, {tcp::v4(), 8081} };
|
tcp::acceptor acceptor{ ioc, {tcp::v4(), 8010} };
|
||||||
|
|
||||||
Server server(acceptor, ioc);
|
Server server(acceptor, ioc);
|
||||||
|
|
||||||
server.init();
|
server.init();
|
||||||
server.accept();
|
server.accept();
|
||||||
|
|
||||||
std::cout << "Server started on port 8081...\n";
|
std::cout << "Server started on port 8010...\n";
|
||||||
|
|
||||||
server.update_world();
|
server.update_world();
|
||||||
ioc.run();
|
ioc.run();
|
||||||
|
|||||||
@ -1,15 +1,8 @@
|
|||||||
#include "MenuManager.h"
|
#include "MenuManager.h"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifdef EMSCRIPTEN
|
|
||||||
#include <emscripten.h>
|
|
||||||
#include <cstdlib>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace ZL {
|
namespace ZL {
|
||||||
|
|
||||||
extern bool inverseVertical;
|
|
||||||
|
|
||||||
MenuManager::MenuManager(Renderer& iRenderer) :
|
MenuManager::MenuManager(Renderer& iRenderer) :
|
||||||
renderer(iRenderer)
|
renderer(iRenderer)
|
||||||
{
|
{
|
||||||
@ -60,39 +53,15 @@ namespace ZL {
|
|||||||
state = GameState::ShipSelectionSingle;
|
state = GameState::ShipSelectionSingle;
|
||||||
uiManager.replaceRoot(shipSelectionRoot);
|
uiManager.replaceRoot(shipSelectionRoot);
|
||||||
|
|
||||||
std::string initialNick;
|
uiManager.setButtonCallback("spaceshipButton", [this](const std::string&) {
|
||||||
#ifdef EMSCRIPTEN
|
|
||||||
char* savedNickC = emscripten_run_script_string("localStorage.getItem('spacegame_nick') || ''");
|
|
||||||
if (savedNickC) {
|
|
||||||
initialNick = savedNickC;
|
|
||||||
free(savedNickC);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto tf = uiManager.findTextField("nicknameInput");
|
|
||||||
if (tf) {
|
|
||||||
if (!initialNick.empty()) tf->text = initialNick;
|
|
||||||
|
|
||||||
#ifdef EMSCRIPTEN
|
|
||||||
uiManager.setTextFieldCallback("nicknameInput", [](const std::string&, const std::string& value) {
|
|
||||||
EM_ASM_({
|
|
||||||
try { localStorage.setItem('spacegame_nick', UTF8ToString($0)); } catch(e) {}
|
|
||||||
}, value.c_str());
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
uiManager.setButtonCallback("spaceshipButton", [this, initialNick](const std::string&) {
|
|
||||||
std::string nick = uiManager.getTextFieldValue("nicknameInput");
|
std::string nick = uiManager.getTextFieldValue("nicknameInput");
|
||||||
if (nick.empty()) nick = initialNick;
|
|
||||||
if (nick.empty()) nick = "Player";
|
if (nick.empty()) nick = "Player";
|
||||||
enterGameplay();
|
enterGameplay();
|
||||||
if (onSingleplayerPressed) onSingleplayerPressed(nick, 0);
|
if (onSingleplayerPressed) onSingleplayerPressed(nick, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setButtonCallback("cargoshipButton", [this, initialNick](const std::string&) {
|
uiManager.setButtonCallback("cargoshipButton", [this](const std::string&) {
|
||||||
std::string nick = uiManager.getTextFieldValue("nicknameInput");
|
std::string nick = uiManager.getTextFieldValue("nicknameInput");
|
||||||
if (nick.empty()) nick = initialNick;
|
|
||||||
if (nick.empty()) nick = "Player";
|
if (nick.empty()) nick = "Player";
|
||||||
enterGameplay();
|
enterGameplay();
|
||||||
if (onSingleplayerPressed) onSingleplayerPressed(nick, 1);
|
if (onSingleplayerPressed) onSingleplayerPressed(nick, 1);
|
||||||
@ -110,31 +79,8 @@ namespace ZL {
|
|||||||
state = GameState::ShipSelectionMulti;
|
state = GameState::ShipSelectionMulti;
|
||||||
uiManager.replaceRoot(shipSelectionRoot);
|
uiManager.replaceRoot(shipSelectionRoot);
|
||||||
|
|
||||||
std::string initialNick;
|
uiManager.setButtonCallback("spaceshipButton", [this](const std::string&) {
|
||||||
#ifdef EMSCRIPTEN
|
|
||||||
char* savedNickC = emscripten_run_script_string("localStorage.getItem('spacegame_nick') || ''");
|
|
||||||
if (savedNickC) {
|
|
||||||
initialNick = savedNickC;
|
|
||||||
free(savedNickC);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
auto tf = uiManager.findTextField("nicknameInput");
|
|
||||||
if (tf) {
|
|
||||||
if (!initialNick.empty()) tf->text = initialNick;
|
|
||||||
|
|
||||||
#ifdef EMSCRIPTEN
|
|
||||||
uiManager.setTextFieldCallback("nicknameInput", [](const std::string&, const std::string& value) {
|
|
||||||
EM_ASM_({
|
|
||||||
try { localStorage.setItem('spacegame_nick', UTF8ToString($0)); } catch(e) {}
|
|
||||||
}, value.c_str());
|
|
||||||
});
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
uiManager.setButtonCallback("spaceshipButton", [this, initialNick](const std::string&) {
|
|
||||||
std::string nick = uiManager.getTextFieldValue("nicknameInput");
|
std::string nick = uiManager.getTextFieldValue("nicknameInput");
|
||||||
if (nick.empty()) nick = initialNick;
|
|
||||||
if (nick.empty()) nick = "Player";
|
if (nick.empty()) nick = "Player";
|
||||||
pendingMultiNick = nick;
|
pendingMultiNick = nick;
|
||||||
pendingMultiShipType = 0;
|
pendingMultiShipType = 0;
|
||||||
@ -142,9 +88,8 @@ namespace ZL {
|
|||||||
if (onMultiplayerPressed) onMultiplayerPressed(nick, 0);
|
if (onMultiplayerPressed) onMultiplayerPressed(nick, 0);
|
||||||
});
|
});
|
||||||
|
|
||||||
uiManager.setButtonCallback("cargoshipButton", [this, initialNick](const std::string&) {
|
uiManager.setButtonCallback("cargoshipButton", [this](const std::string&) {
|
||||||
std::string nick = uiManager.getTextFieldValue("nicknameInput");
|
std::string nick = uiManager.getTextFieldValue("nicknameInput");
|
||||||
if (nick.empty()) nick = initialNick;
|
|
||||||
if (nick.empty()) nick = "Player";
|
if (nick.empty()) nick = "Player";
|
||||||
pendingMultiNick = nick;
|
pendingMultiNick = nick;
|
||||||
pendingMultiShipType = 1;
|
pendingMultiShipType = 1;
|
||||||
@ -244,14 +189,6 @@ namespace ZL {
|
|||||||
if (onShowPlayersPressed) onShowPlayersPressed();
|
if (onShowPlayersPressed) onShowPlayersPressed();
|
||||||
});
|
});
|
||||||
|
|
||||||
//inverseMouseButton
|
|
||||||
|
|
||||||
uiManager.setButtonPressCallback("inverseMouseButton", [this](const std::string&) {
|
|
||||||
inverseVertical = !inverseVertical;
|
|
||||||
std::cout << "Inverse mouse: " << (inverseVertical ? "ON" : "OFF") << std::endl;
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
uiManager.setSliderCallback("velocitySlider", [this](const std::string&, float value) {
|
uiManager.setSliderCallback("velocitySlider", [this](const std::string&, float value) {
|
||||||
|
|||||||
@ -36,8 +36,6 @@ namespace ZL
|
|||||||
extern float y;
|
extern float y;
|
||||||
extern float z;
|
extern float z;
|
||||||
|
|
||||||
bool inverseVertical = true;
|
|
||||||
|
|
||||||
Eigen::Quaternionf generateRandomQuaternion(std::mt19937& gen)
|
Eigen::Quaternionf generateRandomQuaternion(std::mt19937& gen)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2081,23 +2079,12 @@ namespace ZL
|
|||||||
|
|
||||||
Environment::tapDownHold = true;
|
Environment::tapDownHold = true;
|
||||||
|
|
||||||
if (inverseVertical)
|
|
||||||
{
|
|
||||||
Environment::tapDownStartPos(0) = mx;
|
Environment::tapDownStartPos(0) = mx;
|
||||||
Environment::tapDownStartPos(1) = my;
|
Environment::tapDownStartPos(1) = my;
|
||||||
|
|
||||||
Environment::tapDownCurrentPos(0) = mx;
|
Environment::tapDownCurrentPos(0) = mx;
|
||||||
Environment::tapDownCurrentPos(1) = my;
|
Environment::tapDownCurrentPos(1) = my;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
Environment::tapDownStartPos(0) = mx;
|
|
||||||
Environment::tapDownStartPos(1) = -my;
|
|
||||||
|
|
||||||
Environment::tapDownCurrentPos(0) = mx;
|
|
||||||
Environment::tapDownCurrentPos(1) = -my;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Space::handleUp(int mx, int my)
|
void Space::handleUp(int mx, int my)
|
||||||
{
|
{
|
||||||
@ -2109,22 +2096,11 @@ namespace ZL
|
|||||||
{
|
{
|
||||||
if (playerListVisible) return;
|
if (playerListVisible) return;
|
||||||
|
|
||||||
|
|
||||||
if (inverseVertical)
|
|
||||||
{
|
|
||||||
if (Environment::tapDownHold) {
|
if (Environment::tapDownHold) {
|
||||||
Environment::tapDownCurrentPos(0) = mx;
|
Environment::tapDownCurrentPos(0) = mx;
|
||||||
Environment::tapDownCurrentPos(1) = my;
|
Environment::tapDownCurrentPos(1) = my;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (Environment::tapDownHold) {
|
|
||||||
Environment::tapDownCurrentPos(0) = mx;
|
|
||||||
Environment::tapDownCurrentPos(1) = -my;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Space::clearTextRendererCache()
|
void Space::clearTextRendererCache()
|
||||||
{
|
{
|
||||||
|
|||||||
@ -9,7 +9,7 @@ namespace ZL {
|
|||||||
// Формируем URL. Обратите внимание, что в Web часто лучше использовать ws://localhost
|
// Формируем URL. Обратите внимание, что в Web часто лучше использовать ws://localhost
|
||||||
//std::string url = "ws://" + host + ":" + std::to_string(port);
|
//std::string url = "ws://" + host + ":" + std::to_string(port);
|
||||||
std::string url = "wss://api.spacegame.fishrungames.com";
|
std::string url = "wss://api.spacegame.fishrungames.com";
|
||||||
//std::string url = "ws://localhost:8081";
|
|
||||||
EmscriptenWebSocketCreateAttributes attr = {
|
EmscriptenWebSocketCreateAttributes attr = {
|
||||||
url.c_str(),
|
url.c_str(),
|
||||||
nullptr,
|
nullptr,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user