2010-08-25 06:22:41 -05:00
|
|
|
#ifndef INTERFACE_H
|
|
|
|
#define INTERFACE_H
|
2010-08-29 07:10:58 -05:00
|
|
|
#include <SDL/SDL.h>
|
2011-04-22 18:20:56 -05:00
|
|
|
#if (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11)
|
|
|
|
#include <SDL/SDL_syswm.h>
|
|
|
|
#endif
|
2010-08-29 07:10:58 -05:00
|
|
|
#include "graphics.h"
|
2010-08-25 06:22:41 -05:00
|
|
|
|
|
|
|
struct menu_section
|
|
|
|
{
|
2011-01-28 17:54:50 -06:00
|
|
|
char *icon;
|
|
|
|
const char *name;
|
|
|
|
int itemcount;
|
2010-12-05 20:56:46 -06:00
|
|
|
int doshow;
|
2010-08-25 06:22:41 -05:00
|
|
|
};
|
2010-08-26 04:53:15 -05:00
|
|
|
typedef struct menu_section menu_section;
|
|
|
|
|
2011-10-21 13:41:12 -05:00
|
|
|
#define QM_TOGGLE 1
|
|
|
|
|
|
|
|
struct quick_option
|
|
|
|
{
|
|
|
|
char *icon;
|
|
|
|
const char *name;
|
|
|
|
int type;
|
|
|
|
int *variable;
|
|
|
|
};
|
|
|
|
typedef struct quick_option quick_option;
|
|
|
|
|
2011-05-14 07:57:49 -05:00
|
|
|
struct menu_wall
|
|
|
|
{
|
|
|
|
pixel colour;
|
|
|
|
const char *descs;
|
|
|
|
};
|
|
|
|
typedef struct menu_wall menu_wall;
|
|
|
|
|
2010-08-25 06:22:41 -05:00
|
|
|
#define SC_WALL 0
|
|
|
|
#define SC_ELEC 1
|
2011-06-28 07:58:16 -05:00
|
|
|
#define SC_POWERED 2
|
|
|
|
#define SC_EXPLOSIVE 3
|
|
|
|
#define SC_GAS 4
|
|
|
|
#define SC_LIQUID 5
|
|
|
|
#define SC_POWDERS 6
|
|
|
|
#define SC_SOLIDS 7
|
|
|
|
#define SC_NUCLEAR 8
|
|
|
|
#define SC_SPECIAL 9
|
|
|
|
#define SC_LIFE 10
|
2011-08-23 09:57:37 -05:00
|
|
|
#define SC_TOOL 11
|
2011-06-28 07:58:16 -05:00
|
|
|
#define SC_CRACKER 13
|
|
|
|
#define SC_CRACKER2 14
|
2011-08-23 09:57:37 -05:00
|
|
|
#define SC_TOTAL 12
|
2010-08-25 06:22:41 -05:00
|
|
|
|
2011-05-10 14:32:00 -05:00
|
|
|
static menu_section msections[] = //doshow does not do anything currently.
|
2010-08-25 06:22:41 -05:00
|
|
|
{
|
2011-01-28 17:54:50 -06:00
|
|
|
{"\xC1", "Walls", 0, 1},
|
|
|
|
{"\xC2", "Electronics", 0, 1},
|
2011-06-28 09:21:24 -05:00
|
|
|
{"\xD6", "Powered Materials", 0, 1},
|
2011-01-28 17:54:50 -06:00
|
|
|
{"\xC3", "Explosives", 0, 1},
|
|
|
|
{"\xC5", "Gasses", 0, 1},
|
|
|
|
{"\xC4", "Liquids", 0, 1},
|
|
|
|
{"\xD0", "Powders", 0, 1},
|
|
|
|
{"\xD1", "Solids", 0, 1},
|
|
|
|
{"\xC6", "Radioactive", 0, 1},
|
|
|
|
{"\xCC", "Special", 0, 1},
|
|
|
|
{"\xD2", "Life", 0, 1},
|
2011-08-23 11:31:58 -05:00
|
|
|
{"\xD7", "Tools", 0, 1},
|
2011-02-04 00:00:03 -06:00
|
|
|
{"\xD2", "More Life", 0, 1},
|
|
|
|
{"\xC8", "", 0, 0},
|
2011-01-28 17:54:50 -06:00
|
|
|
{"\xC8", "Cracker", 0, 0},
|
|
|
|
{"\xC8", "Cracker!", 0, 0},
|
2010-08-25 06:22:41 -05:00
|
|
|
};
|
|
|
|
|
2011-10-25 05:40:41 -05:00
|
|
|
static quick_option quickmenu[] =
|
2011-10-21 13:41:12 -05:00
|
|
|
{
|
|
|
|
{"P", "Sand effect", QM_TOGGLE, &pretty_powder},
|
|
|
|
{"G", "Draw gravity grid", QM_TOGGLE, &drawgrav_enable},
|
|
|
|
{NULL}
|
|
|
|
};
|
|
|
|
|
2011-05-10 14:32:00 -05:00
|
|
|
static menu_section colorsections[] = //doshow does not do anything currently.
|
|
|
|
{
|
2011-09-19 16:02:04 -05:00
|
|
|
{"\xC4", "Colors", 7, 1},
|
|
|
|
{"\xD7", "Tools", 0, 1},
|
2011-05-10 14:32:00 -05:00
|
|
|
};
|
2011-09-19 16:02:04 -05:00
|
|
|
#define DECO_SECTIONS 2
|
2011-05-10 14:32:00 -05:00
|
|
|
|
|
|
|
static menu_wall colorlist[] =
|
|
|
|
{
|
|
|
|
{PIXPACK(0xFF0000), "Red"},
|
|
|
|
{PIXPACK(0x00FF00), "Green"},
|
|
|
|
{PIXPACK(0x0000FF), "Blue"},
|
|
|
|
{PIXPACK(0xFFFF00), "Yellow"},
|
|
|
|
{PIXPACK(0xFF00FF), "Pink"},
|
|
|
|
{PIXPACK(0x00FFFF), "Cyan"},
|
|
|
|
{PIXPACK(0xFFFFFF), "White"},
|
|
|
|
};
|
|
|
|
|
2011-09-19 16:02:04 -05:00
|
|
|
#define DECO_DRAW 0
|
|
|
|
#define DECO_LIGHTEN 1
|
|
|
|
#define DECO_DARKEN 2
|
|
|
|
|
|
|
|
static menu_wall toollist[] =
|
|
|
|
{
|
|
|
|
{PIXPACK(0xFF0000), "Draw"},
|
|
|
|
{PIXPACK(0xDDDDDD), "Lighten"},
|
|
|
|
{PIXPACK(0x111111), "Darken"},
|
|
|
|
};
|
|
|
|
|
2010-08-27 07:01:20 -05:00
|
|
|
struct ui_edit
|
|
|
|
{
|
2011-01-28 17:54:50 -06:00
|
|
|
int x, y, w, nx, h;
|
|
|
|
char str[256],*def;
|
|
|
|
int focus, cursor, hide, multiline;
|
2010-08-27 07:01:20 -05:00
|
|
|
};
|
|
|
|
typedef struct ui_edit ui_edit;
|
|
|
|
|
2011-04-04 14:02:11 -05:00
|
|
|
struct ui_copytext
|
|
|
|
{
|
|
|
|
int x, y, width, height;
|
|
|
|
char text[256];
|
|
|
|
int state, hover;
|
|
|
|
};
|
|
|
|
typedef struct ui_copytext ui_copytext;
|
|
|
|
|
2010-10-28 18:18:06 -05:00
|
|
|
struct save_info
|
|
|
|
{
|
2011-01-28 17:54:50 -06:00
|
|
|
char *title;
|
|
|
|
char *name;
|
|
|
|
char *author;
|
|
|
|
char *date;
|
|
|
|
char *description;
|
|
|
|
int publish;
|
|
|
|
int voteup;
|
|
|
|
int votedown;
|
|
|
|
int vote;
|
|
|
|
int myvote;
|
2011-07-06 07:12:05 -05:00
|
|
|
int downloadcount;
|
2011-01-28 17:54:50 -06:00
|
|
|
int myfav;
|
|
|
|
char *tags;
|
|
|
|
int comment_count;
|
|
|
|
char *comments[6];
|
|
|
|
char *commentauthors[6];
|
2010-10-28 18:18:06 -05:00
|
|
|
};
|
|
|
|
typedef struct save_info save_info;
|
|
|
|
|
2010-08-27 07:01:20 -05:00
|
|
|
struct ui_checkbox
|
|
|
|
{
|
2011-01-28 17:54:50 -06:00
|
|
|
int x, y;
|
|
|
|
int focus, checked;
|
2010-08-27 07:01:20 -05:00
|
|
|
};
|
|
|
|
typedef struct ui_checkbox ui_checkbox;
|
|
|
|
|
2011-05-29 11:00:31 -05:00
|
|
|
struct ui_richtext
|
|
|
|
{
|
|
|
|
int x, y;
|
|
|
|
char str[512];
|
|
|
|
char printstr[512];
|
|
|
|
int regionss[6];
|
|
|
|
int regionsf[6];
|
|
|
|
char action[6];
|
|
|
|
char actiondata[6][256];
|
|
|
|
char actiontext[6][256];
|
|
|
|
};
|
|
|
|
typedef struct ui_richtext ui_richtext;
|
|
|
|
|
2010-10-28 18:31:06 -05:00
|
|
|
int SLALT;
|
2010-08-27 07:01:20 -05:00
|
|
|
extern SDLMod sdl_mod;
|
2011-08-20 12:18:09 -05:00
|
|
|
extern int sdl_key, sdl_rkey, sdl_wheel, sdl_caps, sdl_ascii, sdl_zoom_trig;
|
2011-04-22 18:20:56 -05:00
|
|
|
#if (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11)
|
|
|
|
extern SDL_SysWMinfo sdl_wminfo;
|
|
|
|
extern Atom XA_CLIPBOARD, XA_TARGETS;
|
|
|
|
#endif
|
|
|
|
|
2010-08-27 07:01:20 -05:00
|
|
|
extern char *shift_0;
|
|
|
|
extern char *shift_1;
|
2011-05-16 06:46:08 -05:00
|
|
|
extern int svf_messages;
|
2010-08-27 07:01:20 -05:00
|
|
|
extern int svf_login;
|
|
|
|
extern int svf_admin;
|
|
|
|
extern int svf_mod;
|
|
|
|
extern char svf_user[64];
|
|
|
|
extern char svf_pass[64];
|
2011-01-30 15:46:50 -06:00
|
|
|
extern char svf_user_id[64];
|
|
|
|
extern char svf_session_id[64];
|
2010-08-27 07:01:20 -05:00
|
|
|
|
2011-06-25 10:59:25 -05:00
|
|
|
|
|
|
|
extern char svf_filename[255];
|
|
|
|
extern int svf_fileopen;
|
2010-08-27 07:01:20 -05:00
|
|
|
extern int svf_open;
|
|
|
|
extern int svf_own;
|
|
|
|
extern int svf_myvote;
|
|
|
|
extern int svf_publish;
|
|
|
|
extern char svf_id[16];
|
|
|
|
extern char svf_name[64];
|
|
|
|
extern char svf_tags[256];
|
2011-01-04 12:26:28 -06:00
|
|
|
extern char svf_description[255];
|
2010-08-27 07:01:20 -05:00
|
|
|
extern void *svf_last;
|
|
|
|
extern int svf_lsize;
|
|
|
|
|
2010-08-29 07:10:58 -05:00
|
|
|
extern char *search_ids[GRID_X*GRID_Y];
|
2010-09-11 19:17:52 -05:00
|
|
|
extern char *search_dates[GRID_X*GRID_Y];
|
2010-08-29 07:10:58 -05:00
|
|
|
extern int search_votes[GRID_X*GRID_Y];
|
|
|
|
extern int search_publish[GRID_X*GRID_Y];
|
|
|
|
extern int search_scoredown[GRID_X*GRID_Y];
|
|
|
|
extern int search_scoreup[GRID_X*GRID_Y];
|
|
|
|
extern char *search_names[GRID_X*GRID_Y];
|
|
|
|
extern char *search_owners[GRID_X*GRID_Y];
|
|
|
|
extern void *search_thumbs[GRID_X*GRID_Y];
|
|
|
|
extern int search_thsizes[GRID_X*GRID_Y];
|
|
|
|
|
|
|
|
extern int search_own;
|
2010-10-28 18:18:06 -05:00
|
|
|
extern int search_fav;
|
2010-08-29 07:10:58 -05:00
|
|
|
extern int search_date;
|
|
|
|
extern int search_page;
|
|
|
|
extern char search_expr[256];
|
|
|
|
|
|
|
|
extern char *tag_names[TAG_MAX];
|
|
|
|
extern int tag_votes[TAG_MAX];
|
|
|
|
|
|
|
|
extern int zoom_en;
|
|
|
|
extern int zoom_x, zoom_y;
|
|
|
|
extern int zoom_wx, zoom_wy;
|
|
|
|
|
2010-08-26 08:46:56 -05:00
|
|
|
void menu_count(void);
|
2010-08-27 07:01:20 -05:00
|
|
|
|
2011-10-21 13:41:12 -05:00
|
|
|
void quickoptions_menu(pixel *vid_buf, int b, int bq, int x, int y);
|
|
|
|
|
2011-09-30 07:57:32 -05:00
|
|
|
void prop_edit_ui(pixel *vid_buf, int x, int y);
|
|
|
|
|
2010-08-28 05:40:49 -05:00
|
|
|
void get_sign_pos(int i, int *x0, int *y0, int *w, int *h);
|
|
|
|
|
2010-08-27 07:01:20 -05:00
|
|
|
void add_sign_ui(pixel *vid_buf, int mx, int my);
|
|
|
|
|
|
|
|
void ui_edit_draw(pixel *vid_buf, ui_edit *ed);
|
|
|
|
|
|
|
|
void ui_edit_process(int mx, int my, int mb, ui_edit *ed);
|
|
|
|
|
|
|
|
void ui_checkbox_draw(pixel *vid_buf, ui_checkbox *ed);
|
|
|
|
|
|
|
|
void ui_checkbox_process(int mx, int my, int mb, int mbq, ui_checkbox *ed);
|
|
|
|
|
2011-04-04 14:02:11 -05:00
|
|
|
void ui_copytext_draw(pixel *vid_buf, ui_copytext *ed);
|
|
|
|
|
|
|
|
void ui_copytext_process(int mx, int my, int mb, int mbq, ui_copytext *ed);
|
|
|
|
|
2011-05-29 11:00:31 -05:00
|
|
|
void ui_richtext_draw(pixel *vid_buf, ui_richtext *ed);
|
|
|
|
|
|
|
|
void ui_richtext_settext(char *text, ui_richtext *ed);
|
|
|
|
|
|
|
|
void ui_richtext_process(int mx, int my, int mb, int mbq, ui_richtext *ed);
|
|
|
|
|
2011-06-14 09:13:27 -05:00
|
|
|
void draw_svf_ui(pixel *vid_buf, int alternate);
|
2010-08-27 07:01:20 -05:00
|
|
|
|
|
|
|
void error_ui(pixel *vid_buf, int err, char *txt);
|
|
|
|
|
|
|
|
void info_ui(pixel *vid_buf, char *top, char *txt);
|
|
|
|
|
2011-04-01 16:26:29 -05:00
|
|
|
void copytext_ui(pixel *vid_buf, char *top, char *txt, char *copytxt);
|
|
|
|
|
2010-08-27 07:01:20 -05:00
|
|
|
void info_box(pixel *vid_buf, char *msg);
|
|
|
|
|
2011-06-08 10:30:36 -05:00
|
|
|
char *input_ui(pixel *vid_buf, char *title, char *prompt, char *text, char *shadow);
|
|
|
|
|
2010-08-27 07:01:20 -05:00
|
|
|
int confirm_ui(pixel *vid_buf, char *top, char *msg, char *btn);
|
|
|
|
|
|
|
|
void login_ui(pixel *vid_buf);
|
|
|
|
|
2010-08-28 05:40:49 -05:00
|
|
|
int stamp_ui(pixel *vid_buf);
|
|
|
|
|
|
|
|
void tag_list_ui(pixel *vid_buf);
|
|
|
|
|
|
|
|
int save_name_ui(pixel *vid_buf);
|
|
|
|
|
2011-06-13 17:24:20 -05:00
|
|
|
int save_filename_ui(pixel *vid_buf);
|
|
|
|
|
2010-08-28 05:40:49 -05:00
|
|
|
void menu_ui(pixel *vid_buf, int i, int *sl, int *sr);
|
|
|
|
|
2011-04-17 14:34:54 -05:00
|
|
|
void menu_ui_v3(pixel *vid_buf, int i, int *sl, int *sr, int *dae, int b, int bq, int mx, int my);
|
2010-08-28 05:40:49 -05:00
|
|
|
|
2011-09-21 06:38:47 -05:00
|
|
|
int color_menu_ui(pixel *vid_buf, int i, int *cr, int *cg, int *cb, int b, int bq, int mx, int my, int * tool);
|
2011-05-10 14:32:00 -05:00
|
|
|
|
2010-08-27 07:01:20 -05:00
|
|
|
int sdl_poll(void);
|
2010-08-28 05:40:49 -05:00
|
|
|
|
|
|
|
void set_cmode(int cm);
|
2010-08-29 07:10:58 -05:00
|
|
|
|
|
|
|
char *download_ui(pixel *vid_buf, char *uri, int *len);
|
|
|
|
|
|
|
|
int search_ui(pixel *vid_buf);
|
2010-08-29 07:17:25 -05:00
|
|
|
|
2010-10-28 18:18:06 -05:00
|
|
|
int open_ui(pixel *vid_buf, char *save_id, char *save_date);
|
|
|
|
|
2011-06-12 16:56:38 -05:00
|
|
|
void catalogue_ui(pixel * vid_buf);
|
|
|
|
|
2010-10-28 18:18:06 -05:00
|
|
|
int info_parse(char *info_data, save_info *info);
|
|
|
|
|
2010-09-01 05:40:29 -05:00
|
|
|
int search_results(char *str, int votes);
|
|
|
|
|
|
|
|
int execute_tagop(pixel *vid_buf, char *op, char *tag);
|
|
|
|
|
|
|
|
void execute_save(pixel *vid_buf);
|
|
|
|
|
2010-10-28 18:18:06 -05:00
|
|
|
int execute_delete(pixel *vid_buf, char *id);
|
|
|
|
|
2010-11-10 18:42:42 -06:00
|
|
|
int execute_report(pixel *vid_buf, char *id, char *reason);
|
2010-10-28 18:18:06 -05:00
|
|
|
|
|
|
|
void execute_submit(pixel *vid_buf, char *id, char *message);
|
|
|
|
|
|
|
|
void execute_fav(pixel *vid_buf, char *id);
|
2010-09-01 05:40:29 -05:00
|
|
|
|
2011-06-03 12:54:25 -05:00
|
|
|
void execute_unfav(pixel *vid_buf, char *id);
|
|
|
|
|
2010-09-01 05:40:29 -05:00
|
|
|
int execute_vote(pixel *vid_buf, char *id, char *action);
|
|
|
|
|
2010-10-28 18:18:06 -05:00
|
|
|
void open_link(char *uri);
|
|
|
|
|
2010-11-10 18:42:42 -06:00
|
|
|
int report_ui(pixel *vid_buf, char *save_id);
|
|
|
|
|
2011-03-10 14:43:27 -06:00
|
|
|
char *console_ui(pixel *vid_buf, char error[255],char console_more);
|
2011-01-30 23:12:47 -06:00
|
|
|
|
2011-04-25 10:39:28 -05:00
|
|
|
void simulation_ui(pixel *vid_buf);
|
|
|
|
|
2011-05-28 15:24:07 -05:00
|
|
|
unsigned int decorations_ui(pixel *vid_buf, int *bsx, int *bsy, unsigned int savedColor);
|
2010-08-29 05:41:45 -05:00
|
|
|
#endif
|
2010-08-29 07:17:25 -05:00
|
|
|
|