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