2024年2月21日发(作者:)
int jumpx;
//方向
int idirec;
//动画
int iAniBegin;
int iparam1;
int iAniStyle;
};
#endif
//
// Finishing
#include "stdafx.h"
#include "bitmaptool.h"
#include "gamemap.h"
extern GAMEMAP gamemap;
extern FILEREPORT f1;
MYBITMAP::MYBITMAP()
{}
MYBITMAP::~MYBITMAP()
{
DeleteObject(hBm);
}
void 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=h/inum;
height=ht/jnum;
}
void MYBITMAP::SetDevice(HDC hdest,HDC hsrc,int wwin,int
hwin)
{
hdcdest=hdest;
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,height,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;j { for(i=left;i { BitBlt(hdcdest,i,j,width,height,hdcsrc,iframe*width,0,SRCCOPY); } } } void MYBITMAP::ShowNoBack(int x,int y,int iFrame) { xpos=x; 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 { BitBlt(hdcdest,xpos+i*width,ypos,width,height/2,hdcsrc,iFrame*width,height/2,SRCAND); BitBlt(hdcdest,xpos+i*width,ypos,width,height/2,hdcsrc,iFrame*width,0,SRCPAINT); } } void MYBITMAP::ShowAni() { /* if(!iStartAni) return; SelectObject(hdcsrc,hBm); BitBlt(hdcdest,xpos,ypos,width,height/2,hdcsrc,framenow*width,height/2,SRCAND); BitBlt(hdcdest,xpos,ypos,width,height/2,hdcsrc,framenow*width,0,SRCPAINT); framenow++; //播放结束 if(framenow>=inum) 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(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, hdcsrc,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(xseparate<0) { xseparate=width; } } void MYBKSKY::DrawRoll() { SelectObject(hdcsrc,hBm); BitBlt(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-xseparate,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-xseparate,height, SRCCOPY); StretchBlt(hdcdest,xpos+(width-xseparate)*x,ypos, xseparate*x,height*y, hdcsrc,0,id*height, xseparate,height, SRCCOPY); } ///////////////////////// bitmap role////////////////// MYROLE::MYROLE() {} MYROLE::~MYROLE() {} void MYROLE::MoveTo(int x,int y) { xpos=x; ypos=y; } void MYROLE::MoveOffset(int x,int y) { if(x==0 && y==0) return; if(!nMove(x,y)) return; xpos+=x; ypos+=y; if(xpos xpos=minx; if(xpos>maxx) xpos=maxx; } void MYROLE::MoveStepTo(int x,int y) {


发布评论