#pragma bank 0
#include "gb_tile_example.h"
#include "vram_example_colors.h"
#include "text.c"

// Six original frame tiles plus cursor and page-wait indicators, each encoded as two identical bitplanes.
const u8 dialogue_tiles[128] = {
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x1F, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
    0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10 ,
0, 0, 16, 16, 24, 24, 28, 28, 24, 24, 16, 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 254, 254, 124, 124, 56, 56, 16, 16
};

const u8 * const dialogue_choices[]={"SWORD","SHIELD","POTION"};
void main(){
    u8 selected;
    tile_example_begin();M_LCDC=0;
    __vram_copy(0x8010,dialogue_tiles,128);
    m_text(1,0,"CHOOSE AN ITEM");
    vram_example_color(1,2,18,5,3);
    M_LCDC=0x91;text_open(1,2,18,5);
    // example:text_choice:start
    selected=text_choice(dialogue_choices,3);
    // example:text_choice:end
    m_text(1,9,"SELECTED");text_print_u8(12,9,selected);
    m_text(1,12,"UP/DOWN: MOVE");
    m_text(1,14,"A: OK  B: CANCEL");
    while(1){m_wait();}
}
