68 lines
2.0 KiB
C
68 lines
2.0 KiB
C
#include "render.h"
|
|
|
|
float render_zoom = 2.0;
|
|
|
|
static Texture2D render_texture [render_texture_count];
|
|
|
|
static Font font = { 0 };
|
|
static Color tint = { 255, 255, 255, 255 };
|
|
static Vector2 dump = { 0, 0 };
|
|
|
|
int render_width (void) { return (GetScreenWidth ()); }
|
|
int render_height (void) { return (GetScreenHeight ()); }
|
|
|
|
void render_sprite (int sprite, int x, int y, int u, int v, int width, int height) {
|
|
Rectangle source, destination;
|
|
|
|
source.x = u;
|
|
source.y = v;
|
|
source.width = width;
|
|
source.height = height;
|
|
|
|
destination.x = x;
|
|
destination.y = y;
|
|
destination.width = width * ((sprite <= ui) ? 1 : render_zoom);
|
|
destination.height = height * ((sprite <= ui) ? 1 : render_zoom);
|
|
|
|
DrawTexturePro (render_texture [sprite], source, destination, dump, 0.0, tint);
|
|
}
|
|
|
|
void render_string (char * string, int x, int y) {
|
|
Vector2 position = { 4, 4 };
|
|
|
|
position.x += x;
|
|
position.y += y;
|
|
|
|
DrawTextPro (font, string, position, dump, 0.0, FONT_SIZE, 4, tint);
|
|
}
|
|
|
|
static void render_clean_up (void) {
|
|
CloseWindow ();
|
|
}
|
|
|
|
void render_configure (void) {
|
|
InitWindow (1800, 900, "EAX");
|
|
SetExitKey (KEY_ESCAPE);
|
|
SetTargetFPS (60);
|
|
|
|
font = LoadFont ("sprite/gothic.ttf");
|
|
|
|
atexit (render_clean_up);
|
|
|
|
render_texture [neonui] = LoadTexture ("sprite/neonui.png");
|
|
render_texture [ui] = LoadTexture ("sprite/ui.png");
|
|
|
|
SetTextureFilter (render_texture [neonui], TEXTURE_FILTER_POINT);
|
|
SetTextureFilter (render_texture [ui], TEXTURE_FILTER_POINT);
|
|
|
|
render_texture [traits] = LoadTexture ("sprite/traits.png");
|
|
render_texture [skills] = LoadTexture ("sprite/skills.png");
|
|
render_texture [values] = LoadTexture ("sprite/values.png");
|
|
render_texture [orcs] = LoadTexture ("sprite/orcs.png");
|
|
render_texture [humans] = LoadTexture ("sprite/humans.png");
|
|
render_texture [elves] = LoadTexture ("sprite/elves.png");
|
|
render_texture [ashlands] = LoadTexture ("sprite/ashlands.png");
|
|
render_texture [base_1] = LoadTexture ("sprite/base_1.png");
|
|
render_texture [base_2] = LoadTexture ("sprite/base_2.png");
|
|
}
|