ebiten/examples
Hajime Hoshi 237498e51f
ui: Add an optional function Draw function to Game interface (#1107)
This change adds an optional function Draw to the Game interface.
With Draw function, the game logic and rendering are separate.
There are some benefits:

  * The API is clearer and easier to understand.
  * When TPS < FPS, smoother rendering can be performed without
    changing the game logic depending on TPS.
  * Porting to XNA, which has separate functions Update and Draw,
    would be a little easier.

Draw is optional due to backward compatibility. Game interface was
already used before v1.11.x in mobile packages, and adding a
function would break existing code unfortunately. Then, we adopted
switching the behavior based on whether Draw is implemented or not
by type assertions.

IsDrawingSkipped will always return false when Draw is implemented.

Fixes #1104
2020-03-24 12:01:37 +09:00
..
2048 Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
additive Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
address graphics: Add Address representing a sampler address mode 2018-12-24 17:29:31 +09:00
airship examples/airship: Show FPS 2019-02-12 13:03:32 +09:00
alphablending ui: Rename TPS -> MaxTPS 2018-07-17 22:41:27 +09:00
animation graphics: Experimental: (*image.Image).SubImage 2018-10-28 02:19:14 +09:00
audio ui: Add function aliases *OnUnfocused for *InBackground 2020-03-21 00:42:00 +09:00
audioinfiniteloop examples/audioinfiniteloop: Fix message 2018-10-13 14:46:13 +09:00
blocks graphics: Experimental: (*image.Image).SubImage 2018-10-28 02:19:14 +09:00
blur docs: Use pkg.go.dev instead of godoc.org (Go files) 2020-01-19 04:52:12 +09:00
chipmunk examples: Fix warnings in the examples 2019-10-07 03:05:26 +09:00
contextlost examples/contextlost: Bug fix: Add 'js' build tag 2019-05-01 17:55:12 +09:00
doomfire examples/doomfile: Skip renderFire when possible 2019-02-15 00:54:11 +09:00
drag Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
filter Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
flappy examples/flappy: Change the spelling: Gameover -> Game over 2019-10-18 02:15:37 +09:00
flood Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
font examples: Use TPS instead of FPS to indicate how fast the app works 2018-09-30 02:27:33 +09:00
fullscreen examples/fullscreen: Fix offset 2018-10-12 01:11:14 +09:00
gamepad uidriver/js: Implement GamepadSDLID 2020-02-05 00:00:00 +09:00
highdpi Fix misspelling (again) 2018-12-03 18:25:44 +01:00
hsv Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
hue Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
infinitescroll examples: Use TPS instead of FPS to indicate how fast the app works 2018-09-30 02:27:33 +09:00
keyboard input: driver.Key now distinguishes left/right modifier keys 2019-09-01 23:49:00 +09:00
life examples/life: Fix initial world randomization (#1045) 2020-01-06 13:09:51 +09:00
mandelbrot Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
mascot example/mascot: Use vx16 instead of dir 2020-03-22 17:31:46 +09:00
masking Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
minify examples/minify: Better clipping 2018-11-09 01:08:32 +09:00
moire ui: Add an optional function Draw function to Game interface (#1107) 2020-03-24 12:01:37 +09:00
mosaic Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
noise examples: Use TPS instead of FPS to indicate how fast the app works 2018-09-30 02:27:33 +09:00
paint ui: Rename TPS -> MaxTPS 2018-07-17 22:41:27 +09:00
particles examples/sprites: Rotate sprites 2019-02-24 02:09:38 +09:00
pcm examples/pcm: Add intervals between notes 2018-12-17 23:25:52 +09:00
perspective graphics: Experimental: (*image.Image).SubImage 2018-10-28 02:19:14 +09:00
piano examples: Use TPS instead of FPS to indicate how fast the app works 2018-09-30 02:27:33 +09:00
platformer examples/platformer: Add jumps 2020-03-19 02:11:03 +09:00
polygons examples/polygon: Better coloring 2018-08-14 02:14:19 +09:00
raycasting examples/raycasting: fix bug, swap height and width (#1067) 2020-02-01 17:28:23 +09:00
resources example: Add mascot 2020-03-22 16:30:48 +09:00
rotate examples/rotate: Revert resizeable window 2020-02-06 03:05:31 +09:00
set examples/set: Add FPS to see the performance 2019-10-04 01:51:26 +09:00
shapes examples: Use TPS instead of FPS to indicate how fast the app works 2018-09-30 02:27:33 +09:00
sinewave examples/sinewave: Bug fix: Sinewave volume was too small 2019-01-20 02:17:10 +09:00
sprites docs: Use pkg.go.dev instead of godoc.org (Go files) 2020-01-19 04:52:12 +09:00
spriteshd docs: Use pkg.go.dev instead of godoc.org (Go files) 2020-01-19 04:52:12 +09:00
squiral examples/squiral: Fix title 2019-10-22 23:18:16 +09:00
tiles docs: Use pkg.go.dev instead of godoc.org (Go files) 2020-01-19 04:52:12 +09:00
typewriter Rename IsRunningSlowly to IsDrawingSkipped 2018-07-10 22:31:26 +09:00
ui graphics: Experimental: (*image.Image).SubImage 2018-10-28 02:19:14 +09:00
vector vector: Add FillOptions 2020-03-16 23:49:55 +09:00
wav Fix misspelling 2018-12-03 18:23:25 +01:00
wheel examples/wheel: Improve message 2018-09-30 17:13:22 +09:00
windowsize ui: Add an optional function Draw function to Game interface (#1107) 2020-03-24 12:01:37 +09:00
README.md docs: Use pkg.go.dev instead of godoc.org 2020-01-19 04:47:48 +09:00

How to execute the examples

Desktops

go run -tags=example $GOPATH/src/github.com/hajimehoshi/ebiten/examples/rotate/main.go

Web Browsers

gopherjs serve --tags=example

and access http://127.0.0.1:8080/github.com/hajimehoshi/ebiten/examples.

Android

Install gomobile first.

gomobile install -tags=example github.com/hajimehoshi/ebiten/examples/rotate

iOS

gomobile build -target=ios -tags=example -work github.com/hajimehoshi/ebiten/examples/rotate

Then, open the WORK directory, open main.xcodeproj, add signing, and run the project.