Toy Shader in TinyGo for Game Boy Advance.

toyshader.gba

Toy Shader in TinyGo for Game Boy Advance.

Releases

  • v0.2: 80x80 screen with 3x2 pixel block version for drawing speed.
  • v0.1: 240x160 pixel screen version.

Build Environemnt

  • Ubuntu 20.04 currenly used, but any platform runs TinyGo possible.
  • Tiny Go version 0.18.0 linux/amd64 (using go version go1.16.4 and LLVM version 11.0.0)
  • make
  • VisualBoyAdvance version 1.8.0

Build examples.

Shader Values and Functions

all variable type is int16

R,G,B = { 0..255, 0..255, 0..255 }

  • u_resolution = { 240, 160 }
  • u_time = 0..35
  • u_mouse = { 0..240, 0..160 }
  • cdepth = 255 // color depth
  • vec2 has { x,y }
  • vec3 has { r,g,b }
  • sin() / cos() : radius = 80 and degree by 10
  • length(vec2, vec2) : euclidean distance ^2
  • dot(vec2, vec2)
  • fract(int16) : att like mod 80
  • pow(x int16, n int16) : x * (x/80)^(n-1)
  • mix(x vec3, y vec3, ratio int16) : mix x and y with ratio
  • normalizedXY(vec2) : convert native screen x,y position to normalized (0..80) value.
  • adjustedRGB(vec3) : convert normalized RGB (0..80) value to adjusted RGB (0..255) value.
  • shader.TurnPageByKey() : need to be called before Run() and you can turn screen by any key
  • shader.Run() : main loop

Build your shader

  • export GO111MODULE="off"
  • cd $GOPATH/src
  • git clone https://github.com/nobuh/toyshader.gba.git
  • cd toyshader.gba
  • write your shader in function shader() on the shader/code.go
  • if you want to use TurnPageByKey() mode, put it on main.go before Run()
  • make

How to run this demo on real hardware

I'm currently using Visual Boy Advance. Because it can load and run ROM cart memory (0x08000000) without Nintendo's ROM headers. It seems that the Visual Boy Advance can emulate the 3rd party Flash Cart Drive which has no Nintendo headers, so we don'nt need create ROM headers.

If you want to run this demo on real hardware or mGBA, pleae check devkitPro or similer tools.

Run as a demo on Windolws

  • Download visualboyadvance-m and extract

  • mkdir and put visualboyadvance-m and toyshader.bin

  • create a start.bat file contains

    start /max visulaboyadvance-m toyshader.bin
    
  • click start.bat to start and CTL-Q to quit

Acknowledgements

Owner
Nobuhiro Hatano
twitter @nobuhatano
Nobuhiro Hatano
Similar Resources

Engo is an open-source 2D game engine written in Go.

Engo A cross-platform game engine written in Go following an interpretation of the Entity Component System paradigm. Engo is currently compilable for

Dec 26, 2022

Go 3D Game Engine

Go 3D Game Engine

G3N - Go 3D Game Engine G3N (pronounced "gen") is an OpenGL 3D Game Engine written in Go. It can be used to write cross-platform Go applications that

Jan 9, 2023

A Game Server Skeleton in golang.

A Game Server Skeleton in golang.

A game server skeleton implemented with golang. 注意(NOTICE) 欢迎加入QQ群: 459420581 (Gopher成都,讨论一切与go有关的话题) gonet/2 gonet1已停止维护(I no longer maintain this, p

Dec 26, 2022

Scalable Distributed Game Server Engine with Hot Swapping in Golang

Scalable Distributed Game Server Engine with Hot Swapping in Golang

GoWorld Scalable Distributed Game Server Engine with Hot Reload in Golang Features Architecture Introduction Get GoWorld Manage GoWorld Servers Demos

Dec 25, 2022

A game server framework in Go (golang)

Leaf A pragmatic game server framework in Go (golang). Features Extremely easy to use Reliable Multicore support Modularity Community QQ 群:376389675 D

Jan 2, 2023

Lightweight, facility, high performance golang based game server framework

Lightweight, facility, high performance golang based game server framework

Nano Nano is an easy to use, fast, lightweight game server networking library for Go. It provides a core network architecture and a series of tools an

Jan 1, 2023

A pure Go game engine

A pure Go game engine

Oak A pure Go game engine Table of Contents Installation Motivation Features Support Quick Start Implementation and Examples Finished Games Installati

Jan 8, 2023

Scalable game server framework with clustering support and client libraries for iOS, Android, Unity and others through the C SDK.

pitaya Pitaya is an simple, fast and lightweight game server framework with clustering support and client libraries for iOS, Android, Unity and others

Jan 2, 2023

A hand-crafted 2D game library in Go

A hand-crafted 2D game library in Go

Pixel A hand-crafted 2D game library in Go. Take a look into the features to see what it can do. go get github.com/faiface/pixel If you are using Mod

Dec 31, 2022
Arkanoid game in Go using Ebiten game engine with ECS.
Arkanoid game in Go using Ebiten game engine with ECS.

Arkanoid-go Arkanoid game in Go using Ebiten game engine with ECS. You must have Git LFS installed when cloning the repository to download assets. See

Oct 9, 2022
AircraftWar - a game powered by Go+ spx game engine
AircraftWar - a game powered by Go+ spx game engine

AircraftWar - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download thi

Jan 5, 2022
FlappyCalf - a game powered by Go+ spx game engine
FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this

Nov 6, 2022
FlappyCalf - a game powered by Go+ spx game engine
FlappyCalf - a game powered by Go+ spx game engine

FlappyCalf - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this

Nov 6, 2022
MazePlay - a game powered by Go+ spx game engine
MazePlay - a game powered by Go+ spx game engine

MazePlay - a game powered by Go+ spx game engine How to run Download Go+ and build it. See https://github.com/goplus/gop#how-to-build. Download this g

Dec 16, 2021
A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!
A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy!

galactic-asteroid-belt Overview A simple game that I created with Ebiten game library as a way to teach myself Go. Enjoy! Run To run, you will need Go

Dec 2, 2021
RundQuiz-Game - This is a Go exercise that implements and builds a quiz game from a list of math questions in a CSV file.

Go RundQuiz Game Exercise details This exercise is broken into two parts to help simplify the process of explaining it as well as to make it easier to

Jan 5, 2022
Simple 2D game to teach myself various things about game development and ECS, etc

2d-grass-game I really don't know what to name this game. Its a big grass field, and its in 2d so....2D Grass game This is a simple 2D game to teach m

Jan 17, 2022
A toy GameBoy Color emulator written in golang.
A toy GameBoy Color emulator written in golang.

?? worldwide 日本語のドキュメントはこちら GameBoyColor emulator written in golang. This emulator can play a lot of ROMs work without problems and has many features.

Jan 1, 2023
A dead simple 2D game library for Go
A dead simple 2D game library for Go

Ebiten (v2) A dead simple 2D game library for Go Ebiten is an open source game library for the Go programming language. Ebiten's simple API allows you

Dec 28, 2022