int main(int argc, char *argv[]) { int i; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); if (!state) { return 1; } for (i = 1; i < argc;) { int consumed; consumed = SDLTest_CommonArg(state, i); if (consumed == 0) { consumed = -1; } if (consumed < 0) { SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); quit(1); } i += consumed; } if (!SDLTest_CommonInit(state)) { quit(2); } for (i = 0; i < state->num_windows; ++i) { SDL_Renderer *renderer = state->renderers[i]; SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); SDL_RenderClear(renderer); } cursor = init_system_cursor(arrow); SDL_SetCursor(cursor); /* Main render loop */ done = 0; #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else while (!done) { loop(); } #endif SDL_FreeCursor(cursor); quit(0); /* keep the compiler happy ... */ return(0); }
void gfx_cursor_init(void) { #if defined (__WIN32__) gui_cursor_init(); gui_cursor_set(); #else memset(&cursor, 0x00, sizeof(cursor)); cursor.org = SDL_GetCursor(); if ((cursor.target = init_system_cursor(target_32x32_xpm)) == NULL) { //if ((cursor = init_system_cursor(target_48x48_xpm)) == NULL) { cursor.target = cursor.org; printf("SDL_Init failed: %s\n", SDL_GetError()); } gfx_cursor_set(); #endif }
int main(int argc, char *argv[]) { int i; const char *color_cursor = NULL; /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); /* Initialize test framework */ state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); if (!state) { return 1; } for (i = 1; i < argc;) { int consumed; consumed = SDLTest_CommonArg(state, i); if (consumed == 0) { color_cursor = argv[i]; break; } if (consumed < 0) { SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); quit(1); } i += consumed; } if (!SDLTest_CommonInit(state)) { quit(2); } for (i = 0; i < state->num_windows; ++i) { SDL_Renderer *renderer = state->renderers[i]; SDL_SetRenderDrawColor(renderer, 0xA0, 0xA0, 0xA0, 0xFF); SDL_RenderClear(renderer); } if (color_cursor) { cursors[0] = init_color_cursor(color_cursor); } else { cursors[0] = init_system_cursor(arrow); } if (!cursors[0]) { SDL_Log("Error, couldn't create cursor\n"); quit(2); } for (i = 0; i < SDL_NUM_SYSTEM_CURSORS; ++i) { cursors[1+i] = SDL_CreateSystemCursor((SDL_SystemCursor)i); if (!cursors[1+i]) { SDL_Log("Error, couldn't create system cursor %d\n", i); quit(2); } } SDL_SetCursor(cursors[0]); /* Main render loop */ done = 0; #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else while (!done) { loop(); } #endif for (i = 0; i < SDL_arraysize(cursors); ++i) { SDL_FreeCursor(cursors[i]); } quit(0); /* keep the compiler happy ... */ return(0); }