static ALLEGRO_DISPLAY *iphone_create_display(int w, int h) { ALLEGRO_DISPLAY_IPHONE *d = al_calloc(1, sizeof *d); ALLEGRO_DISPLAY *display = (void*)d; ALLEGRO_OGL_EXTRAS *ogl = al_calloc(1, sizeof *ogl); display->ogl_extras = ogl; display->vt = _al_get_iphone_display_interface(); display->flags = al_get_new_display_flags(); if (display->flags & ALLEGRO_FULLSCREEN_WINDOW) { _al_iphone_get_screen_size(&w, &h); } display->w = w; display->h = h; ALLEGRO_SYSTEM_IPHONE *system = (void *)al_get_system_driver(); /* Add ourself to the list of displays. */ ALLEGRO_DISPLAY_IPHONE **add; add = _al_vector_alloc_back(&system->system.displays); *add = d; /* Each display is an event source. */ _al_event_source_init(&display->es); _al_iphone_update_visuals(); ALLEGRO_EXTRA_DISPLAY_SETTINGS *eds[system->visuals_count]; memcpy(eds, system->visuals, sizeof(*eds) * system->visuals_count); qsort(eds, system->visuals_count, sizeof(*eds), _al_display_settings_sorter); ALLEGRO_INFO("Chose visual no. %i\n", eds[0]->index); memcpy(&display->extra_settings, eds[0], sizeof(ALLEGRO_EXTRA_DISPLAY_SETTINGS)); /* This will add an OpenGL view with an OpenGL context, then return. */ _al_iphone_add_view(display); _al_iphone_make_view_current(); _al_ogl_manage_extensions(display); _al_ogl_set_extensions(ogl->extension_api); setup_gl(display); display->flags |= ALLEGRO_OPENGL; return display; }
static ALLEGRO_DISPLAY_INTERFACE *iphone_get_display_driver(void) { return _al_get_iphone_display_interface(); }