Commit Graph

480 Commits

Author SHA1 Message Date
Hajime Hoshi
b56061281d ui: Add comments 2018-10-13 22:41:21 +09:00
Hajime Hoshi
a073f48faf input: Bug fix: keypress event were not fired
This change suspends to 'preventDefault' on keydown events.

Now preventing navigation by pressing backspace is deprecated in
Chrome. For other keys, it looks like keyup's preventDefault is
enough to disable the browser default behavior.
2018-10-13 19:18:13 +09:00
Hajime Hoshi
34596bb1cf ui: Bug fix: IsVsyncEnabled can cause deadlock 2018-10-10 23:17:45 +09:00
Hajime Hoshi
b4a4b87b56 ui: Bug fix: ScreenSizeInFullscreen returned wrong scaled values
Fixes #708
2018-10-10 03:10:18 +09:00
Hajime Hoshi
e971f6d41c ui: Avoid glfw.GetCurrentContext for threading issues 2018-10-10 01:45:39 +09:00
Hajime Hoshi
b5344bc994 ui: glfwScale must be called on the main thread 2018-10-10 01:07:47 +09:00
Hajime Hoshi
c758a1f8c6 ui: Rename MonitorSize -> ScreenSizeInFullscreen (#708) 2018-10-09 23:42:03 +09:00
Hajime Hoshi
dbe71e81bd ui: Bug fix: currentMonitorPos returned wrong values on macOS
[NSScreen mainScreen] sometimes returned a wrong screen for the
window. Use [[NSApp mainWindow] screen] when possible.

Fixes #703
2018-10-08 05:40:07 +09:00
Hajime Hoshi
c4a066ecd0 ui: Fix wrong comments about Windows 2018-10-08 04:06:44 +09:00
Hajime Hoshi
8d2820efb0 ui: Bug fix: the window is shown on the current monitor on Windows
Fixes #704
2018-10-08 03:24:14 +09:00
Hajime Hoshi
96a657025f ui: Bug fix: DeviceScaleFactor and MonitorSize were not correct on Windows 2018-10-08 03:18:24 +09:00
Hajime Hoshi
9264e38324 ui: Add comments 2018-10-08 01:45:07 +09:00
Hajime Hoshi
f6c2d899f1 ui: Bug fix: compile error on browsers and mobiles 2018-10-08 01:26:05 +09:00
Hajime Hoshi
4a5548a4a0 ui: MonitorSize should return the 'current' monitor size instead of the primary monitor size 2018-10-08 01:15:57 +09:00
Hajime Hoshi
f3b7148564 ui: Bug fix: DeviceScaleFactor should return the current monitor's scale 2018-10-08 01:11:13 +09:00
Hajime Hoshi
16a9bac487 ui: Remove deviceScale struct 2018-10-08 01:03:18 +09:00
Hajime Hoshi
effd530026 ui: Show the window on the current monitor (#704)
Tested on macOS. This doesn't work on Windows yet since there are
some codes that depends on the primary monitor.
2018-10-08 00:46:01 +09:00
Hajime Hoshi
fb7a3f2736 ui: Bug fix: Call SetPos multiple times to render correctly (#703) 2018-10-08 00:25:21 +09:00
Hajime Hoshi
e0d2d5e753 ui: Bug fix: wrong scaling when a window move across monitors
Fixes #701
2018-10-07 23:05:20 +09:00
Hajime Hoshi
0e7dab3707 ui: Fix comment 2018-10-06 20:04:48 +09:00
Hajime Hoshi
f9edfd7d57 ui: Remove unused variables 2018-10-06 19:55:10 +09:00
Hajime Hoshi
cc336a4c38 ui: Use more stable way to determine the current monitor 2018-10-06 19:53:43 +09:00
Hajime Hoshi
55a397bd65 devicescale: Specify the monitor to get the scale
Fixes #695
2018-10-06 19:43:23 +09:00
Hajime Hoshi
b99cc6ca8e ui: Bug fix: compile error on mobiles 2018-10-06 18:26:22 +09:00
Hajime Hoshi
ca2fe22e4a ui: Bug fix: Set the proper window position when coming back from fullscreen 2018-10-06 03:53:34 +09:00
Hajime Hoshi
7ea1ab6b58 ui: Bug fix: currentMonitor should not return nil
Fixes #700
2018-10-06 03:22:33 +09:00
Hajime Hoshi
cae9e39453 ui: Use the best suitable monitor for fullscreen
This change also changes the definition of MonitorSize.
2018-10-06 02:59:38 +09:00
Hajime Hoshi
16f6aeaa4a ui: Refactoring: Use the current monitor 2018-10-06 02:38:02 +09:00
Hajime Hoshi
1807a3f530 devicescale: Rename function 2018-10-04 01:28:53 +09:00
Hajime Hoshi
10b49bb0a3 ui: Don't call devicescale.DeviceScale too often 2018-10-03 04:29:12 +09:00
Hajime Hoshi
02a2fc2d44 ui: Bug fix: Force to adjust window size when scale is changed
Fixes #644
2018-10-03 03:26:11 +09:00
Hajime Hoshi
c494b53822 ui: Refactoring: Add deviceScale struct 2018-10-02 23:06:56 +09:00
Hajime Hoshi
635d624b77 ui: Update device scale on browsers (#644) 2018-10-02 11:43:45 +09:00
Hajime Hoshi
21c1ee5dfb ui: Cache devicescale value on mobiles 2018-10-02 03:51:13 +09:00
Hajime Hoshi
9906c935f6 ui: Remove unnecessary lock protection 2018-10-02 03:25:30 +09:00
Hajime Hoshi
fce82e1502 ui: Use frame counter to update device scale 2018-10-02 03:21:59 +09:00
Hajime Hoshi
78f2946797 ui: Bug fix: timer condition was wrong 2018-10-02 02:53:17 +09:00
Hajime Hoshi
bf850e12a4 ui: Recalc device scale repeatedly for multiple displays (#644) 2018-10-02 02:49:08 +09:00
Hajime Hoshi
308c8091cd ui: Fix comments 2018-09-30 18:53:38 +09:00
Hajime Hoshi
803e42714e input: Implement wheel event on browsers
Fixes #630
2018-09-30 17:08:18 +09:00
Hajime Hoshi
25a5f1dd83 ui: Sleep when vsync doesn't work (#692) 2018-09-30 14:44:54 +09:00
Hajime Hoshi
15260537a2 graphics: Bug fix: fullscreen rendering was wrong
After fad65f2f5d, the viewport size
is always same as the framebuffer size. The 'screen' image size
was the actual rendering region size, and padding was not
considered in the size. The padding is added on the fullscreen
mode.

This fix adds the extra padding values to the 'screen' image size
so that the 'screen' framebuffer will be same size as the monitor
size.

Fixes #693
2018-09-29 21:47:41 +09:00
Hajime Hoshi
eb68cdad6e ui: Bug fix: Freezing on calling SetVsyncEnabled 2018-07-17 02:37:22 +09:00
Hajime Hoshi
09c93ac86d ui: Avoid using eval 2018-07-14 23:47:31 +09:00
Hajime Hoshi
e25c237a01 Add IsVsyncEnabled / SetVsyncEnabled
This enables the game to work more efficiently (but consume much
more CPU).

Fixes #405.
2018-07-14 21:43:55 +09:00
Hajime Hoshi
6e51d31524
Use new GopherWasm API (#634)
I plan to merge this right after
https://github.com/gopherjs/gopherwasm/pull/3 is merged.
2018-06-30 00:02:15 +09:00
Hajime Hoshi
f19e349d38 web: Remove IsNodeJS
gjbt now creates a pseudo-Node environment by creating
window.process object, and this conflicted with an assumption that
Ebiten doesn't nothing on Node environment. See
https://github.com/myitcv/gjbt/pull/13 for the detail.

This change allows Ebiten work on pseudo-Node environment. Even
after this change, Ebiten doesn't work on real Node environment
due to lack of DOM.
2018-06-28 00:12:24 +09:00
Hajime Hoshi
a9359e4ef8 Use GopherJS/GopherWasm 2018-06-24 16:10:24 +09:00
Hajime Hoshi
8d644479cc opengl: Initialize consts first to avoid 'Get' calls 2018-06-19 04:02:56 +09:00
Hajime Hoshi
62bd35e412 Avoid 'Get' call if possible
(*js.Value).Get has some overhead especially on Wasm.
2018-06-19 03:43:24 +09:00
Philipp Steinhaus
39b3170185 input: Enable mouse wheel input (#628) 2018-06-18 00:38:30 +09:00
Hajime Hoshi
b87a851c0e ui: New GopherWASM API 2018-06-16 00:26:28 +09:00
Hajime Hoshi
be665a3526 ui: Better way to avoid blocking
Fixes #625
2018-06-09 13:36:35 +09:00
Hajime Hoshi
6e12f287b0 ui: Use goroutine to avoid blocking on GopherJS 2018-06-09 03:05:37 +09:00
Hajime Hoshi
311788dfe2 ui: Remove warnings of deadlock
Now gopherwasm fixed this problem by avoiding js.MakeFunc.

See also: 3fe87b73c0
2018-05-27 04:10:14 +09:00
Hajime Hoshi
8e9c3bd304 ui: Use gopherwasm 2018-05-27 02:35:17 +09:00
Hajime Hoshi
5976e4bbbc audio: More intellegent suspending/resuming (#617)
Before this change, the audio is suspended when the game stops for
1/12[s]. However, as game often stops for more than 1/12[s]
especially on mobiles, this implemntation caused some audio
glitches.

This change fixes this problem by re-implementing suspending/
resumeing audio by detecting the window is active/focused or not.
2018-05-26 23:31:04 +09:00
Hajime Hoshi
d88d1be4ad mobile: Refactoring 2018-05-26 22:51:30 +09:00
Hajime Hoshi
c2df8326fc ui: Refactoring: Use IsNodeJS 2018-05-16 22:02:33 +09:00
Hajime Hoshi
3ccfe087d9 Refactoring 2018-05-12 15:25:01 +09:00
Hajime Hoshi
453921f1d3 ui: Bug fix: sizeChange must be set after updateFullscreenScaleIfNeeded 2018-05-12 02:11:37 +09:00
Hajime Hoshi
d8dba69b47 ui: Add MonitorSize
Fixes #470
2018-05-05 02:42:45 +09:00
Hajime Hoshi
d41f959b96 ui: Initialize GLFW before Run 2018-05-04 23:55:23 +09:00
Hajime Hoshi
9efccea31c ui: Add SetWindowTitle
Fixes #595
2018-05-02 19:21:17 +09:00
Hajime Hoshi
899f007fd0 ui: Panic when error is found on mobile 2018-04-07 03:33:20 +09:00
Hajime Hoshi
2d3c6ab5b8 ui: Remove build tag 'gomobilebuild'
Fixes #573
2018-04-07 02:14:54 +09:00
Hajime Hoshi
fcf4657a70 ui: Adjust touch positions at ui package (mobile) 2018-04-03 01:50:07 +09:00
Hajime Hoshi
76cb43a7f8 input: Refactoring: Remove unused arguments 2018-04-03 01:21:52 +09:00
Hajime Hoshi
0f2beab260 ui: Adjust touch positions in ui package (js) 2018-04-03 00:53:09 +09:00
Hajime Hoshi
c540d0fc0d ui: Add AdjustedTouches for consistency 2018-04-02 01:54:44 +09:00
Hajime Hoshi
7d2fd9654a input: Adjust mouse cursor position in ui package 2018-04-01 23:53:26 +09:00
Hajime Hoshi
4de2dc0240 Add input package 2018-04-01 23:20:45 +09:00
Hajime Hoshi
2110191794 mobile: Accept gomobile build (#249) 2018-03-24 02:52:42 +09:00
Hajime Hoshi
5ec5cf2450 ui: Add comments 2018-03-17 18:34:20 +09:00
Hajime Hoshi
526fbd3619 ui: Implement SetWindowDecorated and IsWindowDecorated
Fixes #430.
2018-03-17 18:30:55 +09:00
Hajime Hoshi
ef5de62780 Follow the standard comment rule
See https://golang.org/s/generatedcode
2018-03-08 02:47:59 +09:00
Hajime Hoshi
4c1cc9e699 ui: Bug fix: exit update function once when the context is lost (#526) 2018-03-02 01:05:54 +09:00
Hajime Hoshi
0cc456b534 ui: Rename sizeChanged -> toChangeSize 2018-02-25 00:44:45 +09:00
Hajime Hoshi
04341a014c ui: Add comments 2018-02-25 00:44:41 +09:00
Hajime Hoshi
a644e92298 restorable: Better calculation to clear restorable.Image 2018-02-24 21:16:30 +09:00
Hajime Hoshi
692f36f664 graphics: Add comments 2018-02-24 20:40:26 +09:00
Hajime Hoshi
78a58fd1ae ui: Bug fix: userInterface.fullscreen() must be called from the main thread 2018-02-24 18:10:39 +09:00
Hajime Hoshi
a87f197c1b ui: Add TODO 2018-02-24 14:50:45 +09:00
Hajime Hoshi
d4b8b99784 ui: Bug fix: return is needed for Edge case
Fixes #507
2018-02-21 21:53:49 +09:00
Hajime Hoshi
cc423c276d ui: Avoid creating empty slice at Touches 2018-02-12 20:23:24 +09:00
Hajime Hoshi
7d9b901ab3 ui: Avoid creating empty slice at GamepadIDs 2018-02-12 20:20:39 +09:00
Hajime Hoshi
e3023889ac ui: Change RegularTermination to a value 2018-02-04 00:22:38 +09:00
Hajime Hoshi
8b2ed6cddd ui: Update GraphicsContext every frame (#490) 2018-02-02 02:08:03 +09:00
Hajime Hoshi
38c72faf95 ui: Deprecate SetCursorVisibility and add SetCursorVisible (#407) 2018-01-09 02:01:33 +09:00
Hajime Hoshi
0a911b28b2 ui: Remove unneeded variable deviceScale 2018-01-07 14:51:25 +09:00
Hajime Hoshi
34d2e9a3fb ui: Remove unused function 2018-01-07 05:25:29 +09:00
Hajime Hoshi
0469ef386b ui: Fix comment 2018-01-06 23:53:35 +09:00
Hajime Hoshi
9ec0785203 Rename files _xwindow.go to _unix.go 2018-01-03 23:38:47 +09:00
Hajime Hoshi
a64367f906 ui: Refactoring: remove an unneeded member 2018-01-03 17:35:34 +09:00
Hajime Hoshi
c82809867d Add internal/devicescale 2018-01-03 05:22:56 +09:00
Hajime Hoshi
9578307d7b ui: Organize members 2018-01-03 00:23:18 +09:00
Hajime Hoshi
9478801076 ui: Implement SetScreenSize/Scale for mobiles
Fixes #250
2017-12-31 21:01:48 +09:00
Hajime Hoshi
473aeaa8b1 ui: Remove unneeded early return 2017-12-31 18:37:04 +09:00
Hajime Hoshi
362f002d36 ui: Delete local variables asap on Android 2017-11-13 01:30:08 +09:00
Hajime Hoshi
cea9bd5a19 input: Bug fix: runeBuffer should be reset on each frame 2017-11-10 01:21:15 +09:00
Hajime Hoshi
4b83a060fe ui: Add more keys not for charCode 2017-11-10 00:46:37 +09:00
Hajime Hoshi
fb8bef99c3 ui: Bug fix: key event on Edge browser 2017-11-10 00:39:46 +09:00
Hajime Hoshi
37ca48dc38 ui: Rename functions from Safari to Edge 2017-11-10 00:35:46 +09:00
Hajime Hoshi
0c0cd7e9d6 ui: Bug fix: call preventDefault for arrow keys
Fixes #450
2017-11-10 00:32:47 +09:00
Hajime Hoshi
ededc5874b ui: Bug fix: Scale was wrong when magnifier is enabled
Fixes #244
2017-11-09 02:06:35 +09:00
Hajime Hoshi
7bcc9ee79f ui: Add GamepadIDs and remove IsGamepadPresent (#447) 2017-10-26 23:59:09 +09:00
Hajime Hoshi
600baf2cc7 ui: Add IsGamepadPresent
Fixes #447
2017-10-26 02:59:33 +09:00
Hajime Hoshi
05e220e105 ui: Allow smaller window width (#444) 2017-10-20 03:25:21 +09:00
Hajime Hoshi
414170b138 ui: Refactoring 2017-10-20 02:50:39 +09:00
Hajime Hoshi
b590005c7a opengl: BindFramebuffer no longer returns error 2017-09-25 00:14:25 +09:00
Hajime Hoshi
835d199f02 ui: Rename SetIcon to SetWindowIcon (#386) 2017-09-23 17:40:09 +09:00
Hajime Hoshi
dacda0d176 ui: Add SetIcon (#386) 2017-09-23 04:28:57 +09:00
Hajime Hoshi
0dcba7844b ui: Bug fix: SetScreenSize didn't work on browsers
This fixes #427
2017-09-07 11:58:04 +09:00
1l0
5d2393c3c1 glfw: Add StickyModes to window.InputMode (resolve #314 #399) (#423) 2017-08-28 23:29:19 +09:00
Hajime Hoshi
99d170b454 ui: Remove isSafari that is not used anywhere 2017-08-27 02:14:23 +09:00
Hajime Hoshi
bb6dfeefd4 ui: Add comments on Touches 2017-08-22 00:58:38 +09:00
Jake
0d703ca3d4 InputChars (#403)
This implements #400
2017-08-15 04:11:51 +09:00
Hajime Hoshi
5f538bff82 ui: Bug fix: initCursorVisible must be true by default 2017-08-12 18:32:51 +09:00
Hajime Hoshi
783e57d3f2 ui: Remove 'fullscreen' member variable 2017-08-12 18:31:16 +09:00
Hajime Hoshi
b186bc1e94 ui: Add IsCursorVisible (#377) 2017-08-12 15:45:16 +09:00
Hajime Hoshi
f0d47312c4 ui: Add IsRunnableInBackground / SetRunnableInBackground (#272) 2017-08-03 03:21:51 +09:00
Hajime Hoshi
bb5036b3e1 ui: Refactoring 2017-08-03 01:07:04 +09:00
Hajime Hoshi
1021521591 ui: initFullscreen should always be protected by lock 2017-08-03 00:19:04 +09:00
Hajime Hoshi
434d5bb00b ui: Bug fix: SetFullscreen / IsFullscreen should be concurrent safe; IsFullscreen should return the correct value even before Run 2017-08-02 23:48:08 +09:00
Hajime Hoshi
807d03eb3b ui: Delay initialize until Run (#397) 2017-07-30 20:26:40 +09:00
Hajime Hoshi
3bfb5054af Fix misspelling 2017-07-23 22:50:18 +09:00
Hajime Hoshi
5ae03494f2 ui: Resize canvas size when the window is resized (#387) 2017-07-22 02:04:15 +09:00
Hajime Hoshi
63e3bc73d6 ui: Implement fullscreen for browsers (#387) 2017-07-22 01:52:08 +09:00
Hajime Hoshi
f591ca3d2b ui: Bug fix: SetFullscreen didn't work without Run 2017-07-15 21:43:33 +09:00
Hajime Hoshi
c94c994bd1 ui: Allow SetFullscreen without Run 2017-07-15 20:29:13 +09:00
Hajime Hoshi
e582a661c9 ui: Bug fix: Should add <meta> to <head> instead of <body> 2017-07-02 04:18:43 +09:00
Hajime Hoshi
d6466fdcaf ui: Bug fix: initial scale must be 1 for proper scaling 2017-07-02 04:08:25 +09:00
Hajime Hoshi
d7b7aac6e4 ui: Fix wrong comment 2017-07-01 13:03:27 +09:00
Hajime Hoshi
7d236950c2 ui: Bug fix: SwapInterval needs to be called after SetMonitor (#357) 2017-07-01 12:41:16 +09:00
Hajime Hoshi
ba204c6d3b ui: Adjust cursor positoin on fullscreen mode (#374) 2017-07-01 04:27:38 +09:00
Hajime Hoshi
c694851765 ui: Center the screen on fullscreen mode (#374) 2017-07-01 04:12:09 +09:00
Hajime Hoshi
3168af1db4 ui: Refactoring: refresh rate is ignored when no monitor is specified at SetMonitor 2017-06-30 23:20:53 +09:00
Hajime Hoshi
68fbf59720 ui: Refactoring 2017-06-30 11:07:19 +09:00
Hajime Hoshi
cefa86ce13 ui: Fullscreen scale can be recalculated during fullscreen mode 2017-06-30 10:54:13 +09:00
Hajime Hoshi
6336b59493 ui: Bug fix: original positions must not be updated during fullscreen mode (#376) 2017-06-30 10:48:18 +09:00
Hajime Hoshi
af8b5d72c3 ui: Bug fix: Fullscreen scale must be recalculated 2017-06-30 10:22:30 +09:00
Hajime Hoshi
76da09f74c ui: Bug fix: Window title might lost on macOS (#267) 2017-06-30 02:14:14 +09:00
Hajime Hoshi
64ed7b93f6 ui: Bug fix: better restoring position (#267) 2017-06-30 02:11:54 +09:00
Hajime Hoshi
1d60c009ed ui: Bug fix: fullscreen scale calculation was wrong (#267) 2017-06-30 02:08:12 +09:00
Hajime Hoshi
2996f778b6 ui: Bug fix: position was wrong when changing window size 2017-06-30 01:53:14 +09:00
Hajime Hoshi
5b6fa2d384 ui: Adjust cursor position on fullscreen (#267) 2017-06-30 01:39:26 +09:00
Hajime Hoshi
e7370d8a54 ui: Adjust fullscreen scale (#267) 2017-06-30 01:28:35 +09:00
Hajime Hoshi
5dbfafb200 ui: Reserve window position before entering fullscreen-mode (#267) 2017-06-30 01:28:03 +09:00
Hajime Hoshi
b569eb9c5a ui: Add SetFullscreen / IsFullscreen (#267) 2017-06-30 01:28:00 +09:00
Hajime Hoshi
d0f086323b ui: Use returning values 2017-06-30 00:37:24 +09:00