4 win32CursesCtx g_curses_context
; // we only need the one instance
8 int WINAPI
WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
, LPSTR lpCmdLine
, int nCmdShow
) {
9 g_curses_context
.want_getch_runmsgpump
= 1; // non-block
11 curses_registerChildClass(hInstance
);
12 curses_CreateWindow(hInstance
,&g_curses_context
,"Sample Test App");
22 intrflush(stdscr
,FALSE
);
26 #if !defined(_WIN32) && !defined(MAC_NATIVE)
27 ESCDELAY
=0; // dont wait--at least on the console this seems to work.
30 if (has_colors()) // we don't use color yet, but we could
33 init_pair(1, COLOR_WHITE
, COLOR_BLUE
); // normal status lines
34 init_pair(2, COLOR_BLACK
, COLOR_CYAN
); // value
40 float xpos
=0,ypos
=0, xdir
=0.7, ydir
=1.5;
45 else if (t
== KEY_LEFT
) xdir
*=0.9;
46 else if (t
== KEY_RIGHT
) xdir
*=1.1;
47 else if (t
== KEY_UP
) ydir
*=1.1;
48 else if (t
== KEY_DOWN
) ydir
*=0.9;
50 xpos
+=xdir
; ypos
+=ydir
;
51 if (xpos
>= COLS
-1||xpos
<1) { if (xpos
<1)xpos
=1; else xpos
=COLS
-1; xdir
=-xdir
; }
52 if (ypos
>= LINES
-1||ypos
<1) { if (ypos
<1)ypos
=1; else ypos
=LINES
-1; ydir
=-ydir
; }
55 mvaddstr(ypos
,xpos
,"X");
60 if (!g_curses_context
.m_hwnd
) break;
70 if (g_curses_context
.m_hwnd
) DestroyWindow(g_curses_context
.m_hwnd
);
71 curses_unregisterChildClass(hInstance
);