📄 taskwnd.c
字号:
///////////////////////////////////////////////////////////////////////////////
// Functions for different function model //
///////////////////////////////////////////////////////////////////////////////
#include "TaskWnd.h"
#include "global.h"
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
//-1 level window for entering
void EnterWnd()
{
int i = 0;
// Dispaly the first part of the catoon
for( i = 0; i < 24; i += 4)
{
ClearScreen();
ShowBmp(pdc,"left_1.bmp",300-7*i,100);
OSTimeDly(150);
ClearScreen();
ShowBmp(pdc,"left_3.bmp",300-7*(i+2),100);
OSTimeDly(150);
}
// Show the obstacle
ClearScreen();
ShowBmp(pdc,"jag.bmp",158,160);
OSTimeDly(150);
// Show the person who was triped
ClearScreen();
ShowBmp(pdc,"down.bmp",105,150);
OSTimeDly(400);
//Show the second part of the cartoon
for( ; i < 52; i += 4)
{
ClearScreen();
ShowBmp(pdc,"left_1.bmp",300-7*i,100);
OSTimeDly(150);
ClearScreen();
ShowBmp(pdc,"left_3.bmp",300-7*(i+2),100);
OSTimeDly(150);
}
// Show the philosophy saids
ClearScreen();
ShowBmp(pdc,"prompt.bmp",0,0);
OSTimeDly(500);
ClearScreen();
// Display the developer information and system information
ClearScreen();
ShowBmp(pdc,"cqu.bmp",0,0);
OSTimeDly(800);
return;
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// 0 level window for choosing different function
void ChooseWnd()
{
POSMSG pMsg;
// Used for judge whether "Numlock" key is pressed
int iExit = 0;
ClearScreen();
g_iWndLevel = 1;
ShowChoose(g_iWndLevel);
// Start choosing
while( iExit == 0 )
{
pMsg=WaitMessage(0);
if(pMsg->Message == OSM_KEY)
{
switch(pMsg->WParam)
{
case 0:
// Backforward
iExit = 1;
// Enter the choose function window
g_iWndLevel = 0;
break;
case 5:
if(g_iWndLevel >= 1)
{
g_iWndLevel -= 1;
ShowChoose(g_iWndLevel);
}
// If reached the top then
// set the current choice to the bottom
if(g_iWndLevel == 0)
{
g_iWndLevel = 5;
ShowChoose(g_iWndLevel);
}
break;
case 12:
if(g_iWndLevel <= 5)
{
g_iWndLevel += 1;
ShowChoose(g_iWndLevel);
}
// If reached the bottom then
// set the current choice to the top
if(g_iWndLevel == 6)
{
g_iWndLevel = 1;
ShowChoose(g_iWndLevel);
}
break;
case 14:
iExit = 1;
break;
}
}
DeleteMessage(pMsg);
}
return;
}
// Show the current choice
void ShowChoose( int WndNbr)
{
switch(WndNbr)
{
case 1:
ClearScreen();
ShowBmp(pdc,"choose.bmp",0,0);
ShowBmp(pdc,"one.bmp",11,33);
break;
case 2:
ClearScreen();
ShowBmp(pdc,"choose.bmp",0,0);
ShowBmp(pdc,"two.bmp",11,67);
break;
case 3:
ClearScreen();
ShowBmp(pdc,"choose.bmp",0,0);
ShowBmp(pdc,"three.bmp",11,101);
break;
case 4:
ClearScreen();
ShowBmp(pdc,"choose.bmp",0,0);
ShowBmp(pdc,"four.bmp",11,135);
break;
case 5:
ClearScreen();
ShowBmp(pdc,"choose.bmp",0,0);
ShowBmp(pdc,"five.bmp",11,169);
break;
}
return;
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// 1 level window for watching introduction by list box
void IntroLBxWnd()
{
//Watch introduction list box window
ClearScreen();
CreateIntrodList();
for(;g_iWndLevel == 1;)
{
POS_Ctrl pCtrl;
POSMSG pMsg_LB;
pMsg_LB=WaitMessage(0);
if(pMsg_LB->pOSCtrl)
{
if(pMsg_LB->pOSCtrl->CtrlMsgCallBk)
(*pMsg_LB->pOSCtrl->CtrlMsgCallBk)(pMsg_LB);
}
else
{
switch(pMsg_LB->Message)
{
case OSM_KEY:
// "NumLock" key is pressed,
// then set g_iWndLevel = 0 and program exit
if(pMsg_LB->WParam == 0)
{
g_iWndLevel = 0;
break;
}
pCtrl=GetCtrlfromID(NULL, GetWndCtrlFocus(NULL));
if(pCtrl->CtrlType==CTRLTYPE_WINDOW)
{
if((((PWnd)pCtrl)->style&WND_STYLE_MODE)
==WND_STYLE_MODE )
{
OSOnSysMessage(pMsg_LB);
break;
}
}
if(onKeyIntro(pMsg_LB->WParam,pMsg_LB->LParam))
break;
}
}
DeleteMessage(pMsg_LB);
OSTimeDly(100);
}
DestoryDC(pdc);
return;
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// 2 Level window for find path by list box
void FindPathLBxWnd()
{
//Find path list box window
ClearScreen();
CreateStartPosList();
CreateEndPosList();
for(;g_iWndLevel == 2;)
{
POS_Ctrl pCtrl;
POSMSG pMsg_LB;
pMsg_LB=WaitMessage(0);
if(pMsg_LB->pOSCtrl)
{
if(pMsg_LB->pOSCtrl->CtrlMsgCallBk)
(*pMsg_LB->pOSCtrl->CtrlMsgCallBk)(pMsg_LB);
}
else
{
switch(pMsg_LB->Message)
{
case OSM_KEY:
if(pMsg_LB->WParam == 0)
{
g_iWndLevel = 0;
break;
}
pCtrl=GetCtrlfromID(NULL, GetWndCtrlFocus(NULL));
if(pCtrl->CtrlType==CTRLTYPE_WINDOW)
{
if((((PWnd)pCtrl)->style&WND_STYLE_MODE)==WND_STYLE_MODE)
{
OSOnSysMessage(pMsg_LB);
break;
}
}
if(onKeyPath(pMsg_LB->WParam,pMsg_LB->LParam))
break;
default:
OSOnSysMessage(pMsg_LB);
break;
}
}
DeleteMessage(pMsg_LB);
OSTimeDly(100);
}
DestoryDC(pdc);
return;
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// 3 level window for finding path by touching screen
void FindPathKbdWnd()
{
POSMSG pMsg;
int iExit = 0;
// Array used for storing the choosed point
int KeyChoosePnt[2];
// Array used for representing the state of the KeyChoosePnt array,
// which can only be set three value 0,1 or 2
// ChoosePntState[0] == 0 means no value in KeyChoosePnt[0]
// ChoosePntState[0] == 1 means there is value in KeyChoosePnt[0]
// ChoosePntState[0] == 2 means the last value is lied into KeyChoosePnt[0]
// ChoosePntState[1] is the same with ChoosePntState[0]
int ChoosePntState[2];
ChoosePntState[0] = 0;
ChoosePntState[1] = 0;
// Display the map and initialize the image for beginning choosing
ClearScreen();
ShowBmp(pdc,"map.bmp",0,0);
TextOut(pdc,15,215,UchDistance,TRUE,FONTSIZE_SMALL);
//Start the choose
while( iExit == 0 )
{
TextOut(pdc, 210, 215, g_strTime, TRUE, 1);
pMsg=WaitMessage(1);
if(pMsg->Message == OSM_KEY)
{
switch(pMsg->WParam)
{
case 0:
iExit = 1;
g_iWndLevel = 0;
break;
case 4:
LoadChoosedPoint(7,KeyChoosePnt,ChoosePntState);
break;
case 5:
LoadChoosedPoint(8,KeyChoosePnt,ChoosePntState);
break;
case 8:
LoadChoosedPoint(4,KeyChoosePnt,ChoosePntState);
break;
case 9:
LoadChoosedPoint(5,KeyChoosePnt,ChoosePntState);
break;
case 10:
LoadChoosedPoint(6,KeyChoosePnt,ChoosePntState);
break;
case 11:
LoadChoosedPoint(1,KeyChoosePnt,ChoosePntState);
break;
case 12:
LoadChoosedPoint(2,KeyChoosePnt,ChoosePntState);
break;
case 13:
LoadChoosedPoint(3,KeyChoosePnt,ChoosePntState);
break;
case 14:
DisplayResult(pdc,KeyChoosePnt,PlacePointArray);
break;
}
}
DeleteMessage(pMsg);
}
return;
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// 4 level window for watching map
void WatchMapWnd()
{
POSMSG pMsg;
// v represent the vertical moved steps
// h represent the horizontal moved steps
int iExit = 0,v = 0,h = 0;
ClearScreen();
ShowBmp(pdc,"bmap.bmp",-160,-120);
ShowBmp(pdc,"down_1.bmp",7,142);
//Start moving map
while( iExit == 0 )
{
pMsg=WaitMessage(0);
if(pMsg->Message == OSM_KEY)
{
switch(pMsg->WParam)
{
case 0:
iExit = 1;
g_iWndLevel = 0;
break;
case 5:
// Limit the steps within 5 steps
if(v < 5)
{
v += 1;
ShowMap(5,h,v);
}
break;
case 8:
if(h < 5)
{
h += 1;
ShowMap(8,h,v);
}
break;
case 10:
if(h > -5)
{
h -= 1;
ShowMap(10,h,v);
}
break;
case 12:
if(v > -5)
{
v -= 1;
ShowMap(12,h,v);
}
break;
}
}
DeleteMessage(pMsg);
}
return;
}
//&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
// Show map when operateing the keyboard
void ShowMap( int i, int h, int v)
{
switch( i )
{
case 5:
ClearScreen();
ShowBmp(pdc,"bmap.bmp",-160+32*h,-120+24*v);
ShowBmp(pdc,"up_1.bmp",7,142);
break;
case 8:
ClearScreen();
ShowBmp(pdc,"bmap.bmp",-160+32*h,-120+24*v);
ShowBmp(pdc,"left_1.bmp",7,142);
break;
case 10:
ClearScreen();
ShowBmp(pdc,"bmap.bmp",-160+32*h,-120+24*v);
ShowBmp(pdc,"righ_1.bmp",7,142);
OSTimeDly(20);
break;
case 12:
ClearScreen();
ShowBmp(pdc,"bmap.bmp",-160+32*h,-120+24*v);
ShowBmp(pdc,"down_1.bmp",7,142);
break;
}
return;
}
// 5 level window for help
void HelpWnd()
{
POSMSG pMsg;
int iExit = 0;
ClearScreen();
ShowBmp(pdc,"help.bmp",10, 10);
//Start the catoon dislplay
while( iExit == 0 )
{
ClearScreen();
ShowBmp(pdc,"help.bmp", 0, 0);
ShowBmp(pdc,"down_2.bmp", 55, 135);
ShowBmp(pdc,"two_1.bmp", 130,135);
ShowBmp(pdc,"down_1.bmp", 195,135);
OSTimeDly(100);
ClearScreen();
ShowBmp(pdc,"help.bmp", 0, 0);
ShowBmp(pdc,"down_4.bmp", 55, 135);
ShowBmp(pdc,"two_3.bmp", 130,135);
ShowBmp(pdc,"down_3.bmp", 195,135);
OSTimeDly(100);
pMsg=WaitMessage(1);
if(pMsg->Message == OSM_KEY)
{
if (pMsg->WParam == 0)
{
iExit = 1;
g_iWndLevel = 0;
}
}
DeleteMessage(pMsg);
}
return;
}
//over
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -