Merge pull request #20 from pmp-p/wasm324
emsdk 3.1.25 / emscripten-sdl2 target
This commit is contained in:
commit
fa42e6429b
|
@ -10,9 +10,12 @@
|
|||
#include "engine/ogg_audio_stream.h"
|
||||
#include "engine/wav_audio_stream.h"
|
||||
|
||||
#ifndef EMSCRIPTEN
|
||||
#include <AL/alc.h>
|
||||
#include <AL/alext.h>
|
||||
#if !defined(__EMSCRIPTEN__)
|
||||
#include <AL/alext.h>
|
||||
#else
|
||||
#include <AL/al.h>
|
||||
#endif
|
||||
|
||||
#include <bx/bx.h>
|
||||
|
||||
|
@ -625,4 +628,3 @@ void StopAllSources() {
|
|||
}
|
||||
|
||||
} // namespace hg
|
||||
#endif
|
|
@ -12,6 +12,9 @@ void set_thread_name(const std::string &name) {}
|
|||
std::string get_thread_name(std::thread::id id) { return "Unsupported"; }
|
||||
|
||||
bool set_thread_priority(std::thread::native_handle_type handle, unsigned int priority) {
|
||||
#if defined(__EMSCRIPTEN__)
|
||||
return true;
|
||||
#else
|
||||
if (!handle)
|
||||
return false;
|
||||
|
||||
|
@ -20,6 +23,7 @@ bool set_thread_priority(std::thread::native_handle_type handle, unsigned int pr
|
|||
param.sched_priority = priority;
|
||||
|
||||
return pthread_setschedparam(handle, SCHED_OTHER, ¶m) == 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
bool set_thread_affinity(std::thread::native_handle_type handle, unsigned int mask) { return false; }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// HARFANG(R) Copyright (C) 2019 Emmanuel Julien, Movida Production. Released under GPL/LGPL/Commercial Licence, see licence.txt for details.
|
||||
|
||||
#include "../platform.h"
|
||||
#include "foundation/assert.h"
|
||||
#include "foundation/format.h"
|
||||
#include "foundation/log.h"
|
||||
|
@ -13,19 +13,31 @@ bool InitPlatform() {
|
|||
return true;
|
||||
}
|
||||
|
||||
enum class Action : int {
|
||||
FileOpen = 0,
|
||||
FileSave,
|
||||
SelectFolder,
|
||||
Count
|
||||
};
|
||||
|
||||
std::string GetPlatformLocale() {
|
||||
return "fr";
|
||||
return "C";
|
||||
}
|
||||
|
||||
#pragma message "SDL2 dialogs not implemented for WASM"
|
||||
|
||||
bool OpenFolderDialog(const std::string &title, std::string &OUTPUT, const std::string &initial_dir) {
|
||||
puts(__FILE__ ":OpenFolderDialog");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool OpenFileDialog(const std::string &title, const std::string &filter, std::string &OUTPUT, const std::string &initial_dir) {
|
||||
bool OpenFileDialog(const std::string &title, const std::vector<FileFilter> &filters, std::string &output, const std::string &initial_dir) {
|
||||
puts(__FILE__ ":OpenFileDialog");
|
||||
return false;
|
||||
}
|
||||
|
||||
bool SaveFileDialog(const std::string &title, const std::string &filter, std::string &OUTPUT, const std::string &initial_dir) {
|
||||
bool SaveFileDialog(const std::string &title, const std::vector<FileFilter> &filters, std::string &output, const std::string &initial_dir) {
|
||||
puts(__FILE__ ":SaveFileDialog");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -100,11 +100,17 @@ Window *NewWindowFrom(void *handle) {
|
|||
}
|
||||
|
||||
// TODO Create a new fullscreen window on a specified monitor.
|
||||
Window *NewFullscreenWindow(const Monitor *monitor, int mode_index, MonitorRotation rotation) { return NewWindow(512, 512, 32, WV_Windowed); }
|
||||
Window *NewFullscreenWindow(const Monitor *monitor, int mode_index, MonitorRotation rotation) {
|
||||
return NewWindow(512, 512, 32, WV_Windowed);
|
||||
}
|
||||
Window * NewFullscreenWindow(const char *title, const Monitor *monitor, int mode_index, MonitorRotation rotation) {
|
||||
return NewWindow(512, 512, 32, WV_Windowed);
|
||||
}
|
||||
|
||||
|
||||
void *GetDisplay() { return nullptr; }
|
||||
|
||||
static const char *canvas_name = "canvas";
|
||||
static const char *canvas_name = "#canvas";
|
||||
void *GetWindowHandle(const Window *w) {
|
||||
return (void *)canvas_name;
|
||||
// return reinterpret_cast<void *>(w->w);
|
||||
|
@ -161,7 +167,7 @@ bool SetWindowTitle(Window *w, const std::string &title) { return true; }
|
|||
|
||||
bool WindowHasFocus(const Window *w) { return true; }
|
||||
|
||||
bool SetWindowPos(const Window *w, const hg::iVec2 &v) {
|
||||
bool SetWindowPos(Window *w, const hg::iVec2 &v) {
|
||||
SDL_SetWindowPosition(w->w, v.x, v.y);
|
||||
UpdateWindow(w); // process messages on the spot
|
||||
return true;
|
||||
|
@ -176,7 +182,13 @@ hg::iVec2 GetWindowPos(const Window *w) {
|
|||
return pos;
|
||||
}
|
||||
|
||||
hg::Vec2 GetWindowContentScale(const Window *window) {
|
||||
puts(__FILE__ "GetWindowContentScale");
|
||||
return { 1, 1 };
|
||||
}
|
||||
|
||||
void ShowCursor() { SDL_ShowCursor(SDL_ENABLE); }
|
||||
void HideCursor() { SDL_ShowCursor(SDL_DISABLE); }
|
||||
void WindowSystemShutdown() { }
|
||||
|
||||
} // namespace hg
|
||||
|
|
Loading…
Reference in New Issue