Добавил:
Вуз:
Предмет:
Файл:
#include "PathFinder.h"
#include "settings.h"
#include "Engine.h"
PathFinder::PathFinder(double x, double y) : finderSetImg(NULL)
{
position.x = x;
position.y = y;
}
PathFinder::~PathFinder()
{
finderSetImg->Release();
}
void PathFinder::Draw(ID2D1HwndRenderTarget* mRenderTarget)
{
if (finderSetImg == NULL)
{
finderSetImg = engine->LoadImageW(L"character.png");
}
/*D2D1_RECT_F rectangle1 = D2D1::RectF(
position.x - Engine::offset - FINDER_WIDTH / 2, position.y - FINDER_HEIGHT,
position.x - Engine::offset + FINDER_WIDTH / 2 - 1, position.y
);*/
D2D1_RECT_F rectangle1 = D2D1::RectF(
position.x * FINDER_WIDTH - Engine::offset, position.y * FINDER_HEIGHT,
(position.x + 1) * FINDER_WIDTH - Engine::offset + 1, (position.y + 1) * FINDER_WIDTH
);
//int posX = (int)position.x % 20 / 10;
//int posY = 1;
int posX = 3 % 7;
int posY = 3 / 7;
D2D1_RECT_F rectangle2 = D2D1::RectF(
posX * FINDER_WIDTH, posY * FINDER_WIDTH,
posX * FINDER_WIDTH + FINDER_WIDTH - 1, posY * FINDER_WIDTH + TILE_WIDTH - 1
);
/*D2D1_RECT_F rectangle2 = D2D1::RectF(
posX * FINDER_WIDTH, posY * FINDER_HEIGHT,
(posX + 1) * FINDER_WIDTH - 1, (posY + 1) * FINDER_HEIGHT - 1
);*/
mRenderTarget->DrawBitmap(finderSetImg, rectangle1, 1.0f, D2D1_BITMAP_INTERPOLATION_MODE_NEAREST_NEIGHBOR, rectangle2);
}
void PathFinder::Logic(double elapsed_time)
{
position.x += 10 * elapsed_time;
}
Соседние файлы в папке 6
