10 static const char *get_ctime(void);
11 static void print_message(const char *type
, const char *message
,
12 const char *file
, int line
);
16 int STDCALL
WinMain(HINSTANCE hInst
, HINSTANCE hPrev
, LPSTR lpCmd
, int nShow
) {
18 int main(int argc
, char *argv
[]) {
25 default_smode(&smode
);
26 screen
= init_sdl(&smode
);
29 reload_fonts(&font
, &smode
);
31 load_theme(&theme
, "alienglow");
32 resize_theme(&theme
, &smode
);
34 main_loop(screen
, &smode
, &font
, &theme
);
35 /* screen may be invalid at this point if the window was resized.
36 To reflect changes here, pass &screen as an SDL_Surface **. */
44 char *duplicate_string(const char *str
, size_t len
) {
45 char *p
= malloc(len
+ 1);
50 static const char *get_ctime(void) {
56 static void print_message(const char *type
, const char *message
,
57 const char *file
, int line
) {
59 const char *sdlerror
= SDL_GetError(), *t
= get_ctime();
60 FILE *log
= fopen(LOG_FILE
, "at");
62 fprintf(stderr
, "xuni (%s:%i): %s at %s %s\n SDL: %s\n",
63 file
, line
, type
, t
, message
, sdlerror
);
65 fprintf(log
, "xuni (%s:%i): %s at %s %s\n SDL: %s\n",
66 file
, line
, type
, t
, message
, sdlerror
);
71 void print_warning(const char *message
, const char *file
, int line
) {
72 print_message("Warning", message
, file
, line
);
75 void fatal_error(const char *message
, const char *file
, int line
) {
76 print_message("Fatal error", message
, file
, line
);