Giter Club home page Giter Club logo

slider.gba's Introduction

Port Slider game to GameBoy Advance on mGBA

Download slider-8-actual-GBA.gba for mGBA

What is a slider.gba

  • slider.gba is a very simple NxN sliding puzzle game that can be run on GameBoy Advance.
  • It has been written in optimized modern ISO C++17 except core game logic originally written in C.
  • No special library(libheart) ,except libc for memcpy function(if in use), libgcc for basic software math function(div and mod).
  • Work great on mGBA, higan, VisualBoy Advance, VisualBoy Advance-m and BoycottAdvance.

Features

  • Modern C++ style library in Graphic.hpp and Keypad.hpp
  • Provides Iterator in Grange struct
  • Higher level abstraction than C
  • Graphic.hpp supports Graphic mode 3,4,5
  • Keypad.hpp supports dual style keypad action method message() and dispatch()
#include "Graphic.hpp"
#include "Keypad.hpp"

static const char A[] = {
        0, 0, 0, 1, 1, 0, 0, 0,
        0, 0, 0, 1, 1, 0, 0, 0,
        0, 0, 1, 1, 1, 1, 0, 0,
        0, 0, 1, 1, 0, 1, 0, 0,
        0, 1, 1, 1, 1, 1, 1, 0,
        0, 1, 1, 0, 0, 0, 1, 0,
        1, 1, 1, 0, 0, 0, 1, 1,
        0, 0, 0, 0, 0, 0, 0, 0
    };

static const char B[]={
        0, 1, 1, 1, 1, 1, 1, 0,
        0, 1, 1, 0, 0, 0, 1, 1,
        0, 1, 1, 0, 0, 0, 1, 1,
        0, 1, 1, 1, 1, 1, 1, 0,
        0, 1, 1, 0, 0, 0, 1, 1,
        0, 1, 1, 0, 0, 0, 1, 1,
        0, 1, 1, 1, 1, 1, 1, 0,
        0, 0, 0, 0, 0, 0, 0, 0
    };

int main()
{
	GraphicDevice::refdispcnt() = 0x400 | Color5::mode;

	Graphicx<Color5p1> g1;
	Graphicx<Color5p2> g2;

	g1.bgcolor(RGB15(0,31,30));
	g2.bgcolor(RGB15(20,31,40));

	{
		unsigned int i=0;
		for(auto &r:g1.grange(50,50,50+8,50+8))
			r=A[i++] ? RGB15(0,0,31):RGB15(0,31,30);
	}

	{
		unsigned int i=0;
		for(auto &r:g2.grange(50,50,50+8,50+8))
			r=B[i++] ? RGB15(31,0,0):RGB15(20,31,40);
	}
	
	Keypad<KeypadDevice> keypad;

	while(true)
	{
		const auto e = keypad.message().first;

		if(e==e.EVENT_DOWN)
		{
			g1.waitVSync();
			g1.flip();
		}
	}

	return 0;
}

Keypad

- UP     == moves down block
- DOWN   == moves up block
- LEFT   == moves left block to right
- RIGHT  == moves right block to left
- START  == reset a board
- SELECT == Hold SELECT for complete board representation
- A      == pred origin random seed and init board
- B      == succ origin random seed and init board

Game Play

  • Complete block arrangement

Tools for slider.gba

pacman -S mingw-w64-x86_64-arm-none-eabi-toolchain

or

pacman -S mingw-w64-clang-x86_64-arm-none-eabi-toolchain
  • GameBoy Advance emulator: mGBA
  • Native Compiler: MSYS2 for build gbafix2 (ROM GameBoy Advance Head Builder & Fixer)
pacman -S mingw-w64-x86_64-toolchain
  • gbafix2: gbafix2 for ROM header (included)

How to make

  • Open MSYS2
  • Then let's make it!!!!
git clone --recurse-submodules https://github.com/hwoy/slider.gba.git
cd slider.gba
sh Install.sh
  • If it success , you will see
  • slider-8-actual-GBA.gba for actual ROM (slider-actual-GBA.gba = 0xC0 bytes of header + 0x80000C0 entry point slider-actual-GBA.noheader)
  • gbafix2 can add 0xC0 bytes of header to raw .gba file

Special Thanks

Contact me

slider.gba's People

Contributors

hwoy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.