timesynk/interface/sdl.h

68 lines
1.8 KiB
C

#ifndef SDL_H
#define SDL_H
#include "../player.h" // for races/class totals
#define EVENT_TICK 1
#define EVENT_NET 2
#define EVENT_NET_ACCEPT 3
#define EVENT_NET_RECV 4
#define EVENT_NET_LOST 5
#define EVENT_NET_ERROR 6
#define EVENT_NET_CLIENT_RECV 7
#define EVENT_NET_CLIENT_LOST 8
#define EVENT_NET_CLIENT_ERROR 9
SDL_Surface* screen;
SDL_Surface* font_spritesheet;
SDL_Surface* ui_spritesheet;
SDL_Surface* player_spritesheet;
SDL_Surface* npc_spritesheet;
SDL_Surface* shadow_spritesheet;
SDL_Surface* wall_spritesheet;
SDL_Surface* floor_spritesheet;
SDL_Surface* door_spritesheet;
SDL_Surface* camera_surface;
SDL_Event event;
Uint32 delay; // our delay in ms
SDL_TimerID timer_id; // the timer id from SDL_AddTimer
int video_width;
int video_height;
int video_mode;
int video_fullscreen; // 0=windowed, 1=fullscreen
float g_tile_scale_x;
float g_tile_scale_y;
float g_tile_width;
float g_tile_height;
void interfaceSetScale(float scale_x, float scale_y);
void SDL_CopySurface(SDL_Surface *from_surface, SDL_Rect *from_rect, SDL_Surface *to_surface, SDL_Rect *to_rect);
float g_ui_scale_x;
float g_ui_scale_y;
#define UI_HOTBAR_ITEM_HEIGHT 32
#define UI_HOTBAR_ITEM_WIDTH 32
float g_hotbar_scale_x;
float g_hotbar_scale_y;
SDL_Surface *ui_hotbar_surface;
SDL_Rect *ui_hotbar_target_rect;
int uiInit();
void uiDraw();
void uiSetScale(float scale_x, float scale_y);
void interfaceDrawString(const char *string, int start_x, int start_y);
void interfaceDrawChar(char ch, int start_x, int start_y);
void interfaceVideoSetSize(const char *input_string);
SDL_Surface *interfaceScaleSurface(SDL_Surface *surface, float scale_x, float scale_y);
static int networkThread(void *nada);
SDL_Thread *network_thread;
Uint32 pushTickEvent(Uint32 interval, void *param);
#endif