mirror of
https://github.com/yourtion/30dayMakeOS.git
synced 2026-04-27 20:20:19 +08:00
Add 28 day code
This commit is contained in:
1
28_day/walk/!cons_9x.bat
Normal file
1
28_day/walk/!cons_9x.bat
Normal file
@@ -0,0 +1 @@
|
||||
command
|
||||
1
28_day/walk/!cons_nt.bat
Normal file
1
28_day/walk/!cons_nt.bat
Normal file
@@ -0,0 +1 @@
|
||||
cmd.exe
|
||||
5
28_day/walk/Makefile
Normal file
5
28_day/walk/Makefile
Normal file
@@ -0,0 +1,5 @@
|
||||
APP = walk
|
||||
STACK = 1k
|
||||
MALLOC = 48k
|
||||
|
||||
include ../app_make.txt
|
||||
1
28_day/walk/make.bat
Normal file
1
28_day/walk/make.bat
Normal file
@@ -0,0 +1 @@
|
||||
..\..\z_tools\make.exe %1 %2 %3 %4 %5 %6 %7 %8 %9
|
||||
26
28_day/walk/walk.c
Normal file
26
28_day/walk/walk.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include "apilib.h"
|
||||
|
||||
void HariMain(void)
|
||||
{
|
||||
char *buf;
|
||||
int win, i, x, y;
|
||||
api_initmalloc();
|
||||
buf = api_malloc(160 * 100);
|
||||
win = api_openwin(buf, 160, 100, -1, "walk");
|
||||
api_boxfilwin(win, 4, 24, 155, 95, 0);/*黑色*/
|
||||
x = 76;
|
||||
y = 56;
|
||||
api_putstrwin(win, x, y, 3, 1, "*");/*黄色*/
|
||||
for (;;) {
|
||||
i = api_getkey(1);
|
||||
api_putstrwin(win, x, y, 0 , 1, "*"); /*用黑色擦除*/
|
||||
if (i == '4' && x > 4) { x -= 8; }
|
||||
if (i == '6' && x < 148) { x += 8; }
|
||||
if (i == '8' && y > 24) { y -= 8; }
|
||||
if (i == '2' && y < 80) { y += 8; }
|
||||
if (i == 0x0a) { break; } /*按回车键结束*/
|
||||
api_putstrwin(win, x, y, 3 , 1, "*");/*黄色*/
|
||||
}
|
||||
api_closewin(win);
|
||||
api_end();
|
||||
}
|
||||
Reference in New Issue
Block a user