超级玛丽增强版源代码(1).doc
《超级玛丽增强版源代码(1).doc》由会员分享,可在线阅读,更多相关《超级玛丽增强版源代码(1).doc(213页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、Four short words sum up what has lifted most successful individuals above the crowd: a little bit more.-author-date超级玛丽增强版源代码(1)超级玛丽增强版源代码(1)/bitmaptool.h#ifndef _BITMAPTOOL#define _BITMAPTOOL#include filereport.h#define BM_BOTTOM_RIGHT 0#define BM_BOTTOM_CENTER 1#define BM_CENTER 2#define BM_USER 3
2、/class MYBITMAPpublic:MYBITMAP();MYBITMAP();/初始化void Init(HINSTANCE hInstance,int iResource,int row,int col);void SetDevice(HDC hdest,HDC hsrc,int wwin,int hwin);/void SetPos(int istyle,int x,int y);/显示void Draw(DWORD dwRop);void Stretch(int x,int y);void Stretch(int x,int y,int id);void Show(int x,
3、int y);void ShowCenter(int y);void ShowLoop(int left,int top,int right,int bottom,int iframe);void ShowNoBack(int x,int y,int iFrame);void ShowNoBackLoop(int x,int y,int iFrame,int iNum);/动画播放void ShowAni();void SetAni(int x,int y);/FILEREPORT f;HBITMAP hBm;public:/按照行列平均分成几个int inum;int jnum;int wi
4、dth;int height;int screenwidth;int screenheight;HDC hdcdest;HDC hdcsrc;/当前位置int xpos;int ypos;int iStartAni;class MYBKSKY:public MYBITMAPpublic:MYBKSKY();MYBKSKY();/showvoid DrawRoll(); /循环补空void DrawRollStretch(int x,int y);void DrawRollStretch(int x,int y,int id);void MoveTo(int x,int y);void Move
5、Roll(int x);/dataint xseparate;#define BM_SQUARE 1class MYANIOBJ:public MYBITMAPpublic:MYANIOBJ();MYANIOBJ();/init listvoid InitAniList(int *pw,int *ph,int inum,int ismask);void InitAniList(int style,int a,int b);/showvoid DrawItem(int x,int y,int id,int iframe);void DrawItemNoMask(int x,int y,int i
6、d,int iframe);/指定宽度void DrawItemNoMaskWidth(int x,int y,int id,int w,int iframe);/自动播放void PlayItem(int x,int y,int id);/int wlist20;int hlist20;int ylist20;int iframeplay;class MYANIMAGIC:public MYBITMAPpublic:MYANIMAGIC();MYANIMAGIC();/init listvoid InitAniList(int *pw,int *ph,int inum);void SetDe
7、vice(HDC hdest,HDC hsrc,HDC htemp);/showvoid DrawItem(int x,int y,int id,int iframe);/int wlist20;int hlist20;int ylist20;HDC hdctemp;class MYROLE:public MYBITMAPpublic:MYROLE();MYROLE();/initvoid InitRole(int xleft, int xright);void SetLimit(int xleft, int xright);/showvoid Draw();void Draw(int x,i
8、nt y,int iframe);void ChangeFrame();void SetState(int i);void Move();void Jump();/ANIvoid MoveTo(int x,int y);void MoveOffset(int x,int y);void MoveStepTo(int x,int y);/向目的地移动单位距离void PlayAni();/播放一段动画void SetAni(int istyle);int IsInAni();/是否正在播放动画/dataint iState;int iFrame;int minx;int maxx;/movein
9、t movex;int movey;/ jumpint jumpheight;int jumpx;/方向int idirec;/动画int iAniBegin;int iparam1;int iAniStyle;#endif/ bitmaptool.cpp/ Finishing #include stdafx.h#include bitmaptool.h#include gamemap.hextern GAMEMAP gamemap;extern FILEREPORT f1;MYBITMAP:MYBITMAP()MYBITMAP:MYBITMAP()DeleteObject(hBm);void
10、 MYBITMAP:Init(HINSTANCE hInstance,int iResource,int row,int col)BITMAP bm;inum=row;jnum=col;hBm=LoadBitmap(hInstance,MAKEINTRESOURCE(iResource);GetObject(hBm,sizeof(BITMAP),&bm);width=bm.bmWidth/inum;height=bm.bmHeight/jnum;void MYBITMAP:SetDevice(HDC hdest,HDC hsrc,int wwin,int hwin)hdcdest=hdest;
11、hdcsrc=hsrc;screenwidth=wwin;screenheight=hwin;void MYBITMAP:Show(int x,int y)xpos=x;ypos=y;SelectObject(hdcsrc,hBm);BitBlt(hdcdest,xpos,ypos,width,height,hdcsrc,0,0,SRCCOPY);void MYBITMAP:ShowCenter(int y)xpos=(screenwidth-width)/2;ypos=y;SelectObject(hdcsrc,hBm);BitBlt(hdcdest,xpos,ypos,width,heig
12、ht,hdcsrc,0,0,SRCCOPY);void MYBITMAP:ShowLoop(int left,int top,int right,int bottom,int iframe)int i,j;SelectObject(hdcsrc,hBm);for(j=top;jbottom;j+=height)for(i=left;iright;i+=width)BitBlt(hdcdest,i,j,width,height,hdcsrc,iframe*width,0,SRCCOPY);void MYBITMAP:ShowNoBack(int x,int y,int iFrame)xpos=x
13、;ypos=y;SelectObject(hdcsrc,hBm);BitBlt(hdcdest,xpos,ypos,width,height/2,hdcsrc,iFrame*width,height/2,SRCAND);BitBlt(hdcdest,xpos,ypos,width,height/2,hdcsrc,iFrame*width,0,SRCPAINT);void MYBITMAP:ShowNoBackLoop(int x,int y,int iFrame,int iNum)int i;xpos=x;ypos=y;SelectObject(hdcsrc,hBm);for(i=0;i=in
14、um)iStartAni=0;*/void MYBITMAP:SetAni(int x,int y)xpos=x;ypos=y;/*framenow=0;iStartAni=1;*/void MYBITMAP:SetPos(int istyle,int x,int y)switch(istyle)case BM_CENTER:xpos=(screenwidth-width)/2;ypos=y;break;case BM_USER:xpos=x;ypos=y;break;void MYBITMAP:Draw(DWORD dwRop)SelectObject(hdcsrc,hBm);BitBlt(
15、hdcdest,xpos,ypos,width,height,hdcsrc,0,0,dwRop);void MYBITMAP:Stretch(int x,int y)SelectObject(hdcsrc,hBm);StretchBlt(hdcdest,xpos,ypos,width*x,height*y,hdcsrc,0,0,width,height,SRCCOPY);void MYBITMAP:Stretch(int x,int y,int id)SelectObject(hdcsrc,hBm);StretchBlt(hdcdest,xpos,ypos,width*x,height*y,h
16、dcsrc,0,id*height,width,height,SRCCOPY);/ bitmap object animation/MYBKSKY:MYBKSKY()xseparate=0;MYBKSKY:MYBKSKY()void MYBKSKY:MoveTo(int x,int y)xpos=x;ypos=y;void MYBKSKY:MoveRoll(int x)xseparate+=x;xseparate%=width;if(xseparate0)xseparate=width;void MYBKSKY:DrawRoll()SelectObject(hdcsrc,hBm);BitBlt
17、(hdcdest,xpos,ypos,width-xseparate,height,hdcsrc,xseparate,0,SRCCOPY);BitBlt(hdcdest,xpos+width-xseparate,ypos,xseparate,height,hdcsrc,0,0,SRCCOPY);void MYBKSKY:DrawRollStretch(int x,int y)SelectObject(hdcsrc,hBm);StretchBlt(hdcdest,xpos,ypos,(width-xseparate)*x,height*y,hdcsrc,xseparate,0,width-xse
18、parate,height,SRCCOPY);StretchBlt(hdcdest,xpos+(width-xseparate)*x,ypos,xseparate*x,height*y,hdcsrc,0,0,xseparate,height,SRCCOPY);void MYBKSKY:DrawRollStretch(int x,int y, int id)SelectObject(hdcsrc,hBm);StretchBlt(hdcdest,xpos,ypos,(width-xseparate)*x,height*y,hdcsrc,xseparate,id*height,width-xsepa
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 超级 玛丽 增强 源代码
限制150内