int end(void){ GtkWidget * boxTable = (GtkWidget *)gtk_builder_get_object(g_interface, "boxTable"); GtkWidget * boxMenu = (GtkWidget *)gtk_builder_get_object(g_interface, "boxMenu"); GtkWidget * vboxMenu = (GtkWidget *)gtk_builder_get_object(g_interface, "vboxMenu"); GtkWidget * vboxRegles = (GtkWidget *)gtk_builder_get_object(g_interface, "vboxRegles"); GtkWidget * vboxResult = (GtkWidget *)gtk_builder_get_object(g_interface, "vboxResult"); GtkWidget * eventbtnM4 = (GtkWidget *)gtk_builder_get_object(g_interface, "eventbtnM4"); if((nbPartiesTotal-nbParties+1) == nbPartiesTotal) { if((nbPartiesTotal-nbParties+1) == nbPartiesTotal && Total > 0) { //Game Win SetBG("gagne.png"); } else { //Game Over SetBG("perdu.png"); } gtk_widget_hide(eventbtnM4); gtk_widget_hide(vboxMenu); gtk_widget_hide(vboxRegles); gtk_widget_hide(boxTable); gtk_widget_show(vboxResult); gtk_widget_show(boxMenu); return TRUE; } else { if(Total == 0) { //Game Over SetBG("perdu.png"); gtk_widget_hide(eventbtnM4); gtk_widget_hide(vboxMenu); gtk_widget_hide(vboxRegles); gtk_widget_hide(boxTable); gtk_widget_show(vboxResult); gtk_widget_show(boxMenu); return TRUE; } } return FALSE; }
void Drawing::RedrawWindow(HWND hWnd, TileTypeEnum board[MAX_X][MAX_Y]) { SetBG(hWnd); ClearScreen(hWnd); for (int x = 0; x < MAX_X; x++) for (int y = 0; y < MAX_Y; y++) if (board[x][y] != EMPTY) DrawSquare(hWnd, x, y, board[x][y]); }
//-------------------------------------------------------------------- void CForm::Create( IGUIControl* p_pParent, int p_nLeft, int p_nTop, CBitmap& p_Bitmap ) { IGUIControl::Create(); SetParent( p_pParent ); SetLeft( p_nLeft ); SetTop( p_nTop ); SetBG( p_Bitmap ); SetWidth( p_Bitmap.Width() ); SetHeight( p_Bitmap.Height() ); if( m_pColor == NULL ) { SetFontColor( *(new CColor( CColor::WHITE )) ); } }
// load all songs from ROM into memory void GlobalData::LoadSongs() { u16 checkmagic=0; offset = 0; REG_IME = 0; // disable interrupts debug("Loading songs."); // black = starting SetBG(0, 0, 0); ReadNumber(&checkmagic, sizeof(u16)); // check first if there is any saved data in the databank if (checkmagic == magic) { // until we find the end of the songs while (!CheckMagic()) { // red = song SetBG(10, 0, 0); // start a new song debug("Creating a new song struct."); NewSong(); debug("Reading basic song data."); // read in the song name ReadString(¤tsong->name); debug("Song Name: %s", currentsong->name); // write bpm ReadNumber(¤tsong->bpm, sizeof(u16)); debug("Song Speed: %d", currentsong->bpm); // until we find the end of the loops while (!CheckMagic()) { // green = loop SetBG(0, 10, 0); // create a new loop debug("Creating a new loop struct."); NewLoop(); debug("Reading basic loop data."); // write the loop name ReadString(¤tloop->name); // write the sample number ReadNumber(¤tloop->sample, sizeof(u16)); // write the panning direction ReadNumber(¤tloop->pan, sizeof(bool)); // write the pitch ReadNumber(¤tloop->pitch, sizeof(u16)); // write the number of divisions ReadNumber(¤tloop->divisions, sizeof(u16)); while (!CheckMagic()) { // blue = note SetBG(0, 0, 10); // create a new note debug("Creating a new note struct."); NewNote(); debug("Reading basic note data."); // write the note end action; ReadNumber(¤tnote->noteEnd, sizeof(u8)); // write the beat offset ReadNumber(¤tnote->offset, sizeof(u8)); // write the pitch ReadNumber(¤tnote->pitch, sizeof(u8)); // write the swing ReadNumber(¤tnote->swing, sizeof(u8)); } } } } // if we don't have a default song set yet if (!songdata) { debug("No load data; creating a new song."); NewSong(); } REG_IME = 1; // enable interrupts }
int main() { // INT_IE |= ( 1 << 13 ); // cart-remove-interrupt (handled by crt0) // CST_ROM0_1ST_3WAIT | CST_ROM0_2ND_1WAIT | CST_PREFETCH_ENABLE // REG_WSCNT = ( 5 << 2 ) | ( 1 << 14 ); // set rom-timing irqInit(); irqSet( IRQ_TIMER1, kradInterrupt ); irqEnable( IRQ_TIMER1 ); // midi setup irqSet( IRQ_TIMER3, midiInterrupt ); irqEnable( IRQ_TIMER3 ); midiInit(); REG_IME = 1; SetMode( MODE_0 | BG1_ON ); // starting SetBG(10, 10, 0); // create the globals object globals = new GlobalData(); // starting SetBG(0, 10, 10); globals->LoadSongs(); // starting SetBG(10, 0, 10); u16 i = 0; Keys *keys = new Keys(); First *firstpage = new First(keys); Page *selected = firstpage; // init krawall kragInit( KRAG_INIT_STEREO ); // make it so we can see the background REG_BG1CNT = BIT(7) | BIT(8) | BIT(9) | BIT(10) | BIT(11) | BIT(12); // high priority, 256 colour, point the banks at the right place etc // load the splash screen DMA3COPY((void*)splash_tiles, (u16*)VideoBuffer, SPLASH_TILESIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)splash_palette, (u16*)&BG_PALETTE[5], SPLASH_PALSIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)splash_map, (u16*)&VideoBuffer[0x7C00], 640 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); // check keys while (keys->TestKey(keyA) != pressed) { keys->Jiffie(); } keys->Jiffie(); // load the krawall splash screen DMA3COPY((void*)krawall_splash_tiles, (u16*)VideoBuffer, KRAWALL_SPLASH_TILESIZE| DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)krawall_splash_palette, (u16*)&BG_PALETTE[5], KRAWALL_SPLASH_PALSIZE | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)krawall_splash_map, (u16*)&VideoBuffer[0x7C00], 640 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); // check keys while (keys->TestKey(keyA) != pressed) { keys->Jiffie(); } keys->Jiffie(); // load charset into memory as a demo tileset DMA3COPY((void*)font::tiles, (u16*)VideoBuffer, 3232 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); DMA3COPY((void*)font::tiles_color, (u16*)&VideoBuffer[3232], 3232 | DMA16 | DMA_IMMEDIATE | DMA_SRC_INC | DMA_DST_INC); // set up the background palette for (i=0;i<7;i++) BG_PALETTE[i] = RGB(0, 0, 0); // this starts from 7 becuase the kludgy legacy converter used a 7-color offset (for parallax-starfield reasons) BG_PALETTE[7] = RGB(0x1F, 0x1F, 0x1F); BG_PALETTE[8] = RGB(0, 0, 0); // set the H and V offset of our background to zero // REG_BG1HOFS = 0; // REG_BG1VOFS = 0; // clear out the whole area BlankScreen(); while (1) { // this is zerosync SetBG(0, 0, 10); // figure out all our latest song positions globals->Tick(); // calculate audio stuff kramWorker(); // update midi progression midiUpdateBeat(globals->beat); // check keys keys->Jiffie(); // automatically cascades all pages and processes them firstpage->Process(); SetBG(0, 0, 0); // this is vsync //while( !REG_VCOUNT ); //while( REG_VCOUNT ); // try and fit the drawing stuff into the off-screen sync while(REG_VCOUNT != 160); SetBG(10, 0, 0); // do all the display shit in here BlankScreen(); selected = selected->Cycle(); selected->Draw(); SetBG(0, 0, 0); } return 1; }