Commit Graph

103 Commits

Author SHA1 Message Date
Hajime Hoshi
49c3c30c79 ebiten: Add IsWindowBeingClosed / SetWindowClosingHandled / IsWindowClosingHandled
IsWindowBeingClosed reports whether the window is being closed by
the user.

SetWindowClosingHandled sets whether the window closing is handled
or not. If the state is true, the window is not closed immediately
by the user and the game can handle the closing state. In this case,
the Update function should return an error in order to end the game.

This change also adds examples/windowclosing.

Closes #1574
2021-06-14 02:29:11 +09:00
Tom Lister
bea5ab3335
internal/uidriver/glfw: Native macOS implementation for setting cursor shape (#1624)
Updates #1624
2021-05-02 14:50:50 +09:00
Hajime Hoshi
9b6ba5ed2c ebiten: Add {Set,}WindowSizeLimits
Closes #1385
2021-04-17 03:58:06 +09:00
Hajime Hoshi
d00d0c8556 ebiten: Add CursorShape/SetCursorShape/CursorShapeType
This change adds APIs to enable to use system cursor shapes other
than the default shape (an arrow).

This change doesn't add these cursors since they seem a little
different on macOS from the other platforms.

 * GLFW_HRESIZE_CURSOR
 * GLFW_VRESIZE_CURSOR

Closes #995
2021-04-16 01:09:19 +09:00
Hajime Hoshi
4398a5e227 ebiten: Change the key name convention to follow the Web standard
Closes #1394
2021-04-14 22:49:07 +09:00
Hajime Hoshi
7934c3b22b internal/driver: Clean CursorMode values up 2021-04-11 03:29:14 +09:00
Hajime Hoshi
6b3c51921c internal/driver: Remove Image.Sync
Syncing is no longer needed for Metal, and additionally, OpenGL's sync
implementation was mock.

Updates #1508
2021-02-26 23:16:28 +09:00
Hajime Hoshi
a0a8d41ff6 uidriver/js: Force to update the screen when resizing
Updates #1204
2021-01-18 01:17:58 +09:00
Hajime Hoshi
2ea360b921 Revert "driver: Increase gamepad buttons to 64"
This reverts commit 62b199f9eb.

Reason: This seems my misunderstanding.
2020-12-29 02:49:58 +09:00
Hajime Hoshi
62b199f9eb driver: Increase gamepad buttons to 64
e.g. Nintendo Switch controller can have more than 32 buttons.
2020-12-27 21:56:08 +09:00
Hajime Hoshi
ed028110cf ebiten: Allow rendering on a sub-image by scissor test
Fixes #1255
2020-11-08 00:58:44 +09:00
Hajime Hoshi
a8f96ee9af graphicsdriver/metal: Add Sync to sync CPU and GPU asynchronously
Fixes #1414
2020-11-07 04:09:47 +09:00
Hajime Hoshi
1864c22ad6 uidriver/glfw: Reduce (*thread).Call at (*Input).update 2020-10-17 05:22:23 +09:00
Hajime Hoshi
770661c609 driver: Refactoring: Remove (UIContext).Draw 2020-10-15 01:27:50 +09:00
Hajime Hoshi
eed619ad0f graphicsdriver/metal, graphicsdriver/opengl: Reland: Remove the thread usages for performance
Instead, graphicscommand package has a thread.

Updates #1367
2020-10-13 02:46:31 +09:00
Hajime Hoshi
713eee1117 Revert "graphicsdriver/metal, graphicsdriver/opengl: Remove the thread usages for performance"
This reverts commit 2942f10d9d.

Reason: Compile error on mobiles and runtime error on browsers
2020-10-13 02:12:02 +09:00
Hajime Hoshi
2942f10d9d graphicsdriver/metal, graphicsdriver/opengl: Remove the thread usages for performance
Instead, graphicscommand package has a thread.

Updates #1367
2020-10-13 01:50:54 +09:00
Hajime Hoshi
5ee3fdf628 ebiten: Add KeySuper
Fixes #1382
2020-10-11 18:40:40 +09:00
Hajime Hoshi
b1c67c7661 ebiten: Introduce type TouchID
Fixes #604
2020-10-10 03:57:47 +09:00
Hajime Hoshi
809b7a3afa ebiten: Introduce type GamepadID
Updates #604
2020-10-08 01:57:08 +09:00
Hajime Hoshi
448a863eb1 ebiten: Remove FilterDefault
Fixes #503
2020-10-05 01:48:47 +09:00
Hajime Hoshi
2dadc6a7a9 ebiten: Make AddressUnsafe default
Fixes #1228
2020-10-04 23:49:35 +09:00
Hajime Hoshi
bf515bb594 Update version to v2.0.0-alpha 2020-10-04 04:30:40 +09:00
Hajime Hoshi
77fa0cb9ef ui: Add SetInitFocused
Fixes #769
2020-08-23 02:19:09 +09:00
Hajime Hoshi
69f87d5fd1 ebiten: Add new shader builtin functions: image[N]TextureBoundAt
Fixes #1287
2020-08-11 03:24:54 +09:00
Hajime Hoshi
36e9803cea shader: Enable to get pixels from multiple images
Updates #1193
2020-07-19 02:33:43 +09:00
nanoslayer
72babcd420
ebiten: Add CompositeModeMultiply (#1251)
This change adds a new composite mode called `CompositeModeMultiply`,
which multiplies the source color with the destination color.

This is tested on Linux and Windows only.

Fixes #410
2020-07-18 21:37:17 +09:00
Hajime Hoshi
e0d5763a60 shader: Use the fixed number of images for shaders
This changes uses arrays rather than slices in order to avoid heap
allocations.

Updates #1193
2020-07-18 18:27:47 +09:00
Hajime Hoshi
7f70797a6d ebiten: Rename DrawTriaglesWithShaderOptions.Textures to Images 2020-07-15 03:49:05 +09:00
Hajime Hoshi
d217bc6033 ebiten: Sparate textures from uniforms at DrawTrianglesWithShader
Updates #1193
Updates #1239
2020-07-09 01:59:21 +09:00
Hajime Hoshi
71c9e7ac40 driver: Add Region and sourceRegion parameter at Draw
This is a preparation to remove source-region information from
vertices.

Updates #1210
2020-07-02 03:26:05 +09:00
Hajime Hoshi
2a63512c6e driver: Add AddressUnsafe
This skips the source-region check and reduces 'if' branches from
shader programs.

AddressUnsafe is internal only so far. We might expose this value
later.

Updates #1210
2020-06-25 01:00:38 +09:00
Hajime Hoshi
f80719ef9a driver: Use slices for uniform variables instead of maps
Fixes #1172
2020-05-26 23:50:11 +09:00
Hajime Hoshi
1a0d92267b driver: Add shader API and implement it on OpenGL
Updates #482
2020-05-23 22:09:12 +09:00
Hajime Hoshi
8fd377f1e3 driver: Add ImageID and use this
This is a preparation to introduce shaders. Shader programs
require images as uniform variables, but the current way would make
API complex unnecessarily.
2020-05-20 00:11:08 +09:00
Hajime Hoshi
8029dc352a driver: Use framebuffer's Y directions 2020-05-08 16:49:19 +09:00
Hajime Hoshi
33e850a6d4 driver: Bug fix: (Key).String might cause infinite loop 2020-04-22 00:32:35 +09:00
Hajime Hoshi
ea99743e0d driver: Add (Key).String() 2020-04-21 22:43:53 +09:00
Hajime Hoshi
7b77164710 restorable: Ignore the error when restoring failed due to being not ready
(driver.Graphics).BeginFrame tries to restore the images, but
the context might be lost at that time yet. If the attempt to
restore the context because the driver is not ready, return
silently.

Fixes #1133
2020-04-12 20:01:18 +09:00
Hajime Hoshi
8777140e91 driver: Simplify UIContext.Update 2020-04-03 00:18:27 +09:00
Hajime Hoshi
5ad9868d85 driver: Refactoring: Reorder functions 2020-04-01 21:28:00 +09:00
Hajime Hoshi
a718ddbf7e driver: Add UIDriver.Draw
This is a preparation for XNA.

Updates #1078
2020-04-01 02:55:50 +09:00
Hajime Hoshi
7b5fb0a0d0 ui: Bug fix: The window was not shown on the secondary monitor on launching
This change changes the behavior of WindowPosition /
SetWindowPosition. The window position is now a relative position
and the origin position is the left-upper of the current monitor.

Fixes #1115
2020-03-28 19:51:47 +09:00
Hajime Hoshi
8fcee54849 mobile/ebitenmobileview: Implement Android gamepad buttons
This is still work in progress.

Updates #1083
2020-03-23 01:30:17 +09:00
Hajime Hoshi
f317f3b5fd ui: Add fuctions to maximize or minimize the window
This change adds these functions:

  * MaximizeWindow
  * IsWindowMaximized
  * MinimizeWIndow
  * IsWindowMinimized
  * RestoreWindow

Fixes #994
2020-03-21 22:13:58 +09:00
Hajime Hoshi
978ee26898 ui: Add function aliases *OnUnfocused for *InBackground
Now a window can be floating with SetWindowFloating, the functions
that have suffix 'IsBackground' seems misleading. However, we
cannot rename them due to backward compatibility. Then, let's add
aliases and revisit them when updating the major version of Ebiten.

Fixes #1102
2020-03-21 00:42:00 +09:00
Hajime Hoshi
56358fd0c4 ui: Rename IsForeground -> IsFocused
Updates #1102
2020-03-21 00:12:47 +09:00
Hajime Hoshi
4ef3b3e804 ui: Add SetWindowFloating / IsWindowFloating
Fixes #880
2020-03-20 22:16:27 +09:00
Hajime Hoshi
d59aea1db1 driver: Remove the return value from RunWithoutMainLoop 2020-02-11 23:56:53 +09:00
Hajime Hoshi
c927d33457 mobile/ebitenmobileview: Use the common uiContext for layouting
This means that the whole offscreen is cleared correctly.

This change is a little breaking change: SetScreenSize or other
functions no longer works on ebitenmobile. Use Layout instead.

Fixes #1019
2020-02-11 19:40:47 +09:00