Introduction

Day 1
GBA Hardware

Day 2
"Hello, World!"

Day 3
Input

Day 4
Backgrounds -
  Bitmapped Modes

Day 5
Sprites

Day 6
Backgrounds -
  Tile Modes

Day 7
Project 1 -
  Tetris

Quiz - Week 1

Day 8
Sprites #2 -
  Animation

Day 9
Maps

Day 10
Sprites #3 -
  Animation #2

Day 11
Backgrounds -
  Rotation

Day 12
Sprites #4 -
  Mosaic

Version History

Downloads

Books

Links

Graphics FAQ

GFX2GBA Readme

Games

Projects

Credits

Support

HAM Tutorial :: Day 11 :: Backgrounds - Rotation

 

For Day 11 I'll explain how to rotate backgrounds. HAM makes this very simple with the RotBgEx() function. This function is very powerful because not only can you rotate backgrounds but also zoom in or out and scroll backgrounds.
NOTE: There is also a RotBg() function, but I prefer the newer RotBgEx() because you have more control over the rotation.

Oh, and don't forget. You can only rotate in Mode 1 and 2. In Mode 1, background 2 can rotate/scale. In Mode 2, backgrounds 2 & 3 can rotate/scale. In case you forgot, take a look at Day 1 again.

To convert the graphic, use the following:
gfx2gba -fsrc -m -protate.pal -rs -t8 rotate.bmp

Your gfx directory should have the following files:
rotate.map.c
rotate.pal.c
rotate.raw.c

On to the code:

// The Main HAM Library
#include "mygba.h"

// Graphics Includes
// gfx2gba -fsrc -m -protate.pal -rs -t8 rotate.bmp
#include "gfx/rotate.map.c"
#include "gfx/