mirror of
https://github.com/godotengine/godot.git
synced 2025-10-27 11:44:21 +00:00
Style: Prevent clang-format on JS code
(cherry picked from commit 39114178a0)
This commit is contained in:
parent
dbf0137576
commit
2d479aa0c6
4 changed files with 293 additions and 91 deletions
|
|
@ -215,6 +215,7 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
|
|||
|
||||
// find locale, emscripten only sets "C"
|
||||
char locale_ptr[16];
|
||||
/* clang-format off */
|
||||
EM_ASM_({
|
||||
var locale = "";
|
||||
if (Module.locale) {
|
||||
|
|
@ -230,6 +231,7 @@ void OS_JavaScript::initialize(const VideoMode& p_desired,int p_video_driver,int
|
|||
locale = locale.split('.')[0];
|
||||
stringToUTF8(locale, $0, 16);
|
||||
}, locale_ptr);
|
||||
/* clang-format on */
|
||||
setenv("LANG", locale_ptr, true);
|
||||
|
||||
print_line("Init Audio");
|
||||
|
|
@ -327,9 +329,11 @@ void OS_JavaScript::finalize() {
|
|||
|
||||
void OS_JavaScript::alert(const String& p_alert,const String& p_title) {
|
||||
|
||||
/* clang-format off */
|
||||
EM_ASM_({
|
||||
window.alert(UTF8ToString($0));
|
||||
}, p_alert.utf8().get_data());
|
||||
/* clang-format on */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -361,9 +365,11 @@ int OS_JavaScript::get_mouse_button_state() const {
|
|||
|
||||
void OS_JavaScript::set_window_title(const String& p_title) {
|
||||
|
||||
/* clang-format off */
|
||||
EM_ASM_({
|
||||
document.title = UTF8ToString($0);
|
||||
}, p_title.utf8().get_data());
|
||||
/* clang-format on */
|
||||
}
|
||||
|
||||
//interesting byt not yet
|
||||
|
|
@ -419,8 +425,10 @@ void OS_JavaScript::set_window_maximized(bool p_enabled) {
|
|||
set_window_fullscreen(false);
|
||||
}
|
||||
else {
|
||||
/* clang-format off */
|
||||
video_mode.width = EM_ASM_INT_V(return window.innerWidth);
|
||||
video_mode.height = EM_ASM_INT_V(return window.innerHeight);
|
||||
/* clang-format on */
|
||||
emscripten_set_canvas_size(video_mode.width, video_mode.height);
|
||||
}
|
||||
}
|
||||
|
|
@ -439,7 +447,9 @@ void OS_JavaScript::set_window_fullscreen(bool p_enable) {
|
|||
// _browser_resize_callback or _fullscreen_change_callback
|
||||
EMSCRIPTEN_RESULT result;
|
||||
if (p_enable) {
|
||||
/* clang-format off */
|
||||
EM_ASM(Module.requestFullscreen(false, false););
|
||||
/* clang-format on */
|
||||
}
|
||||
else {
|
||||
result = emscripten_exit_fullscreen();
|
||||
|
|
@ -501,8 +511,7 @@ bool OS_JavaScript::main_loop_iterate() {
|
|||
|
||||
if (time_to_save_sync<0) {
|
||||
//time to sync, for real
|
||||
// run 'success'
|
||||
print_line("DOING SYNCH!");
|
||||
/* clang-format off */
|
||||
EM_ASM(
|
||||
FS.syncfs(function (err) {
|
||||
assert(!err);
|
||||
|
|
@ -510,6 +519,7 @@ bool OS_JavaScript::main_loop_iterate() {
|
|||
//ccall('success', 'v');
|
||||
});
|
||||
);
|
||||
/* clang-format on */
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -786,9 +796,11 @@ void OS_JavaScript::reload_gfx() {
|
|||
}
|
||||
|
||||
Error OS_JavaScript::shell_open(String p_uri) {
|
||||
/* clang-format off */
|
||||
EM_ASM_({
|
||||
window.open(UTF8ToString($0), '_blank');
|
||||
}, p_uri.utf8().get_data());
|
||||
/* clang-format on */
|
||||
return OK;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue