Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
👾 令和時代のゲームボーイ開発
giginet
September 07, 2019
Programming
3
6.6k
👾 令和時代のゲームボーイ開発
iOSDC 2019
https://fortee.jp/iosdc-japan-2019/proposal/1a25edb5-ff96-4453-8780-72a0158bb394
giginet
September 07, 2019
Tweet
Share
More Decks by giginet
See All by giginet
OSS Forward Workshop
giginet
2
690
Crossroad - 最高のCustom URL Schemeルーティングを支える技術2021
giginet
4
280
わいわいDocC ~ waiwai-docc ~
giginet
0
53
今日から使える実践的Swift Concurrency / Introducing Swift Concurrency
giginet
1
82
大規模なアプリのマルチモジュール構成の実践
giginet
4
9.8k
モバイルアプリ行動ログ基盤を”大統一”した話
giginet
0
2.2k
XcodeGen超入門
giginet
8
2.6k
Azure Pipeline
giginet
0
1.3k
Cookpad Spring Intern 2019 - Swiftコンパイラ -
giginet
1
7.3k
Other Decks in Programming
See All in Programming
Node-RED 3.0 新機能紹介
utaani
0
100
What's new in Android development tools まとめ
mkeeda
0
220
What's new in Jetpack / I/O Extended Japan 2022
star_zero
1
170
Reactアプリケーションのテスト戦略
0906koki
10
4.6k
How we run a Realtime Puzzle Fighting Game on AWS Serverless
falken
0
240
#JJUG_CCC 「サポート」は製品開発? - JDBCライブラリ屋さんが実践する攻めのテクニカルサポートとJavaエンジニアのキャリアについて -
cdataj
0
410
heyにおけるCI/CDの現状と課題
fufuhu
1
550
模組化的Swift架構(二) DDD速成
haifengkao
0
340
EFFICIENT CREATION OF AN EMPTY COLLECTION IN .NET
abt
0
150
Baseline Profilesでアプリのパフォーマンスを向上させる / Improve app performance with Baseline Profiles
numeroanddev
0
220
RFC 9111: HTTP Caching
jxck
0
150
競プロのすすめ
uya116
0
650
Featured
See All Featured
Become a Pro
speakerdeck
PRO
3
830
A Modern Web Designer's Workflow
chriscoyier
689
180k
The Pragmatic Product Professional
lauravandoore
19
2.9k
Fireside Chat
paigeccino
11
1.3k
Design by the Numbers
sachag
271
17k
Typedesign – Prime Four
hannesfritz
33
1.3k
A Tale of Four Properties
chriscoyier
149
21k
Navigating Team Friction
lara
175
11k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
119
28k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
226
15k
What the flash - Photography Introduction
edds
61
10k
Clear Off the Table
cherdarchuk
79
280k
Transcript
@giginet
None
ྩ࣌ͷ ήʔϜϘʔΠ։ൃ
Game boy • 1989ൃച • Z80ϕʔεͷCPUʢශऑʣ Z80(CPU) https://ja.wikipedia.org/wiki/Z80
update_game:: ld HL, READ_INPUT ld A, [HL] cp $00 jr
nz, .continue_update_1 call read_joypad .continue_update_1: call pipes_update call player_update call player_set_position call pipes_set_position ld HL, FADE_IN_ACTIVE ld A, [HL] cp $00 jr z, .call_fade_in cp $02 jr z, .call_fade_out jr .call_parallax .call_fade_in: call fade_in jr .call_parallax .call_fade_out:
update_game:: ld HL, READ_INPUT ld A, [HL] cp $00 jr
nz, .continue_update_1 call read_joypad .continue_update_1: call pipes_update call player_update call player_set_position call pipes_set_position ld HL, FADE_IN_ACTIVE ld A, [HL] cp $00 jr z, .call_fade_in cp $02 jr z, .call_fade_out jr .call_parallax .call_fade_in: call fade_in jr .call_parallax .call_fade_out:
GBDK • GBDK(Game boy Development Kit) • http://gbdk.sourceforge.net/ • ήʔϜϘʔΠͷήʔϜΛCݴޠͰྑ͍ײ͡ʹ࡞Ε
Δͭ • macOSͰಈ͘Α͏ʹforkͨͭ͠ giginet/GBDK
#include <gb/gb.h> #include <stdio.h> unsigned char pixels[] = {255, 255,
195, 189, 189, 195, 189, 195, 189, 195, 189, 195, 195, 189, 255, 255}; int main() { int x = 100, y = 100; SPRITES_8x8; set_sprite_data(0, 8, pixels); set_sprite_tile(0, 0); move_sprite(0, x, y); SHOW_SPRITES; while(1) { if(joypad() & J_RIGHT) move_sprite(0, ++x, y); if(joypad() & J_LEFT) move_sprite(0, --x, y); if(joypad() & J_UP) move_sprite(0, x, --y); if(joypad() & J_DOWN) move_sprite(0, x, ++y); delay(10); } return 0; } ඳը ϝΠϯϧʔϓ ը૾σʔλ
GBDK $ lcc -o rom game.gb
None
None
giginet/docker-gbdk $ docker pull giginet/gbdk $ docker run -it --rm
-v `pwd`:/gbdk giginet/gbdk /opt/gbdk/bin/lcc -o / gbdk/rom.gb /gbdk/game.c $ open rom.gb
None
0x00 0x01 0x10 0x11
0x00 0x01 0x10 0x11 8px 8px
0x00 0x01 0x10 0x11 00 11 11 01 11 01
11 01 0b01111111 0x7f 0x6a 0b01101010 0 1 1 1 1 1 1 1 0 1 1 0 1 0 1 0
8px 8px
unsigned char giginyan[] = {255, 255, 254, 254, 252, 253,
252, 253, 254, 253, 254, 253, 254, 253, 255, 254...
use image::RgbaImage; use std::vec; use crate::sprite::{Sprite, Pixel}; use crate::chopper::Chopper; fn
load_sprite(image: &RgbaImage) -> Sprite { let width = image.width(); let height = image.height(); let pixels = (0..width).map( |x| { return (0..height).map( |y| { let raw_pixel = image.get_pixel(x, y); return Pixel::from_raw(raw_pixel.data); }) .collect::<Vec<Pixel>>(); }) .collect::<Vec<Vec<Pixel>>>(); return Sprite { pixels: pixels }; } fn squash(chunk: &Vec<&Pixel>) -> [u8; 2] { fn clamp(i: u8) -> u8 { if i > 0 { return 1; } return 0; giginet/gb-sprite-generator
giginet/gb-sprite-generator $ cargo run ./assets >1 pixels.h
giginet/gb-sprite-generator unsigned char player[] = {255, 255, 254, 254, 252,
253, 252, 253, 254, 253, 254, 253, 254, 253, 255, 254... unsigned char bullet[] = {255, 255, 195, 189, 189, 195, 189, 195, 189, 195, 189, 195, 195, 189, 255, 255};
SPRITES_8x8; // ϐΫηϧσʔλΛఆٛ set_sprite_data(0, 8, giginyan); set_sprite_tile(0, 0); // ը૾Λඳը
move_sprite(0, 100, 100); SHOW_SPRITES;
None
None
None
None
None
None
None
mikeryan/ems-flasher $ ems-flasher --write rom.gb
None
❌ ❌
giginet/modern-gb
͝ਗ਼ௌ ͋Γ͕ͱ͏͍͟͝·ͨ͠