cscg22-gearboy

CSCG 2022 Challenge 'Gearboy'
git clone https://git.sinitax.com/sinitax/cscg22-gearboy
Log | Files | Refs | sfeed.txt

main.c (1120B)


      1#include <gbdk/platform.h>
      2#include <gbdk/gbdecompress.h>
      3
      4#include <stdint.h>
      5
      6// Include graphics data
      7#include "monalisa_tiles_comp.h"
      8#include "monalisa_map.h"
      9
     10// The map tiles were exported from GBTD with compression enabled
     11// using this updated version of GBTD: https://github.com/untoxa/GBTD_GBMB
     12// Size was 4096 bytes -> 3493 bytes
     13
     14uint8_t buffer[4096];
     15
     16void main(void)
     17{  
     18    // Decompress the map tiles into the background tile vram.
     19    //
     20    // Notice that the number of tiles isn't specified. The amount 
     21    // of data to decompress is embedded in the compressed data.
     22    //
     23    // Note: For non-compressed data the equivalent would be: set_bkg_data(0, 253u, monalisa_tiles)
     24    //
     25    set_bkg_data(0, gb_decompress(monalisa_tiles_comp, buffer) >> 4, buffer);
     26
     27    // Now set the map and turn the background on
     28    set_bkg_tiles(0,0, monalisa_mapWidth, monalisa_mapHeight, monalisa_mapPLN0);
     29    SHOW_BKG;
     30    
     31    // Loop forever
     32    while(1) {
     33
     34        // Main loop processing goes here
     35
     36        // Done processing, yield CPU and wait for start of next frame
     37        wait_vbl_done();
     38    }
     39}
     40
     41
     42
     43