74 lines
1.7 KiB
C
74 lines
1.7 KiB
C
/*
|
|
** EPITECH PROJECT, 2018
|
|
** task01
|
|
** File description:
|
|
** I do task
|
|
*/
|
|
#include "lib/my_graphics.h"
|
|
#include "game/draw.h"
|
|
#include "game/core.h"
|
|
|
|
static const uint8_t princess_r[] = {0, 126, 66, 86, 66, 66, 126, 66};
|
|
static const uint8_t princess_l[] = {0, 126, 66, 106, 66, 66, 126, 66};
|
|
static const uint8_t grass[] = {255, 221, 187, 255, 255, 255, 255, 255};
|
|
static const uint8_t pik_right[] = {1, 3, 1, 0, 1, 3, 1, 0};
|
|
static const uint8_t pik_down[] = {0, 0, 0, 0, 0, 0, 68, 238};
|
|
static const uint8_t pik_up[] = {238, 68, 0, 0, 0, 0, 0, 0};
|
|
static const uint8_t pik_left[] = {128, 192, 128, 0, 128, 192, 128, 0};
|
|
static const uint8_t *pik[] = {
|
|
pik_down, pik_up, pik_right, pik_left
|
|
};
|
|
|
|
void draw_ground(sfml_t *sfml, int x, int y, uint8_t grass_id)
|
|
{
|
|
int rectangle[4];
|
|
int draw[4];
|
|
|
|
if (grass_id == ID_GROUND || grass_id == ID_FAKE_GROUND){
|
|
rectangle[0] = x;
|
|
rectangle[1] = y;
|
|
rectangle[2] = 64 + x;
|
|
rectangle[3] = 64 + y;
|
|
my_filled_rectangle(sfml, rectangle, 0x000000ff);
|
|
} else {
|
|
draw[0] = x;
|
|
draw[1] = y;
|
|
draw[2] = 3;
|
|
draw[3] = 0x000000ff;
|
|
draw_monochrome(sfml, grass, draw);
|
|
}
|
|
}
|
|
|
|
void draw_pik(sfml_t *sfml, int x, int y, uint8_t direction)
|
|
{
|
|
int draw[4];
|
|
|
|
draw[0] = x;
|
|
draw[1] = y;
|
|
draw[2] = 3;
|
|
draw[3] = 0x000000ff;
|
|
draw_monochrome(sfml, pik[direction], draw);
|
|
}
|
|
|
|
void draw_princess(sfml_t *sfml, int x, int y)
|
|
{
|
|
int rect[5];
|
|
int draw[4];
|
|
|
|
draw[0] = x;
|
|
draw[1] = y;
|
|
draw[2] = 3;
|
|
draw[3] = 0x000000ff;
|
|
draw_monochrome(sfml, (x > sfml->scene->player->x -
|
|
sfml->scene->camera->x)
|
|
? princess_l : princess_r, draw);
|
|
if (sfml->debug){
|
|
rect[0] = x + 8;
|
|
rect[1] = y + 8;
|
|
rect[2] = x + 56;
|
|
rect[3] = y + 64;
|
|
rect[4] = 2;
|
|
my_rectangle(sfml, rect, 0xff0000ff, 0x00000000);
|
|
}
|
|
}
|