77 ); |
77 ); |
78 |
78 |
79 // initialize SDL |
79 // initialize SDL |
80 const int supported_img_flags = IMG_INIT_PNG | IMG_INIT_JPG; |
80 const int supported_img_flags = IMG_INIT_PNG | IMG_INIT_JPG; |
81 if (SDL_Init(SDL_INIT_VIDEO) < 0) { |
81 if (SDL_Init(SDL_INIT_VIDEO) < 0) { |
82 asc_error(SDL_GetError()); |
82 asc_error("Failed to initialize SDL: %s", SDL_GetError()); |
83 } else if (TTF_Init() < 0) { |
83 } else if (TTF_Init() < 0) { |
84 asc_error(TTF_GetError()); |
84 asc_error("Failed to initialize SDL_ttf: %s", TTF_GetError()); |
85 } else if (IMG_Init(supported_img_flags) != supported_img_flags) { |
85 } else if (IMG_Init(supported_img_flags) != supported_img_flags) { |
86 asc_error(IMG_GetError()); |
86 asc_error("Failed to initialize SDL_img: %s", IMG_GetError()); |
87 } |
87 } |
88 SDL_ClearError(); |
88 SDL_ClearError(); |
89 asc_context.total_nanos = asc_nanos(); |
89 asc_context.total_nanos = asc_nanos(); |
90 asc_set_flag(asc_context.flags, ASC_FLAG_INITILIZED); |
90 asc_set_flag(asc_context.flags, ASC_FLAG_INITILIZED); |
91 asc_dprintf("Ascension context initialized."); |
91 asc_dprintf("Ascension context initialized."); |