20 #include <emscripten/emscripten.h> 30 #define MOOSEFRAME_SIZE (MOOSEPIC_W * MOOSEPIC_H) 31 #define MOOSEFRAMES_COUNT 10 163 SDL_Log(
"Usage: %s [arg] [arg] [arg] ...\n", argv0);
165 SDL_Log(
"Where 'arg' is any of the following options:\n");
167 SDL_Log(
" -fps <frames per second>\n");
169 SDL_Log(
" -format <fmt> (one of the: YV12, IYUV, YUY2, UYVY, YVYU)\n");
170 SDL_Log(
" -scale <scale factor> (initial scale of the overlay)\n");
171 SDL_Log(
" -help (shows this help)\n");
173 SDL_Log(
"Press ESC to exit, or SPACE to freeze the movie while application running.\n");
183 switch (event.
type) {
187 displayrect.
w =
window_w =
event.window.data1;
188 displayrect.
h =
window_h =
event.window.data2;
192 displayrect.
x =
event.button.x -
window_w / 2;
193 displayrect.
y =
event.button.y -
window_h / 2;
197 displayrect.
x =
event.motion.x -
window_w / 2;
198 displayrect.
y =
event.motion.y -
window_h / 2;
215 #ifndef __EMSCRIPTEN__ 228 #ifdef __EMSCRIPTEN__ 230 emscripten_cancel_main_loop();
255 if (strcmp(argv[1],
"-fps") == 0) {
260 "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
263 if ((fps < 0) || (fps > 1000)) {
265 "The -fps option must be in range from 1 to 1000, default is 12.\n");
272 "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
275 }
else if (strcmp(argv[1],
"-nodelay") == 0) {
279 }
else if (strcmp(argv[1],
"-scale") == 0) {
284 "The -scale option requires an argument [from 1 to 50], default is 5.\n");
287 if ((scale < 0) || (scale > 50)) {
289 "The -scale option must be in range from 1 to 50, default is 5.\n");
296 "The -fps option requires an argument [from 1 to 1000], default is 12.\n");
299 }
else if ((strcmp(argv[1],
"-help") == 0)
300 || (strcmp(argv[1],
"-h") == 0)) {
311 if (RawMooseData ==
NULL) {
318 if (handle ==
NULL) {
366 rgb[0] = MooseColors[frame[
j]].
r;
367 rgb[1] = MooseColors[frame[
j]].
g;
368 rgb[2] = MooseColors[frame[
j]].
b;
395 #ifdef __EMSCRIPTEN__ 396 emscripten_set_main_loop(
loop, nodelay ? 0 : fps, 1);
#define SDL_CreateTexture
GLenum GLenum GLenum GLenum GLenum scale
#define SDL_RenderSetViewport
SDL_MouseMotionEvent motion
SDL_Texture * MooseTexture
#define SDL_RWread(ctx, ptr, size, n)
#define SDL_WINDOWPOS_UNDEFINED
#define SDL_UpdateTexture
Uint8 MooseFrame[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE *2]
#define MOOSEFRAMES_COUNT
EGLImageKHR EGLint EGLint * handle
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int in j)
#define SDL_LogSetPriority
The type used to identify a window.
SDL_Color MooseColors[84]
#define SDL_DestroyRenderer
int main(int argc, char **argv)
#define SDL_GetYUVConversionModeForResolution
static void PrintUsage(char *argv0)
#define SDL_CreateRenderer
A rectangle, with the origin at the upper left.
#define SDL_RenderPresent
SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance)