Commit Graph

163 Commits

Author SHA1 Message Date
Michael Kirk
4d3194c362 Revert "DO NOT MERGE: web logging"
This reverts commit fecfad72806b095e8477d983dc69f1275422a90f.
2020-08-12 15:44:48 -07:00
Michael Kirk
5c8ccef970 DO NOT MERGE: web logging 2020-08-12 15:44:48 -07:00
Michael Kirk
32a92c0d76 wasm backend 2020-08-12 15:44:48 -07:00
Michael Kirk
f42b7c003c layout uses logical pixels, not physical
Previously it was not clear (to me at least) when a value used
in layout was in units of logical pixels vs physical pixels.

This lead to some ambiguity about where to scale values, and lead to
some values being scaled more than once or sometimes not at all, leading
to inconsistent layouts across DPI's.

The intent of this change is to solve this ambiguity by having the ui
clients work *exlusively* with logical pixels.

To achieve this, we consolidate all scaling to the graphics backend.
We translate all PhysicalPositions from the windowing libraries to
LogicalPixles.

Our own types: ScreenPt, ScreenDim, etc. are all in logical units.

In some places, I replaced passing raw floats with a corresponding
Screen* type to clarify that the units are in logical pixels.
2020-08-12 15:44:48 -07:00
Dustin Carlino
74426aaf94 get ezgui demo running in wasm 2020-08-07 19:49:43 -07:00
Dustin Carlino
5fe3cc5f8a slowly whittle down public surface of ezgui
- stop referencing Prerender when easy
- default_font_size hasn't been used since the great typography refactor

some of this harms the usability of map_editor, but that's fine, because
the UX is awful anyway, and nobody should be using this except for me
very occasionally. long-term fate of it is to go away.
2020-08-04 11:36:47 -07:00
Dustin Carlino
9f72b3dd51 cleanup after the relative dir fix, and add support for hardcoding the
data dir, for #137
2020-07-07 12:14:02 -07:00
Dustin Carlino
6919c24bf8 detect the data/ dir more intelligently. fixes #73. still need to
- consider collapsing the directory structure in the releases
- fix wasm

[rebuild]
2020-07-07 11:09:35 -07:00
Dustin Carlino
a62e3133db cleanup after #59:
- cargo fmt
- update some comments
- remove EventLoopMode
- if no updates are requested, that's the equivalent of InputOnly
2020-07-01 17:57:43 -07:00
Javed Nissar
1f58cbf16d
Refactor event update loop (#59)
* Refactor event update loop to enable multiple game update types

* Implement pan event to improve panning with cursor at edge of screen and
fixed formatting
2020-07-01 17:47:30 -07:00
Dustin Carlino
a9b2a33ffc windows fixes:
- the updater script was clobbering clobber data/
- window resize events seem to capture title bar (#65)
[rebuild]
2020-06-22 15:51:42 -07:00
Dustin Carlino
a96b77ba3f more granular profiling 2020-06-09 18:56:33 -07:00
Dustin Carlino
967c8929e3 cleanup after PR, and start to wittle down EventLoopMode to handle
multiple types of update events
2020-05-23 11:23:38 -07:00
Dustin Carlino
fa1273bd34 more dpi fixes:
- margin and padding
- Widget::draw_batch
- trip timeline
- custom buttons

and finally enable automatically setting DPI based on the monitor!!!
[rebuild]
2020-05-17 17:02:33 -07:00
Dustin Carlino
f3b396a7e9 set a window icon 2020-05-09 09:48:24 -07:00
Dustin Carlino
fec2bb51ca start organizing ezgui internal constants into a Style struct 2020-04-05 11:57:27 -07:00
Dustin Carlino
e0acc4973b actually, i don't need to support changing font or size mid-line yet. simplifies some info panel code. 2020-04-03 14:26:17 -07:00
Dustin Carlino
199b175319 change the mouse cursor based on context [rebuild] 2020-04-01 10:23:28 -07:00
Dustin Carlino
69dab9e27d typography overhaul... [rebuild] 2020-03-26 15:42:37 -07:00
Dustin Carlino
2712ea8c74 settle on using the common widget ID for everything (except rows/cols).
move some non-widget tools to a better module, and rename shaders
directory
2020-03-22 10:48:11 -07:00
Dustin Carlino
81c5ae3700 consolidate ezgui internals a little, and start a little bit of rustdoc 2020-03-20 18:05:50 -07:00
Dustin Carlino
c316d918d7 can only type in text boxes with focus 2020-03-09 13:23:03 -07:00
Dustin Carlino
f9b2c5de4f optionally use touchpad for different canvas movement controls 2020-03-07 16:13:30 -08:00
Dustin Carlino
a301343159 add a setting to scale up on-screen UI things [rebuild] 2020-03-02 12:02:25 -08:00
Dustin Carlino
2a747ef46b tooltips for UI elements only. don't need the OSD fullscreen now. 2020-02-20 11:24:50 -08:00
Dustin Carlino
254d07223e option to invert scroll direction 2020-02-18 07:30:32 -08:00
Dustin Carlino
b2c92ab8f9 upstreaming some changes for wasm here
- use instant crate
- bring in the wasm ezgui backend and necessary setup tweaks
- upgrade stdweb

but no map editor build magic yet
2020-02-14 14:28:25 -08:00
Dustin Carlino
606325ac77 make the glow and glium backends toggleable at build-time 2020-02-10 20:23:12 -08:00
Dustin Carlino
0b56ef6dea clipping support 2020-02-10 20:10:58 -08:00
Dustin Carlino
7267410ac0 aha, fixed size problem, gotta update viewport 2020-02-10 19:41:15 -08:00
Dustin Carlino
5205a0c43e starting a stubbed out port to glow (glutin dependencies still). it
uploads the shaders, clears the window out so far!
2020-02-10 16:59:02 -08:00
Dustin Carlino
c5a055cbb6 rearrange ezgui internals to isolate all glium/glutin specifics into one
module
2020-02-10 16:18:31 -08:00
Dustin Carlino
6ff0c85a14 cutover to use winit's own event loop. thanks to goddessfreya for help
fixing the animation timing in
https://github.com/rust-windowing/winit/pull/1450#pullrequestreview-355698895
2020-02-10 10:01:49 -08:00
Dustin Carlino
935e42aee6 upgrade glium and glutin
- reference events exported from glutin as winit events, which will ease a transition to wasm (where winit is used with glow, not glium)
- also winit stopped requiring a dance to convert logical to physical sizes, so stop tracking dpi!
2020-02-09 10:56:51 -08:00
Dustin Carlino
db65e1d41f slightly less inefficient draw_blocking_text 2020-02-08 13:52:29 -08:00
Dustin Carlino
fad4cdbda2 plumb font directory so it'll work anywhere, but still would prefer to bundle binary data properly 2020-02-08 10:36:44 -08:00
Dustin Carlino
3ff56f54cf prepping for a caching layer by changing render API, plumbing ctx...
getting close
2020-02-08 10:36:44 -08:00
Dustin Carlino
9355bcf5fd cutover mapspace text quickly (without doing the scaling down yet.
delete lots of stuff.
2020-02-08 10:36:44 -08:00
Dustin Carlino
234689533a woohoo, dismantle screenspace glyphs entirely 2020-02-08 10:36:44 -08:00
Dustin Carlino
acef70add0 draw after update events [rebuild] 2020-02-02 22:16:02 -08:00
Dustin Carlino
e733fe9d94 plumb real time passed through Update event, just base off of that 2020-01-28 09:39:44 -08:00
Dustin Carlino
6d016cd01b stop blindly plumbing through no-op events after any input is used. do
it more explicitly in just a few places.

fixes crash when cycling through turns while sim is running.

this makes modal menus appear laggy, but that's fine; phasing those out
anyway.
2020-01-23 17:11:29 -08:00
Dustin Carlino
3482d61c0d attempt to detect hidpi changes? [rebuild] 2020-01-13 19:13:00 -08:00
Dustin Carlino
bb141c7026 also clip text. not used quite yet. 2020-01-13 18:26:24 -08:00
Dustin Carlino
ec1e3f435b make it easy to dump raw events for debugging on windows/mac [rebuild] 2020-01-12 09:35:38 -08:00
Dustin Carlino
e2de6b24d9 start windows maximized 2020-01-10 11:23:52 -06:00
Dustin Carlino
0ad371525b after clicking a button, figure out if we're hovering over any new buttons that're created. kind of an invasive refactor to get to this, but worth it. 2020-01-07 11:43:34 -06:00
Dustin Carlino
e893e6b98c add a flag to override DPI, so we can tune on mac 2019-12-16 19:09:02 -08:00
Dustin Carlino
770507610c try to workaround the mac dpi issue for minimaps again. hardcoding didnt work. 2019-12-11 16:59:13 -08:00
Dustin Carlino
ee598b6ae4 round of clippy. not fixing everything. 2019-12-11 16:17:15 -08:00