|
楼主 |
发表于 2017-3-11 22:40:30
|
显示全部楼层
- void update_screen(const int8_t* buffer) {
- int8_t i, j;
- system((const char*)"cls");
- for (i = SCREEN_Y_SIZE; i != 0; i--)
- {
- for (j = SCREEN_X_SIZE; j != 0; j--) {
- printf((const char*)"%c", *buffer++);
- }
- printf((const char*)"\n");
- }
- }
复制代码
主要是要移植这个函数,这个函数的功能如下:
const int8_t* buffer里面存着16×4=64个字符,对应12864从左到右从上到下的显示内容
update_screen函数把buffer里面的内容显示到12864上面即可
此外main函数中有对按键的处理:
- int main(int argc, char *argv[]) {
- char ch;
- menu_init();
- for ( ; ; ) {
- ch = getch();
- if (77 == ch) { // right
- Beep(1000, 100);
- key_func(KEY_ENTER);
- continue;
- }
- if (75 == ch) { // left
- Beep(1000, 100);
- key_func(KEY_ESC);
- continue;
- }
- if (72 == ch) { // up
- Beep(1000, 100);
- key_func(KEY_UP);
- continue;
- }
- if (80 == ch) { // down
- Beep(1000, 100);
- key_func(KEY_DOWN);
- continue;
- }
- if (27 == ch) {
- break;
- }
- }
- return 0;
- }
复制代码 |
|