Separate show_mouse and relative_mouse_mode
This commit is contained in:
parent
d2ba791be1
commit
325dc01757
5 changed files with 10 additions and 1 deletions
|
|
@ -72,6 +72,7 @@ extern "C" jlong Java_psemek_app_PsemekApplication_createNativeApp(JNIEnv * env,
|
||||||
psemek::app::application::context context;
|
psemek::app::application::context context;
|
||||||
context.show_cursor = [](bool){};
|
context.show_cursor = [](bool){};
|
||||||
context.vsync = [](bool){};
|
context.vsync = [](bool){};
|
||||||
|
context.relative_mouse_mode = [](bool){};
|
||||||
context.windowed = [](bool){};
|
context.windowed = [](bool){};
|
||||||
auto app = factory->create(factory->options(), context).release();
|
auto app = factory->create(factory->options(), context).release();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ namespace psemek::app
|
||||||
{
|
{
|
||||||
std::vector<std::string> args;
|
std::vector<std::string> args;
|
||||||
std::function<void(bool)> show_cursor;
|
std::function<void(bool)> show_cursor;
|
||||||
|
std::function<void(bool)> relative_mouse_mode;
|
||||||
std::function<void(bool)> windowed;
|
std::function<void(bool)> windowed;
|
||||||
#if defined(PSEMEK_APP_OPENGL)
|
#if defined(PSEMEK_APP_OPENGL)
|
||||||
std::function<void(bool)> vsync;
|
std::function<void(bool)> vsync;
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ namespace psemek::sdl2
|
||||||
void show();
|
void show();
|
||||||
void swap();
|
void swap();
|
||||||
void show_cursor(bool show);
|
void show_cursor(bool show);
|
||||||
|
void relative_mouse_mode(bool mode);
|
||||||
void vsync(bool on);
|
void vsync(bool on);
|
||||||
void windowed(bool on);
|
void windowed(bool on);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,6 +46,7 @@ int main(int argc, char ** argv) try
|
||||||
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); };
|
||||||
|
context.relative_mouse_mode = [&](bool mode){ window.relative_mouse_mode(mode); };
|
||||||
context.windowed = [&](bool on){ window.windowed(on); };
|
context.windowed = [&](bool on){ window.windowed(on); };
|
||||||
|
|
||||||
#if defined(PSEMEK_SDL2_OPENGL)
|
#if defined(PSEMEK_SDL2_OPENGL)
|
||||||
|
|
|
||||||
|
|
@ -163,7 +163,12 @@ namespace psemek::sdl2
|
||||||
{
|
{
|
||||||
log::info() << (show ? "Cursor shown" : "Cursor hidden");
|
log::info() << (show ? "Cursor shown" : "Cursor hidden");
|
||||||
SDL_ShowCursor(show ? SDL_TRUE : SDL_FALSE);
|
SDL_ShowCursor(show ? SDL_TRUE : SDL_FALSE);
|
||||||
SDL_SetRelativeMouseMode(show ? SDL_FALSE : SDL_TRUE);
|
}
|
||||||
|
|
||||||
|
void window::relative_mouse_mode(bool mode)
|
||||||
|
{
|
||||||
|
log::info() << "Relative mouse mode " << (mode ? "on" : "off");
|
||||||
|
SDL_SetRelativeMouseMode(mode ? SDL_TRUE: SDL_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void window::vsync(bool on)
|
void window::vsync(bool on)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue