Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add toggling full screen mode with F11 hotkey #31

Merged
merged 6 commits into from
Nov 21, 2018
Merged

Add toggling full screen mode with F11 hotkey #31

merged 6 commits into from
Nov 21, 2018

Conversation

iceiix
Copy link
Owner

@iceiix iceiix commented Nov 21, 2018

No description provided.

@iceiix iceiix added the enhancement New feature or request label Nov 21, 2018
@iceiix
Copy link
Owner Author

iceiix commented Nov 21, 2018

A simple enhancement, the only question is to switch to sdl2::video::FullscreenType::True or sdl2::video::FullscreenType::Desktop? Observing the differences, this is Off (windowed mode):

screen shot 2018-11-20 at 7 34 35 pm

this is Desktop:

screen shot 2018-11-20 at 7 34 39 pm

and this is True:

screen shot 2018-11-20 at 7 36 16 pm

SDL_SetWindowFullscreen documentation:

flags may be SDL_WINDOW_FULLSCREEN, for "real" fullscreen with a videomode change; SDL_WINDOW_FULLSCREEN_DESKTOP for "fake" fullscreen that takes the size of the desktop; and 0 for windowed mode.

The true real fullscreen with video mode change uses the same resolution, but scales it up. The fake desktop fullscreen on the other hand provides a lot more space, and the scaling is more reasonable instead of everything being scaled too big. Going with desktop mode, can reevaluate if there are problems, but so far it appears to work better than true mode.

@iceiix iceiix merged commit 47d1878 into updates Nov 21, 2018
@iceiix iceiix deleted the fullscreen branch November 25, 2018 19:17
iceiix added a commit that referenced this pull request Nov 30, 2018
iceiix added a commit that referenced this pull request Nov 30, 2018
* Add glutin dependency

* Create a glutin window

* Use the glutin window, basics work

* Store DPI factor on game object, update on Resized

* Use physical size for rendering only. Fixes UI scaled too small

Fixes #35 (comment)
See also https://github.com/iceiix/steven/issues/22

* Begin adding mouse input events

* Listen for DeviceEvents

* Call hover_at on mouse motion

* Listen for CursorMoved window event, hovering works

Glutin has separate WindowEvent::CursorMoved and
DeviceEvent::MouseMotion events, for absolute cursor and relative mouse
motion, respectively, instead of SDL's Event::MouseMotion for both.

* Use tuple pattern matching instead of nested if for MouseInput

* Implement left clicking

* Use grab_cursor() to capture the cursor

* Hide the cursor when grabbing

* Implement MouseWheel event

* Listen for keyboard input, escape key release

* Keyboard input: console toggling, glutin calls backquote 'grave'

* Implement fullscreen in glutin, updates #31

* Update settings for glutin VirtualKeyCode

* Keyboard controls (note: must clear conf.cfg to use correct bindings)

* Move DeviceEvent match arm up higher for clarity

* Remove SDL

* Pass physical dimensions to renderer tick so blit_framebuffer can use full size but the ui is still sized logically.

* Listen for DeviceEvent::Text

* Implement text input using ReceivedCharacter window event, works

#35 (comment)

* Request specific version of OpenGL, version 3.2

* Request OpenGL 3.2 but fallback to OpenGL ES 2.0 if available (not tested)

* Set core profile and depth 24-bits, stencil 0-bits

* Allow changing vsync, but require restarting (until rust-windowing/glutin#693)

* Clarify specific Rust version requirement

* Import glutin::* in handle_window_event() to avoid overly repetitive code

* Linux in VM fix: manually calculate delta in MouseMotion

For the third issue on #35 (comment)
https://github.com/tomaka/glutin/issues/1084 MouseMotion event returns absolute instead of relative values, when running Linux in a VM

* Heuristic to detect absolute/relative MouseMotion from delta:(xrel, yrel); use a higher scaling factor

* Add clipboard pasting with clipboard crate instead of sdl2

#35 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant