git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

gbdk-lib/examples/gb/sgb_border/border.c

      1 #include <gb/gb.h>
      2 #include <stdint.h>
      3 #include "sgb_border.h"
      4 
      5 #include "border_data.h"
      6 /*
      7 
      8 - The entire image should be 256 x 224 pixels
      9 
     10 - The game area in the center should be:
     11   - 160 x 144 pixels, from (48,40) to (207,183)
     12   - The pixels in the game area at the center of the image should be set
     13     to 100% Alpha Transparency (as in the example image). If this is not
     14     done then the game area may share a palette color with other parts
     15     of the border leading to tile pattern flashing while the border loads.
     16 
     17 - See the pandocs for additional details
     18   - https://gbdev.io/pandocs/SGB_Functions.html
     19   - https://gbdev.io/pandocs/SGB_Color_Palettes.html
     20 */
     21 
     22 void main(void) {
     23 
     24     // Wait 4 frames
     25     // For SGB on PAL SNES this delay is required on startup, otherwise borders don't show up
     26     for (uint8_t i = 4; i != 0; i--) vsync();
     27 
     28     // The display must be ON before calling set_sgb_border()
     29     DISPLAY_ON;
     30     set_sgb_border(border_data_tiles, sizeof(border_data_tiles), border_data_map, sizeof(border_data_map), border_data_palettes, sizeof(border_data_palettes));
     31     while(1) {
     32         vsync();
     33     }
     34 }

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.