Hajime Hoshi
982b7d6ddc
driver: Let UI have Graphics
...
Now UIs own the implementation of Graphics.
Updates #1026
2020-01-03 18:32:27 +09:00
zamadatix
c4dfc69c81
Typo Corrections from https://goreportcard.com/ ( #1042 )
...
Correct typo found by https://goreportcard.com/
2020-01-01 23:59:56 +09:00
Hajime Hoshi
9ed8279fc8
driver: Add interface Window
2019-12-25 00:24:21 +09:00
Hajime Hoshi
049aa552d4
ui: Add SetWindowResizable
...
This change also fixes example/windowsize.
Fixes #320
2019-12-22 19:26:04 +09:00
Hajime Hoshi
c9863284cf
uidriver/glfw: Set a default window size
...
Now RunGame can be called without SetWindowSize.
2019-12-22 12:51:36 +09:00
Hajime Hoshi
7d56e4335e
ui: Add RunGame, WindowSize and SetWindowSize
...
This change introduces the new APIs RunGame, WindowSize and
SetWindowSize. These new APIs hides the notion of 'scale', and is
more flexible with the outside size change. This means that we can
introduce a resizable window.
This change also adds -legacy flag to examples/windowsize. If the
flag is off, the new APIs are used.
This change deprecates these functions since the notion of 'scale'
is deprecated:
* ScreenScale
* ScreenSizeInFullscreen
* SetScreenScale
* SetScreenSize
Fixes #943 , #571
Updates #320
2019-12-22 03:35:31 +09:00
Hajime Hoshi
57d527bea2
driver: Remove 'title' argument from UI.Run
2019-12-22 01:41:51 +09:00
Hajime Hoshi
8b995b086b
driver: Remove some arguments from UI.Run
2019-12-21 22:52:23 +09:00
Hajime Hoshi
8013fef9ea
uidriver: Bug fix: Needed to implement MonitorPosition
2019-12-21 21:15:58 +09:00
Hajime Hoshi
dabaf66b81
uidriver: Remove width/height/scale arguments from run
...
The initial window position is determined on ebiten package side.
Updates #943
2019-12-21 20:10:58 +09:00
Hajime Hoshi
d07028735f
uidriver/glfw: Refactoring
2019-12-21 19:52:07 +09:00
Hajime Hoshi
987f333d95
uidriver/glfw: Rename variables
2019-12-21 17:34:58 +09:00
Hajime Hoshi
2e8358529c
uidriver/glfw: Bug fix: WindowPos/SetWindowPos should convert pixels
...
This change also enables these functions even on fullscreen mode.
Fixes #1010
2019-12-21 17:03:19 +09:00
Hajime Hoshi
85cbc7e56b
Enable to compile Ebiten on js/wasm with Go 1.14
...
Fixes #1024
2019-12-19 00:45:53 +09:00
Hajime Hoshi
9486defdae
uidriver/mobile: Rely on uiContext's Layout function to determine the screen size
2019-12-17 02:16:45 +09:00
Hajime Hoshi
6a8013ed37
ui: Reduce arguments from newUIContext
2019-12-16 11:12:38 +09:00
Hajime Hoshi
bda11b0e17
driver: Add UI.SetWindowSize and UIContext.Layout
...
This is a preparation to introduce RunGame function.
Updates # 943 (Fix this line before committing)
2019-12-15 02:29:43 +09:00
Hajime Hoshi
d8f02cf03e
uidriver/js: Bug fix: Compile error on CursorMode
2019-12-14 12:54:21 +09:00
Zachary Burkett
ed19d6fae9
Add cursor capture functionality ( #1016 )
...
Fixes #1016
2019-12-14 12:30:03 +09:00
Hajime Hoshi
ba0e8ef13f
uidriver/mobile: Refactoring: Rename variables
2019-12-13 02:50:57 +09:00
Hajime Hoshi
2871795895
uidriver/glfw: Refactoring: Remove mutex from Input
...
Mixing a thread and a mutex is risky. Use a thread if possible.
2019-12-12 03:20:24 +09:00
Hajime Hoshi
00fb4cd2f9
uidriver/glfw: Refactoring: Remove windowWidthInDP
2019-12-09 01:39:42 +09:00
Hajime Hoshi
190feb6ecd
uidriver/glfw: Rename variables
...
DP represents a device independent pixel.
2019-12-09 00:19:38 +09:00
Hajime Hoshi
7d403930af
uidriver/glfw: Bug fix: Compile errors on Windows and Linux
2019-12-08 23:20:09 +09:00
Hajime Hoshi
c243bfcdd8
uidriver/glfw: Fix comments
2019-12-08 23:03:13 +09:00
Hajime Hoshi
3e89e7e561
uidriver/glfw: Bug fix: Show the window at last on initialization
2019-12-08 23:00:10 +09:00
Hajime Hoshi
e00a190f22
uidriver/glfw: Refactoring: Add toDeviceIndependentPixel / toDeviceDependentPixel
2019-12-08 22:09:12 +09:00
Hajime Hoshi
a0cf8bac21
uidriver/glfw: Refactoring: Limit the calls of devicescale.GetAt
2019-12-08 20:55:40 +09:00
Hajime Hoshi
8e9f5b9535
driver: Remove Suspend/ResumeAudio from UIContext
2019-12-08 16:17:02 +09:00
Hajime Hoshi
63fbffa9f6
uidriver/glfw: Fix thread issues at reqWidth/reqHeight
2019-12-08 02:44:14 +09:00
Hajime Hoshi
22e3db6814
uidriver/glfw: Add comments
...
Updates #1004
2019-12-08 02:04:04 +09:00
Hajime Hoshi
80fbc9701c
uidriver/glfw: Force to swap buffer or recreate an window after toggling fullscreen
...
This change resolves a bug that an image lag remains after
toggling fullscreen.
On OpenGL, swapping buffer is necessary after toggling fullscreen.
On Metal, recreating a window works after toggling fullscreen.
Fixes #1004
2019-12-08 01:47:32 +09:00
Hajime Hoshi
2180613e2a
uidriver/glfw: Refactoring: Add createWindow
2019-12-07 19:56:56 +09:00
Hajime Hoshi
67ee0ff5d4
uidriver/glfw: Refactoring: Remove forceSetScreenSize
2019-12-07 17:35:57 +09:00
Hajime Hoshi
b35ffa57b3
Revert "uidriver/glfw: Remove the dirty hack for GLFW 3.2"
...
This reverts commit d1da5b4920
.
Reason: The dirty hack might still be needed.
2019-12-02 01:06:55 +09:00
Hajime Hoshi
d1da5b4920
uidriver/glfw: Remove the dirty hack for GLFW 3.2
...
See also https://github.com/glfw/glfw/issues/1334 .
Updates #703
2019-12-02 01:04:28 +09:00
Hajime Hoshi
5153713469
uidriver/glfw: Make the panic messages more consistent
2019-12-01 03:34:09 +09:00
Hajime Hoshi
0ec447e0d0
ui: Add SetScreenTransparent / IsScreenTransparent
...
Fixes #1001
2019-12-01 03:31:32 +09:00
Hajime Hoshi
b8a099e354
ui: Bug fix: (Set)WindowPosition didn't work well with fullscreen mode
2019-12-01 00:39:04 +09:00
Hajime Hoshi
6cd0b44baa
uidriver/glfw: Use invalidPos instead of pointers
2019-12-01 00:21:11 +09:00
Hajime Hoshi
e463f9e611
ui: Make (Set)WindowPosition concurrent safe
2019-12-01 00:11:46 +09:00
Hajime Hoshi
9b2f864fc8
ui: Add SetWindowPosition(x, y int)
...
Fixes #936
2019-11-30 23:22:39 +09:00
Hajime Hoshi
c021d6be6a
ui: Add WindowPosition()
...
Fixes #936
2019-11-30 22:37:56 +09:00
Hajime Hoshi
e0d780b029
uidriver/glfw: Enable to call SetWindowDecorated after Run
...
Fixes #556
2019-11-26 11:46:18 +09:00
Hajime Hoshi
a040aae83b
glfw: Update to GLFW 3.3
...
Fixes #1000
2019-11-26 01:19:20 +09:00
Hajime Hoshi
725cc22200
uidriver/mobile: Rename Render -> Update
2019-11-17 21:52:06 +09:00
Hajime Hoshi
92e056c508
uidriver/glfw: Bug fix: an unexpected window at launching
...
Fixes #986
2019-11-17 19:58:44 +09:00
Hajime Hoshi
800b98a0c6
ui: Bug fix: a window was alwasy 'unfocused' on Windows
...
There is an issue in GLFW that a window was recognized as unfoces
on Windows (glfw/glfw#1573). As a workaround, skip the logic for
an unfocused window on Windows. On Windows, even if a window is in
another workspace, vsync works. Then there seems no problem.
Fixes #987
2019-11-17 14:10:38 +09:00
Hajime Hoshi
bfd5774faf
graphicsdriver/glfw: Bug fix: CPU was busy when the window is hidden
...
Fixes #982
2019-11-14 23:11:36 +09:00
Hajime Hoshi
a1a294df72
uidriver/glfw: Bug fix: Freeze on Wayland
...
Fixes #974
2019-11-10 19:26:49 +09:00
Hajime Hoshi
572780ed6d
uidriver/glfw: Bug fix: errors are ignored at (*UserInterface).run
...
Updates #978
2019-11-10 19:09:41 +09:00
Hajime Hoshi
d43e203ccf
uidriver/glfw: Remove a redundant 'if' branch
2019-11-10 17:34:14 +09:00
Hajime Hoshi
49a5a2bf4e
uidriver/js: Bug fix: Needed to initialize pseudoScale with the given scale
...
Updates #960 , #973
2019-10-27 17:16:49 +09:00
Hajime Hoshi
e7611139c3
uidriver/js: Bug fix: Watch the state regularly instead of events
...
visibilitystate is sometimes not called and in this case the app
does not come back.
This fix creates another goroutine to watch the state, and remove
event handlers.
Fixes #961
2019-10-21 00:04:07 +09:00
Hajime Hoshi
43a8881ab8
uidriver/ui: Reduce calls of syscall/js
2019-10-16 02:56:58 +09:00
Hajime Hoshi
72248fa3ef
ui: Bug fix: Focus canvas explicitly on input
...
Fixes #961
2019-10-15 23:57:16 +09:00
Hajime Hoshi
75721e6fc1
ui: Auto scaling on browsers
...
This change forces Ebiten apps on browsers 'fullscreen' mode.
After this change, 'scale' value is no longer used on browsers.
Note that this breaks backward compatibility, but as long as the
game works in an iframe, this should not be problematic.
Fixes #960
2019-10-15 00:02:02 +09:00
Hajime Hoshi
30c185f254
uidriver/js: Bug fix: context must not be accessed before loop
2019-10-14 02:41:04 +09:00
Hajime Hoshi
3c976eae02
cmd/ebitenmobile: Use Metal on iOS
...
The emulators still use OpenGL.
Fixes #737
2019-10-09 02:13:47 +09:00
Hajime Hoshi
52900fac79
Move back driver getters to ebiten package
2019-09-03 01:46:11 +09:00
Hajime Hoshi
05f4ca2a4d
input: Refactoring: nameToJSKeyCodes -> nameToJSKeyCode
2019-09-02 00:30:17 +09:00
Hajime Hoshi
83b2d4b112
input: driver.Key now distinguishes left/right modifier keys
...
This is a preparation for event package, that will have key enum.
Updates #926
2019-09-01 23:49:00 +09:00
Hajime Hoshi
42c70e48ff
uidriver/mobile: No need to use sync.Once
...
devicescale.At is already locked by a mutex and keeps values in its
cache.
2019-08-19 02:32:53 +09:00
Hajime Hoshi
2c23860226
uidriver/mobile: Prefer sync.Once to sync.Mutex
2019-08-19 02:25:01 +09:00
Hajime Hoshi
d7aa24c295
uidriver/glfw: Bug fix: Wrong usage of RWLock
2019-08-19 01:47:55 +09:00
Hajime Hoshi
4d0e23c460
uidriver/glfw: Reduce mutex to avoid potential deadlock
2019-08-19 01:01:43 +09:00
Hajime Hoshi
25ac788ee6
uidriver/mobile: Reduce mutex to avoid potential deadlock
2019-08-19 00:32:52 +09:00
Hajime Hoshi
6cd74a9f4d
uidriver/mobile: Simplify updating logic
2019-08-19 00:13:56 +09:00
Hajime Hoshi
f835c8ce7f
uidriver/mobile: Convert a panic to an error for handling
...
This is a dirty hack but there is no other way to handle panics to
report to Crashlytics.
2019-08-13 11:30:50 +09:00
Hajime Hoshi
df8fdc855a
Bug fix: Compile error on GOOS=linux CGO_ENABLED=0
2019-08-01 08:17:58 +09:00
Hajime Hoshi
2003b7d292
Fix misspellings
2019-08-01 01:07:23 +09:00
Hajime Hoshi
de915a1736
Move driver getters to graphicsdriver/uidriver packages
...
This enables to add internal functions to these packages so that
the driver selector logics can be modified.
2019-08-01 00:40:59 +09:00
Hajime Hoshi
4a9a7f936d
Make go vet a little happier on macOS
...
Updates #889
2019-07-22 20:16:22 +09:00
Hajime Hoshi
e6a88a7d1f
uidriver/glfw: Add panic in the case of Windows Remote Desktop
...
Updates #903
2019-07-21 23:41:55 +09:00
Hajime Hoshi
480c5527a3
ui/mobile: Move 'DoWork' logic to ui/mobile package
...
This simplifies driver.Graphics interface, and will make it easy
to use another graphics driver than OpenGL.
2019-06-27 00:32:37 +09:00
Hajime Hoshi
de4b439228
uidriver/glfw: Bug fix: Thread must be set before the loop starts
...
The graphics driver needs to have its thread before the loop
starts, or the driver crashes (nil reference) when it tries to use
the thread.
2019-06-24 02:03:14 +09:00
Hajime Hoshi
8dc2301e54
thread: Bug fix: Queue funcs instead of panic
...
Now the thread object is created at (*UserInterface).Run, we don't
have to care whether the (main) thread is started or not when
Call is called. Admit queueing the functions.
Fixes #884
2019-06-21 11:10:27 +09:00
Hajime Hoshi
fa377ce9d1
mobile: Refactoring
2019-06-08 01:57:13 +09:00
Hajime Hoshi
449679665b
thread: Use standard context.Context
2019-06-08 01:46:06 +09:00
Hajime Hoshi
1e93d9c699
graphicsdriver/opengl: Use context.Context when possible
2019-06-08 01:30:15 +09:00
Hajime Hoshi
85dcafe176
thread: Rename Run -> Call
2019-06-06 00:25:57 +09:00
Hajime Hoshi
15a5896efd
thread: Rename mainthread -> thread and add struct Thread
...
This enables thread available not only for the main thread but also
any threads.
This is a preparation for iOS Metal, that runs drawing functions on
a particular thread.
Updates #737
2019-06-06 00:25:53 +09:00
Hajime Hoshi
dbd5e25b89
uidriver/mobile: Bug fix: Error must be handled whenever possible
...
Updates #860
2019-06-01 03:12:04 +09:00
Hajime Hoshi
2dc6042858
uidriver/mobile: Remove time-out logic
...
This was introduced at 8121b2102f
.
I am not sure the reason.
As Render must sync with updating and never returns until updating
finishes, the time-out case should never be chosen.
2019-06-01 01:47:01 +09:00
Hajime Hoshi
13ce1c28b4
uidriver/mobile: Use timer.NewTimer instead of time.After
...
timer.NewTimer is much better than time.After in terms of memory
usage. See also https://golang.org/pkg/time/#After
2019-06-01 01:30:08 +09:00
Hajime Hoshi
ca907e2846
uidriver/mobile: Refactoring
2019-06-01 00:21:59 +09:00
Hajime Hoshi
10fb5e33be
Replace GopherWasm with syscall/js
...
Fixes #857
2019-05-01 17:28:00 +09:00
Hajime Hoshi
865523048d
uidriver/js: Bug fix: Touches were not updated correctly
...
Fixes #846
2019-04-15 03:01:02 +09:00
Hajime Hoshi
db689f4e50
driver: Remove UI.Loop and add UI.RunWithoutMainLoop
2019-04-09 21:55:59 -04:00
Hajime Hoshi
864c28e8d9
Revert "uidriver/glfw: Rename ui_unix.go -> ui_linbsd.go"
...
This reverts commit 794ccd6ade
.
2019-04-09 01:06:07 -04:00
Hajime Hoshi
794ccd6ade
uidriver/glfw: Rename ui_unix.go -> ui_linbsd.go
2019-04-09 00:39:20 -04:00
Hajime Hoshi
24fdcdd8e4
uidriver: Rename updateGraphics -> updateSize
2019-04-08 23:49:31 -04:00
Hajime Hoshi
f6367308fc
driver: Rename GraphicsContext -> UIContext
2019-04-08 23:28:08 -04:00
Hajime Hoshi
aecfd6b13d
uidriver: Remove dependency on hooks package
2019-04-08 23:13:44 -04:00
Hajime Hoshi
099c7bd5c9
driver: Remove Touch struct
2019-04-07 19:25:10 -04:00
Hajime Hoshi
08308a7edf
uidriver/mobile: Refactoring
2019-04-07 18:51:32 -04:00
Hajime Hoshi
0aa3135082
driver: Remove UI.AdjustPosition
2019-04-07 19:31:49 +09:00
Hajime Hoshi
26c32d36b5
uidriver: Move input implementation to uidrivers
2019-04-07 19:16:00 +09:00
Hajime Hoshi
a1697feeb1
driver: Add UI.Input()
2019-04-07 18:37:54 +09:00
Hajime Hoshi
7e5085f15b
Add uidriver package and move UI implementation to this packaage
2019-04-07 18:21:16 +09:00