Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Example programs that run on the Nintendo GameBoy

License

NotificationsYou must be signed in to change notification settings

flozz/gameboy-examples

Repository files navigation

This repository contains example programs for the Nintendo GameBoy video game console. The examples are related to articles on my blog (in French).

Examples Index

ScreenshotNameDescription
01 - Hello WorldSimple program that prints "Hello World" on the screen
02 - GamepadSimple program shows how to use gamepad in a GameBoy program
03 - Tic Tac ToeA complete example project to show how to make a simple game for the GameBoy
04 - Graphics 1Simple example to show how to draw tiles on the GameBoy
05 - Graphics 2Convert an image using img2gb and display it
06 - Graphics 3 - backgroundBackground layer scrolling example
07 - Graphics 4 - spritesA complete sprite example with an animated player
08 - Graphics 5 - windowWindow layer example
09 - Graphics 6 - palettesPlaying with color palettes
10 - BreakoutSimple breakout game
11 - Custom TextHandle and display text

Compiling Examples

Linux

First you need to install some dependencies: SDCC (with its libraries), GNU Make, git. This can be installed with the following command on Debian / Ubuntu:

sudo apt install build-essential sdcc sdcc-libraries git

Then clone this repository and get submodules:

git clone https://github.com/flozz/gameboy-examples.gitcd gameboy-examplesgit submodule initgit submodule update

Then you have to build the gbdk-n library (this needs to be done only once):

cd gbdk-nmakecd ..

Finally, you can build examples with themake command from the directory of the example. For example, if you want to build the "Hello World" example, you will have to run the following commands:

cd 01-hello-world/make

You can now run the generated.gb file with your favorite emulator.

If you want to cleanup the folder from all generated files (*.rel,*.lst,*.gb,...), you can use the following command:

make clean

Windows

To build the examples on Windows, you first have to download and installthe latest SDCC version.

Then clone this repository and get submodules:

git clone https://github.com/flozz/gameboy-examples.gitcd gameboy-examplesgit submodule initgit submodule update

Then you have to build the gbdk-n library (this needs to be done only once).

If you are using CMD.exe:

cd gbdk-nmakecd ..

If you are using Git Bash:

cd gbdk-n./Make.batcd ..

Finally go to an example folder:

cd 01-hello-world

And build it using theMake.bat file.

If you are using CMD.exe:

make

If you are using Git Bash:

./Make.bat

You can now run the generated.gb file with your favorite emulator.

If you want to cleanup the folder from all generated files (*.rel,*.lst,*.gb,...), you can use the following command:

If you are using CMD.exe:

make clean

If you are using Git Bash:

./Make.bat clean

Building assets

Some of the examples have assets (tilesets, tilemaps, sprites,...). If you changes the images, you will have to rebuild assets.

Linux

You will first need toinstall img2gb. This can be done with the following command:

sudo pip install img2gb

Then, just run the following command (from the example directory):

make assets

Windows

You first have to get the Windows version of img2gb :

Finally, open a terminal in the project's folder and use the following command to rebuild the assets :

make assets

The previous command will work if you are using CMD.exe, but if you are using Git Bash, type this one instead :

./Make.bat assets

License

The examples in this repository are licensed under WTFPL unless otherwise stated:

        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE                    Version 2, December 2004 Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION  0. You just DO WHAT THE FUCK YOU WANT TO.

[8]ページ先頭

©2009-2025 Movatter.jp