main.c (1275B)
1 /** 2 * Loosely based on the libwebp example program "anim_dump" 3 */ 4 5 #define _DEFAULT_SOURCE 6 7 // moved into the compiler command line arguments 8 // #define UI_LINUX 9 10 #define UI_IMPLEMENTATION 11 12 #include <stdio.h> 13 #include <sys/prctl.h> 14 #include "webp/decode.h" 15 #include "webp/encode.h" 16 #include "webp/demux.h" 17 #include "animation.h" 18 #include "ui.h" 19 20 #ifdef __OpenBSD__ 21 #include <sys/syslimits.h> 22 #endif 23 24 #ifdef __linux__ 25 #include <linux/limits.h> 26 #endif 27 28 #define WIN_WIDTH 750 29 #define WIN_HEIGHT 400 30 31 static void print_webp_version() { 32 int dec_ver = WebPGetDecoderVersion(); 33 int demux_ver = WebPGetDemuxVersion(); 34 printf("---------------------------\n"); 35 printf("webp decoder version: %d.%d.%d\n", (dec_ver>>16)&0xff, (dec_ver>>8)&0xff, dec_ver&0xff); 36 printf("webp demuxer version: %d.%d.%d\n", (demux_ver>>16)&0xff, (demux_ver>>8)&0xff, demux_ver&0xff); 37 } 38 39 #ifdef UI_LINUX 40 int main(int argc, const char **argv) { 41 #else 42 int WinMain(HINSTANCE instance, HINSTANCE previousInstance, LPSTR commandLine, int showCommand) { 43 #endif 44 45 // just some silly stuff, always wanted to try that 46 prctl(PR_SET_NAME, "webp-anim-to-spritesheet"); 47 48 atexit(print_webp_version); 49 UIInitialise(); 50 UIWindow *win = MainWindowCreate("emote2ss", WIN_WIDTH, WIN_HEIGHT); 51 return UIMessageLoop(); 52 }