今天乖乖的看程序哦~開始p圖ing~只要做成bmp的就可以了吧。。
看到別人寫的文章說方塊的移動(dòng)要用到中斷。。覺得好神奇額。。。中斷的勢(shì)力程序貼在下面
好像讀取鍵盤用的是鍵盤碼
for (;;)
{
key=bioskey(0); /* wait for a keystroke */
printf("0x%x\n",key);
if (key==0x11b) break; /* Escape */
}
常用按鍵的按鍵碼如下:
#define VK_LEFT 0x4b00
#define VK_RIGHT 0x4d00
#define VK_DOWN 0x5000
#define VK_UP 0x4800
#define VK_HOME 0x4700
#define VK_END 0x4f00
#define VK_SPACE 0x3920
#define VK_ESC 0x011b
#define VK_ENTER 0x1c0d
或者可以像有些游戲里面用W。A。S。D。鍵吧
*************************我是無良的分割線***************************
/* 這個(gè)程序每隔1秒鐘輸出一個(gè)整數(shù),10秒鐘后結(jié)束程序。
按escape鍵提前退出程序 。*/
#include <stdio.h>
#include <dos.h>
#include <conio.h>
/* Escape key */
#define VK_ESC 0x11b
#define TIMER 0x1c /* 時(shí)鐘中斷的中斷號(hào) */
/* 中斷處理函數(shù)在C和C++中的表示略有不同。
如果定義了_cplusplus則表示在C++環(huán)境下,否則是在C環(huán)境下。 */
#ifdef __cplusplus
#define __CPPARGS ...
#else
#define __CPPARGS
#endif
int TimerCounter=0; /* 計(jì)時(shí)變量,每秒鐘增加18。 */
/* 指向原來時(shí)鐘中斷處理過程入口的中斷處理函數(shù)指針(句柄) */
void interrupt ( *oldhandler)(__CPPARGS);
/* 新的時(shí)鐘中斷處理函數(shù) */
void interrupt newhandler(__CPPARGS)
{
/* increase the global counter */
TimerCounter++;
/* call the old routine */
oldhandler();
}
/* 設(shè)置新的時(shí)鐘中斷處理過程 */
void SetTimer(void interrupt (*IntProc)(__CPPARGS))
{
oldhandler=getvect(TIMER);
disable(); /* 設(shè)置新的時(shí)鐘中斷處理過程時(shí),禁止所有中斷 */
setvect(TIMER,IntProc);
enable(); /* 開啟中斷 */
}
/* 恢復(fù)原有的時(shí)鐘中斷處理過程 */
void KillTimer()
{
disable();
setvect(TIMER,oldhandler);
enable();
}
void main(void)
{
int key,time=0;
SetTimer(newhandler); /* 修改時(shí)鐘中斷 */
for (;;)
{
if (bioskey(1))
{
key=bioskey(0);
if (key==VK_ESC) /* 按escape鍵提前退出程序 */
{
printf("User cancel!\n");
break;
}
}
if (TimerCounter>18) /* 1秒鐘處理一次 */
{
/* 恢復(fù)計(jì)時(shí)變量 */
TimerCounter=0;
time++;
printf("%d\n",time);
if (time==10) /* 10秒鐘后結(jié)束程序 */
{
printf("Program terminated normally!\n");
break;
}
}
}
KillTimer(); /* 恢復(fù)時(shí)鐘中斷 */
}
*********************************************************
中規(guī)中矩的馬里奧圖片初稿

搞笑下~~wow血精靈牧師版本~~絕對(duì)的醫(yī)生~~被我命名為豆豆~~哇卡卡卡


ps:繼續(xù)畫哈~~跟本文無關(guān)了哦~~我家可愛的兔兔

補(bǔ)充:明天開始填色定稿~~這個(gè)給婷婷先用哦~~申請(qǐng)休息下~~哇卡卡阿卡~~我自己批準(zhǔn)了~~~