Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <gba_console.h>
- #include <gba_video.h>
- #include <gba_interrupt.h>
- #include <gba_systemcalls.h>
- #include <gba_input.h>
- #include <stdio.h>
- #include <stdlib.h>
- int frames = 0;
- int seconds = 0;
- int minutes = 0;
- //---------------------------------------------------------------------------------
- // Program entry point
- //---------------------------------------------------------------------------------
- int main(void) {
- //---------------------------------------------------------------------------------
- // the vblank interrupt must be enabled for VBlankIntrWait() to work
- // since the default dispatcher handles the bios flags no vblank handler
- // is required
- irqInit();
- irqEnable(IRQ_VBLANK);
- consoleDemoInit();
- // ansi escape sequence to set print co-ordinates
- // /x1b[line;columnH
- printf("SIMPLE TIME KEEPER\n");
- printf("BY atm959\n");
- while (1) {
- if(frames < 60){
- frames++;
- } else if(frames == 60){
- if(seconds < 60){
- seconds++;
- } else if(seconds == 60){
- minutes++;
- printf("\x1b[4;0HSeconds: ");
- seconds = 0;
- }
- printf("\x1b[3;0HFrames: ");
- frames = 0;
- }
- printf("\x1b[3;0HFrames: %d", frames);
- printf("\x1b[4;0HSeconds: %d", seconds);
- printf("\x1b[5;0HMinutes: %d", minutes);
- printf("\x1b[7;0HThis was programmed in C\nin Programmer\'s Notepad\nwith devkitPro.");
- VBlankIntrWait();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment