You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
82 lines
993 B
82 lines
993 B
#include "mover.h"
|
|
#include "define.h"
|
|
|
|
void Mover::Move(int dir)
|
|
{
|
|
if (dir == DIR_NONE)
|
|
return;
|
|
|
|
ClearDraw();
|
|
|
|
switch (dir)
|
|
{
|
|
case DIR_UP: y -= speed; break;
|
|
case DIR_DOWN: y += speed; break;
|
|
case DIR_LEFT: x -= speed; break;
|
|
case DIR_RIGHT: x += speed; break;
|
|
}
|
|
|
|
Draw();
|
|
}
|
|
|
|
void Mover::NextXY(int dir, double& nx, double& ny)
|
|
{
|
|
nx = x;
|
|
ny = y;
|
|
|
|
switch (dir)
|
|
{
|
|
case DIR_UP: ny -= speed; break;
|
|
case DIR_DOWN: ny += speed; break;
|
|
case DIR_LEFT: nx -= speed; break;
|
|
case DIR_RIGHT: nx += speed; break;
|
|
}
|
|
}
|
|
|
|
void Mover::Draw()
|
|
{
|
|
}
|
|
|
|
void Mover::ClearDraw()
|
|
{
|
|
}
|
|
|
|
Mover::Mover()
|
|
{
|
|
loadimage(&img, _T("default_mover.png"), MOVER_SIZE, MOVER_SIZE, true);
|
|
x = 1;
|
|
y = 1;
|
|
speed = 0.1;
|
|
}
|
|
|
|
double Mover::GetX()
|
|
{
|
|
return x;
|
|
}
|
|
|
|
double Mover::GetY()
|
|
{
|
|
return y;
|
|
}
|
|
|
|
double Mover::GetSpeed()
|
|
{
|
|
return speed;
|
|
}
|
|
|
|
void Mover::SetXY(double _x, double _y)
|
|
{
|
|
x = _x;
|
|
y = _y;
|
|
}
|
|
|
|
void Mover::SetSpeed(double _speed)
|
|
{
|
|
speed = _speed;
|
|
}
|
|
|
|
void Mover::SetImage(IMAGE _img)
|
|
{
|
|
img = _img;
|
|
}
|