Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdbool.h>
- #include <stddef.h>
- #include <stdint.h>
- #include <tice.h>
- #include <math.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <graphx.h>
- #include <keypadc.h>
- void main(void) {
- uint16_t x = 0;
- uint8_t y = 0;
- uint8_t key;
- bool running = true;
- prgm_CleanUp();
- gfx_Begin();
- gfx_SetDrawBuffer();
- gfx_ZeroScreen();
- gfx_SetColor(255);
- gfx_FillRectangle(x, y, 20, 20);
- gfx_BlitBuffer();
- while(running) {
- key = kb_ScanGroup(kb_group_6);
- if (key == kb_Clear) running = false;
- key = kb_ScanGroup(kb_group_7);
- switch(key) {
- case kb_Up:
- y--;
- break;
- case kb_Down:
- y++;
- break;
- case kb_Left:
- x--;
- break;
- case kb_Right:
- x++;
- break;
- }
- if (key) {
- gfx_ZeroScreen();
- gfx_SetColor(255);
- gfx_FillRectangle(x, y, 20, 20);
- gfx_BlitBuffer();
- }
- }
- gfx_End();
- }
Advertisement
Add Comment
Please, Sign In to add comment