void display_gui_bootup_line (const char* string, uint16_t wait) { display_print (string); display_flip(); display_gui_sleep (wait); }
void display_gui_bootup_update_callback (uint16_t percentage) { const uint8_t *almond_logo_frames[] = { almond_logo_f1, almond_logo_f2, almond_logo_f3, almond_logo_f4, NULL}; display_clear(); bootup_current_frame = display_draw_animation_frame (39, 0, almond_logo_frames, bootup_current_frame); display_gui_bootup_progress (percentage); display_flip(); }
void display_gui_bootup_screen (void) { bootup_current_frame = 0; display_gui_button_bar_visible = false; display_clear(); const uint8_t *almond_logo_frames[] = { almond_logo_f1, almond_logo_f2, almond_logo_f3, almond_logo_f4, NULL}; bootup_current_frame = display_draw_animation_frame (39, 0, almond_logo_frames, bootup_current_frame); display_gui_bootup_progress (0); display_flip(); }
DISPLAY *display_open(void) { const char *device; DISPLAY *disp; disp = calloc(1, sizeof(*disp)); if (!disp) return NULL; disp->veu = shveu_open_named("VEU"); if (!disp->veu) { free(disp); return NULL; } /* Initialize display */ device = getenv("FRAMEBUFFER"); if (!device) { if (access("/dev/.devfsd", F_OK) == 0) { device = "/dev/fb/0"; } else { device = "/dev/fb0"; } } if ((disp->fb_handle = open(device, O_RDWR)) < 0) { fprintf(stderr, "Open %s: %s.\n", device, strerror(errno)); free(disp); return 0; } if (ioctl(disp->fb_handle, FBIOGET_FSCREENINFO, &disp->fb_fix) < 0) { fprintf(stderr, "Ioctl FBIOGET_FSCREENINFO error.\n"); free(disp); return 0; } if (ioctl(disp->fb_handle, FBIOGET_VSCREENINFO, &disp->fb_var) < 0) { fprintf(stderr, "Ioctl FBIOGET_VSCREENINFO error.\n"); free(disp); return 0; } if (disp->fb_fix.type != FB_TYPE_PACKED_PIXELS) { fprintf(stderr, "Frame buffer isn't packed pixel.\n"); free(disp); return 0; } /* clear framebuffer and back buffer */ disp->fb_size = (RGB_BPP * disp->fb_var.xres * disp->fb_var.yres * disp->fb_var.bits_per_pixel) / 8; disp->iomem = mmap(0, disp->fb_size, PROT_READ | PROT_WRITE, MAP_SHARED, disp->fb_handle, 0); if (disp->iomem != MAP_FAILED) { memset(disp->iomem, 0, disp->fb_size); } /* Register the framebuffer with UIOMux */ uiomux_register (disp->iomem, disp->fb_fix.smem_start, disp->fb_size); disp->lcd_w = disp->fb_var.xres; disp->lcd_h = disp->fb_var.yres; disp->back_buf = disp->iomem; disp->fb_index = 0; display_flip(disp); display_set_fullscreen(disp); return disp; }
int display_update( DISPLAY *disp, struct ren_vid_surface *src) { float scale, aspect_x, aspect_y; int ret; struct ren_vid_surface src2 = *src; struct ren_vid_surface dst; struct ren_vid_rect src_sel; struct ren_vid_rect dst_sel; dst.format = REN_RGB565; dst.w = disp->lcd_w; dst.h = disp->lcd_h; dst.pitch = disp->lcd_w; dst.py = disp->back_buf; dst.pc = dst.py + (disp->lcd_w * disp->lcd_h); dst.pa = NULL; if (disp->fullscreen) { /* Stick with the source aspect ratio */ aspect_x = (float) disp->lcd_w / src->w; aspect_y = (float) disp->lcd_h / src->h; if (aspect_x > aspect_y) { scale = aspect_y; } else { scale = aspect_x; } /* Center it */ dst_sel.w = (int) (src->w * scale); dst_sel.h = (int) (src->h * scale); dst_sel.x = (disp->lcd_w - dst.w)/2; dst_sel.y = (disp->lcd_h - dst.h)/2; get_sel_surface(&dst, &dst, &dst_sel); } else { dst_sel = disp->dst_sel; src_sel.w = src->w; src_sel.h = src->h; src_sel.x = 0; src_sel.y = 0; /* TODO Handle output off-surface to the left or above by using part of the input */ scale = 1.0; /* Handle output off-surface to the right or below by cropping the input & output */ if ((dst_sel.x + dst_sel.w) > disp->lcd_w) { src_sel.w = (int)((disp->lcd_w - dst_sel.x) / scale); dst_sel.w = disp->lcd_w - dst_sel.x; } if ((dst_sel.y + dst_sel.h) > disp->lcd_h) { src_sel.h = (int)((disp->lcd_h - dst_sel.y) / scale); dst_sel.h = disp->lcd_h - dst_sel.y; } if (src_sel.w <= 0 || src_sel.h <= 0) return 0; if (dst_sel.w <= 0 || dst_sel.h <= 0) return 0; get_sel_surface(&src2, src, &src_sel); get_sel_surface(&dst, &dst, &dst_sel); } /* Hardware resize */ ret = shveu_resize(disp->veu, &src2, &dst); if (!ret) display_flip(disp); return ret; }
int main(int argc, char** argv) { int ref = EXIT_SUCCESS; srand(OSTimeGet()); control_init(); appTimer = timer_create(); fgl_texture* tempDispTex = fgl_texture_create(320, 240); display* appDisplay = display_create(320, 240, 320, (DISPLAY_FILTER_NEAREST | DISPLAY_FORMAT_RGB565), tempDispTex->data, NULL); if(appDisplay == NULL) return EXIT_FAILURE; fgl_draw_buffer_set(tempDispTex); fgl_texture* tempRenderTarget = fgl_draw_buffer_get(); uint16_t* tempDepth = (uint16_t*)malloc(tempRenderTarget->width * tempRenderTarget->height * 2); if(tempDepth != NULL) fgl_depth_buffer_set(tempDepth); fgl_enable(FGL_DEPTH_TEST); fgl_matrix_mode_set(FGL_MATRIX_VIEWPORT); fgl_matrix_identity(); fgl_viewport(0, 0, fgl_fix16_from_int(320), fgl_fix16_from_int(240)); fgl_matrix_mode_set(FGL_MATRIX_PROJECTION); fgl_matrix_identity(); fgl_perspective((fgl_fix16_pi >> 3), fgl_fix16_div(fgl_fix16_from_int(320), fgl_fix16_from_int(240)), fgl_fix16_one, fgl_fix16_from_int(1024)); fgl_matrix_mode_set(FGL_MATRIX_VIEW); fgl_matrix_identity(); fgl_translate(fgl_fix16_from_int(0), fgl_fix16_from_int(0), fgl_fix16_from_int(10)); fgl_matrix_mode_set(FGL_MATRIX_MODEL); fgl_matrix_identity(); fgl_scale(fgl_fix16_from_int(2), fgl_fix16_from_int(2), fgl_fix16_from_int(2)); fgl_texture* tempTexture = fgl_texture_load_tga("earth.tga"); fgl_texture_bind(tempTexture); fgl_enable(FGL_TEXTURE_2D); //fgl_enable(FGL_CULL_FACE); int sysref; while(appRunning) { sysref = _sys_judge_event(NULL); if(sysref < 0) { ref = sysref; break; } // Control control_poll(); if(control_check(CONTROL_BUTTON_START).pressed && control_check(CONTROL_BUTTON_SELECT).pressed) appRunning = false; else if(control_check(CONTROL_BUTTON_SELECT).pressed && control_check(CONTROL_BUTTON_SELECT).changed) appScreenshot(); if(control_just_pressed(CONTROL_DPAD_UP)) { fgl_matrix_mode_set(FGL_MATRIX_VIEW); fgl_translate(fgl_fix16_from_int(0), fgl_fix16_from_int(0), fgl_fix16_from_int(-1)); fgl_matrix_mode_set(FGL_MATRIX_MODEL); } if(control_just_pressed(CONTROL_DPAD_DOWN)) { fgl_matrix_mode_set(FGL_MATRIX_VIEW); fgl_translate(fgl_fix16_from_int(0), fgl_fix16_from_int(0), fgl_fix16_from_int(+1)); fgl_matrix_mode_set(FGL_MATRIX_MODEL); } // Draw fgl_clear(FGL_COLOR_BUFFER_BIT | FGL_DEPTH_BUFFER_BIT); fgl_draw_sphere(16); fgl_rotate_y(500); display_flip(appDisplay); } fgl_texture_delete(tempTexture); if(tempDepth != NULL) free(tempDepth); timer_delete(appTimer); control_term(); display_delete(appDisplay); return EXIT_SUCCESS; }