int jumpx;
//方向
int idirec;
//动画
int iAniBegin;
int iparam1;
int iAniStyle;
};
#endif
// bitmaptool.cpp
// Finishing codefans
#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=bm.bmWidth/inum;
height=bm.bmHeight/jnum;estonia
}
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<bottom;j+=height)
{
for(i=left;i<right;i+=width)
{
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<iNum;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)
{shelf的复数
ca BM_CENTER:
xpos=(screenwidth-width)/2;
ypos=y;
码头费 break;
ca 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()
{
xparate=0;
}
MYBKSKY::~MYBKSKY()
{}
void MYBKSKY::MoveTo(int x,int y)
{
xpos=x;
ypos=y;
}
void MYBKSKY::MoveRoll(int x)
{
xparate+=x;
xparate%=width;
if(xparate<0)
{
xparate=width;
}
}
void MYBKSKY::DrawRoll()
{
SelectObject(hdcsrc,hBm);
BitBlt(hdcdest,xpos,ypos,
width-xparate,height,
hdcsrc,xparate,0,SRCCOPY);
BitBlt(hdcdest,xpos+width-xparate,ypos,
xparate,height,
hdcsrc,0,0,SRCCOPY);
}
void MYBKSKY::DrawRollStretch(int x,int y)
地心游记1{
SelectObject(hdcsrc,hBm);
StretchBlt(hdcdest,xpos,ypos,
(width-xparate)*x,height*y,
hdcsrc,xparate,0,
width-xparate,height,
SRCCOPY);
StretchBlt(hdcdest,xpos+(width-xparate)*x,ypos,
xparate*x,height*y,
hdcsrc,0,0,
xparate,height,
SRCCOPY);
}
void MYBKSKY::DrawRollStretch(int x,int y, int id)
{
SelectObject(hdcsrc,hBm);
StretchBlt(hdcdest,xpos,ypos,
(width-xparate)*x,height*y,
hdcsrc,xparate,id*height,
width-xparate,height,2020高考语文卷
SRCCOPY);
StretchBlt(hdcdest,xpos+(width-xparate)*x,ypos,
xparate*x,height*y,
hdcsrc,0,id*height,
xparate,height,
SRCCOPY);
}
///////////////////////// bitmap role//////////////////
MYROLE::MYROLE()
{}
李阳疯狂英语365句MYROLE::~MYROLE()
{}
void MYROLE::MoveTo(int x,int y)
{
xpos=x;
ypos=y;
}
void MYROLE::MoveOfft(int x,int y)
{
if(x==0 && y==0)
return;
if(!gamemap.RoleCanMove(x,y))
return;
xpos+=x;
ypos+=y;
if(xpos<minx)
xpos=minx;
if(xpos>maxx)
xpos=maxx; 珠海翻译
}
void MYROLE::MoveStepTo(int x,int y)
{
if(xpos<x)
xpos+=ROLE_STEP;
if(ypos<y)
ypos+=8;
if(ypos>y)
ypos=y;
}
// 去背显示
void MYROLE::Draw()
{
if(iAniBegin)mia sara