Compare commits
2 commits
7dd55d94a9
...
151afec7f0
| Author | SHA1 | Date | |
|---|---|---|---|
| 151afec7f0 | |||
| abf45f3dcb |
3 changed files with 6 additions and 5 deletions
|
|
@ -20,6 +20,7 @@
|
||||||
{
|
{
|
||||||
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
|
||||||
|
|
||||||
|
|
@ -59,7 +60,11 @@ 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,10 +22,6 @@ 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" oncontextmenu="event.preventDefault()"></canvas>
|
<canvas id="canvas" tabindex="-1" 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