Compare commits
No commits in common. "151afec7f058fb39f18875162fcf97e70855e89b" and "7dd55d94a9ac76ea02705501952ed278c9caec53" have entirely different histories.
151afec7f0
...
7dd55d94a9
3 changed files with 5 additions and 6 deletions
|
|
@ -20,7 +20,6 @@
|
||||||
{
|
{
|
||||||
std::unique_ptr<psemek::app::application> application;
|
std::unique_ptr<psemek::app::application> application;
|
||||||
std::unique_ptr<psemek::sdl2::window> window;
|
std::unique_ptr<psemek::sdl2::window> window;
|
||||||
psemek::app::application::context context;
|
|
||||||
} em_state;
|
} em_state;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
@ -60,11 +59,7 @@ int main(int argc, char ** argv) try
|
||||||
sdl2::window window(options);
|
sdl2::window window(options);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
|
||||||
auto & context = em_state.context;
|
|
||||||
#else
|
|
||||||
app::application::context context;
|
app::application::context context;
|
||||||
#endif
|
|
||||||
for (int i = 0; i < argc; ++i)
|
for (int i = 0; i < argc; ++i)
|
||||||
context.args.push_back(argv[i]);
|
context.args.push_back(argv[i]);
|
||||||
context.show_cursor = [&](bool show){ window.show_cursor(show); };
|
context.show_cursor = [&](bool show){ window.show_cursor(show); };
|
||||||
|
|
|
||||||
|
|
@ -22,6 +22,10 @@ namespace psemek::sdl2
|
||||||
|
|
||||||
window::window(psemek::app::application::options const & options)
|
window::window(psemek::app::application::options const & options)
|
||||||
{
|
{
|
||||||
|
#ifdef __EMSCRIPTEN__
|
||||||
|
SDL_SetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT, "#canvas");
|
||||||
|
#endif
|
||||||
|
|
||||||
sdl_init_ = init(SDL_INIT_EVENTS | SDL_INIT_VIDEO);
|
sdl_init_ = init(SDL_INIT_EVENTS | SDL_INIT_VIDEO);
|
||||||
|
|
||||||
std::uint32_t flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE;
|
std::uint32_t flags = SDL_WINDOW_HIDDEN | SDL_WINDOW_RESIZABLE;
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<canvas id="canvas" tabindex="-1" oncontextmenu="event.preventDefault()"></canvas>
|
<canvas id="canvas" oncontextmenu="event.preventDefault()"></canvas>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
var Module = {
|
var Module = {
|
||||||
canvas: document.getElementById('canvas'),
|
canvas: document.getElementById('canvas'),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue