main.c (1378B)
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 #ifndef __NetBSD__ 14 #include <sys/prctl.h> 15 #endif 16 #include "webp/decode.h" 17 #include "webp/encode.h" 18 #include "webp/demux.h" 19 #include "animation.h" 20 #include "ui.h" 21 22 #ifdef __OpenBSD__ 23 #include <sys/syslimits.h> 24 #endif 25 26 #ifdef __NetBSD__ 27 #include <sys/syslimits.h> 28 #endif 29 30 #ifdef __linux__ 31 #include <linux/limits.h> 32 #endif 33 34 #define WIN_WIDTH 750 35 #define WIN_HEIGHT 400 36 37 static void print_webp_version() { 38 int dec_ver = WebPGetDecoderVersion(); 39 int demux_ver = WebPGetDemuxVersion(); 40 printf("---------------------------\n"); 41 printf("webp decoder version: %d.%d.%d\n", (dec_ver>>16)&0xff, (dec_ver>>8)&0xff, dec_ver&0xff); 42 printf("webp demuxer version: %d.%d.%d\n", (demux_ver>>16)&0xff, (demux_ver>>8)&0xff, demux_ver&0xff); 43 } 44 45 #ifdef UI_LINUX 46 int main(int argc, const char **argv) { 47 #else 48 int WinMain(HINSTANCE instance, HINSTANCE previousInstance, LPSTR commandLine, int showCommand) { 49 #endif 50 // just some silly stuff, always wanted to try that 51 #ifndef __NetBSD__ 52 prctl(PR_SET_NAME, "webp-anim-to-spritesheet"); 53 #endif 54 atexit(print_webp_version); 55 UIInitialise(); 56 UIWindow *win = MainWindowCreate("emote2ss", WIN_WIDTH, WIN_HEIGHT); 57 return UIMessageLoop(); 58 }