Commit Graph

728 Commits

Author SHA1 Message Date
Hajime Hoshi
8c49c88b08 internal/graphicsdriver/opengl: refactoring 2022-11-13 15:27:37 +09:00
Hajime Hoshi
42566c6c9a internal/graphicsdriver/opengl: refactoring: remove SetCanvas 2022-11-13 15:18:44 +09:00
Hajime Hoshi
a0a5f2b301 internal/graphicsdriver/opengl: remove SetGomobileGLContext
This change is needed to initialize the context at opengl.NewGraphics.

Updates #2451
2022-11-13 15:07:14 +09:00
Hajime Hoshi
1ecac8d834 all: allow integer uniform variables for Kage shaders
Closes #2305
Updates #2448
2022-11-13 01:49:24 +09:00
Hajime Hoshi
419bb4c1e9 all: use uint32 instead of float32 for uniform values
This is a preparation for other types of uniform values.

Updates #2305
2022-11-12 20:28:07 +09:00
Hajime Hoshi
0d6b42fedd internal/ui: refactoring: keep screen/offscreen sizes as float64
Updates #2285
2022-11-09 01:18:41 +09:00
TotallyGamerJet
8c5f525ac2
internal/ui: use RegisterClass API (#2442)
Updates #1162

This change uses purego's new RegisterClass API to clean up the
EbitengineWindowDelegate ObjC class. Doing so makes the code
easier to read and more efficient since it directly get the origResizable
and origDelegate fields.
2022-11-07 14:31:39 +09:00
Hajime Hoshi
58f95dd1e0 internal/ui: clean-up 2022-11-05 14:20:48 +09:00
Hajime Hoshi
cff99106b6 internal/ui: bug fix: fullscreening didn't work correctly on macOS 13
As of macOS 13, a retrieved collectionBehavior included
NSWindowCollectionBehaviorFullScreenNone and this prevented the window
from being fullscreen.

This change fixes this issue by removing the flag
NSWindowCollectionBehaviorFullScreenNone when necessary.

Closes #2437
2022-11-05 14:07:02 +09:00
Hajime Hoshi
50021ef3e4 internal/graphicscommand: use buffers for []float32 to reduce allocations 2022-11-04 21:55:44 +09:00
Hajime Hoshi
005e87a917 internal/ui: prepare extra capacities for uniform variables 2022-11-04 03:18:49 +09:00
Artem Yadelskyi
10415d417a
all: replace interface{} with any (#2430)
Closes #2429
2022-11-03 15:33:09 +09:00
Artem Yadelskyi
5b53cef59e
all: remove old // +build comments (#2431)
Closes #2325
2022-11-03 12:55:14 +09:00
Hajime Hoshi
ac08ebe080 internal/ui: set SwapInterval(0) when resizing the window
This mitigates flickering at least on macOS with OpenGL.

Updates #2144
2022-10-29 17:49:32 +09:00
Hajime Hoshi
066029539e internal/ui: clean-up code
A callback is preferred to a dirty flag.

Updates #2341
2022-10-28 19:07:37 +09:00
Hajime Hoshi
b019a3723a internal/ui: optimize GPU usages when the screen doesn't have to be updated
This change skips rendering when 1) the screen is not cleared every frame
(`SetScreenClearedEveryFrame(false)`) and 2) Draw doesn't draw anything
onto the screen. The GPU usages decreased on some machines (e.g. GPU usage
was 10% with an empty Ebitengine project and became 2-3 % on a Windows
machine).

Updates #2341
2022-10-28 18:51:06 +09:00
Hajime Hoshi
3b7bc2fc57 internal/ui: remove unnecessary comments 2022-10-23 00:39:37 +09:00
Hajime Hoshi
fc2f999ebf internal/ui: refactoring: separate globalState into a new file 2022-10-23 00:11:35 +09:00
Hajime Hoshi
422de70d59 internal/ui: bug fix: screenshot didn't include antialias renderings 2022-10-22 14:19:24 +09:00
Hajime Hoshi
c49db07e75 internal/ui: bug fix: wrong property name was used
Closes #2400
2022-10-21 21:37:27 +09:00
Hajime Hoshi
f04e391cb4 all: rename emptyImage -> whiteImage 2022-10-21 15:26:56 +09:00
Hajime Hoshi
a990d79905 internal/ui: refactoring 2022-10-21 03:11:13 +09:00
Hajime Hoshi
9ec23ddeb4 ebiten: add DrawTrianglesOptions.AntiAlias and DrawTrianglesShaderOptions.AntiAlias
Closes #2385
2022-10-21 02:07:41 +09:00
Hajime Hoshi
2855095ac9 all: unify terms for buffers and flushing 2022-10-16 19:47:00 +09:00
Hajime Hoshi
09a7d39874 internal/graphicsdriver: add Blend struct
This is a preparation to specify blend factors and blend operators.

Updates #2382
2022-10-16 01:08:26 +09:00
Hajime Hoshi
32a2a705c0 internal/ui: flush the cache of the final screen after DrawScreen
The screen image might have a cache in the future.

Updates #2385
2022-10-15 01:59:53 +09:00
Hajime Hoshi
f15536e8de ebiten: refactoring: remove imageDumperGame
This enables passing the user's Game to internal/ui without wrapping.

This is necessary to check whether the user's Game implements an
optional function or not.

Updates #2046
2022-10-14 02:58:31 +09:00
Hajime Hoshi
25ae96db89 internal/ui: move screenScaleAndOffsets to the ebiten package
Updates #2046
2022-10-14 01:58:07 +09:00
Hajime Hoshi
03621e22c6 internal/ui: remove unnecessary mutex
Now (*context).updateFrame and (*context).adjustPosition are not called
in parallel even though the goroutines might be different.
2022-10-14 01:47:52 +09:00
Hajime Hoshi
4bd3a9ef8f internal/ui: refactoring: move the screen rendering logic to ebiten package
Updates #2046
2022-10-14 00:34:40 +09:00
Hajime Hoshi
08e6f5af86 internal/graphicsdriver: remove FramebufferYDirection 2022-10-14 00:05:59 +09:00
Hajime Hoshi
c23af8fa3a internal/ui: remove unnecessary comments 2022-10-13 12:28:32 +09:00
Hajime Hoshi
30088cf602 internal/ui: refactoring: reduce uniform variable
This might degrade performance, but can demonstrate how to get the
scale of the screen.

Updates #2046
2022-10-13 00:59:51 +09:00
Hajime Hoshi
91275e8fc2 internal/ui: add comments
Updates #1431
2022-10-12 02:46:08 +09:00
Hajime Hoshi
9c07b20f2b internal/ui: remove an odd cast 2022-10-02 23:20:16 +09:00
Hajime Hoshi
efd91c8b86 internal/ui: remove unused arguments from DrawTriangles
Closes #2369
2022-10-02 23:10:27 +09:00
Hajime Hoshi
d823e22bed internal/mipmap: remove unused arguments from DrawTriangles
Updates #2369
2022-10-02 23:06:32 +09:00
Hajime Hoshi
0ae2b1bc24 all: remove unnecessary conditions
Now a Kage shader is always used.
2022-10-02 22:30:59 +09:00
Hajime Hoshi
0b45ca7057 ebiten: reduce duplicated shader compilations 2022-10-02 20:33:50 +09:00
Hajime Hoshi
311aa7dcf8 all: use Kage shaders in internal packages
Updates #2369
2022-10-02 19:17:09 +09:00
Hajime Hoshi
eea11ba6cb internal/ui: use a Kage shader for Fill
Updates #2364
2022-10-02 16:08:33 +09:00
Hajime Hoshi
7b6f726729 internal/ui: skip uniform variables when possible
Updates #2364
2022-10-02 16:02:44 +09:00
Hajime Hoshi
239f9de2ca internal/ui: use Kage shaders
Updates #2364
2022-10-02 15:54:48 +09:00
Hajime Hoshi
5e459bbe42 internal/graphicsdriver/opengl, metal, directx: use premultiplied alpha format for color scales
Updates #2365
2022-10-02 13:38:21 +09:00
Hajime Hoshi
d00bd1cb16 internal/ui: refactoring: move setVerticesCache to ui.Image
Updates #2362
2022-09-29 01:21:46 +09:00
Hajime Hoshi
3a0f28ce6b internal/ui: refactoring: reduce global-variable usages 2022-09-26 00:46:03 +09:00
Hajime Hoshi
fa108ca717 internal/ui: bug fix: compiie errors on mobiles and browsers 2022-09-26 00:34:44 +09:00
Hajime Hoshi
4a82a109be internal/ui: use sync/atomic for performance 2022-09-26 00:27:04 +09:00
Hajime Hoshi
909f2fe492 internal/ui: bug fix: make inFrame concurrent-safe
Updates #1816
2022-09-25 23:56:14 +09:00
Hajime Hoshi
12f42544dd internal/ui: refactoring: simplify logic by removing setSizeCallbackEnabled
Closes #1816
2022-09-25 23:48:40 +09:00