|
????????(RPG)????????????????, ???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
? ???????
???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????=????????+??????????????????????????????????????
? ?????????
?????????????????????????????????????????????????????????
????????????????????????????????????????????????????????
?????????????????????????????????????????
???????????????????????????????????
????????????????????????????
??????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????
(?) ?????????
1??????
?????????????????????????????????????????????????????????C?C++?VC++?Delphi?C++ Builder????Windows???????????????????????????Windows???????VC????????????Windows????????????????????????VC???????????????????????????????????????VC++???????????????
2?DirectX?????
????Windows???????????????????DirectX SDK?
??Windows????????????????????????????????????????????????????Windows?????????????????????????????????????????????????????????????????????????????????????Windows????????DirectX??????????????DirectX?????????????????????????????DirectX????????SDK??????????????????APIs????????????????????????????????????
??DirectX?6???????
????DirectDraw? ????????????????????????????????????
????Direct3D? ???3D?????
????DirectSound? ????3D???????????????
????DirectPlay? ????????????????????????????
????DirectInput? ?????????????
????DirectSetup? ????DirectX?????
????DirectX???????????????DirectMusic?
3?AlphaBlend ??
??????????????????????????AlphaBlend ?????AlphaBlend?????????"Alpha"?????????????????????????????????????????R(??)?G(??)?B(??)??????????????A??????????B?????B??A???????C??B?A???????B???????alpha(???0-1?0??????1??????)?Alpha???????
????R(C)=alpha*R(B)+(1-alpha)*R(A)
????G(C)=alpha*G(B)+(1-alpha)*G(A)
????B(C)=alpha*B(B)+(1-alpha)*B(A)
??R(x)?G(x)?B(x)?????x?RGB?????????????????Alpha??????????????????Alpha????????????????????????????????????????
4?A*??
???????????????????????????????????????????????????????????A*????
??A*??????????????????????????????????????????????????????????????????????????????????A*????????????????A*????????????
????f(n) = g(n) + h(n)
?????f(n)???n??????g(n)?????????????h(n)?n???????????????A*????????????????????????????????????????????????
???????????????????????????????????????????DirectX??????????????
??????????
1?????????
??RPG???????????????????????????????????????????????????????????????????????????????RPG??????????????????????????????????????????????????????????????? RPG???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
MapData[X][Y]? //?????X???????Y??????
Picture[num]? //??????num???????
void MakeBackGround() //??????
{
?int n;
?for( int i=0; i<Y; i++) //?Y?
?for( int j=0; j<X; j++) //?X?
?{
??n=MapData[ i ][ j ]; //??????????
??Draw( j*32, i*32, Picture[n]); //????(j*32,i*32)???
?}
}
2?????????
??????????????????????????????????????????????????????????????????
????????
?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
//???????????
DWORD Message; //????
WinMain() //????
{
???????;
????DirectDraw???????????????????
?while( 1 ) //????
?{
??switch( Message )
??{
???case ????: ????();
???case ????? ????();
???case ????? ????();
??}
?}
}
???????????
????RPG????????????????????????????????????????????????????????????????????????????????? ? ???? ?????????????????????????
???????
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????????????????????????????
?????
???????????????????????????????????4???????????????????????????????????????????????????????????????DirectDraw????SetColorKey?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????(??3)????????????????1??????????0?
???????
????????????????????????????????????????????????????????????????????????????????????????????????????????001????????????????????001??????????????001??????????????????????????????????
void MessageLoop( int Msg ) //????
{
?switch( Msg )
?{
??char AddressName[16]; //??AddressName[16]?????????????
??case ADDRESS == 001: // ?ADDRESS???????????
??ScreenX=12; ScreenY=0; //?????????
??Hero.x=360; Hero.y=80;//????
??Move();//??????
??//??????????????
??sprintf(AddressName,"??????????");
??PrintText(lpDDSPrimary, 280, 330,AddressName , RGB(255,255,255));//????????????
??break;
?}
}
??????
???????RPG???????????????????RPG?????????????RPG?????????????????????????????????????????????????????????????????????????????
?????????????????????????????????????????????????????????????????????? [em1] |
|