bool_t fb_fill_rect(struct fb * fb, u32_t c, u32_t x, u32_t y, u32_t w, u32_t h) { struct rect_t rect; rect.x = x; rect.y = y; rect.w = w; rect.h = h; surface_set_clip_rect(&(fb->info->surface), NULL); return surface_fill(&(fb->info->surface), &rect, c, BLEND_MODE_REPLACE); }
int scoreboard_create(scene *scene) { // Init local data scoreboard_local *local = malloc(sizeof(scoreboard_local)); local->page = settings_get()->gameplay.rounds; // Load scores if(scores_read(&local->data) == 1) { scores_clear(&local->data); DEBUG("No score data found; using empty score array."); } // Check for pending score local->has_pending_data = 0; if(found_pending_score(scene)) { game_player *player = game_state_get_player(scene->gs, 0); unsigned int score = player->score.score; if(score_fits_scoreboard(local, score)) { local->has_pending_data = 1; local->pending_data.score = score; local->pending_data.har_id = player->har_id; local->pending_data.pilot_id = player->pilot_id; local->pending_data.name[0] = 0; } // Wipe old score data, whether it was written on scoreboard or not. chr_score_reset(game_player_get_score(player), 1); } // Create a surface that has an appropriate alpha for darkening the screen a bit surface_create(&local->black_surface, SURFACE_TYPE_RGBA, 32, 32); surface_fill(&local->black_surface, color_create(0,0,0,200)); // Set callbacks scene_set_userdata(scene, local); scene_set_event_cb(scene, scoreboard_event); scene_set_input_poll_cb(scene, scoreboard_input_tick); scene_set_render_overlay_cb(scene, scoreboard_render_overlay); scene_set_free_cb(scene, scoreboard_free); video_select_renderer(VIDEO_RENDERER_HW); // All done return 0; }
void kernel_main(uint32_t mb_addr, uint32_t mb_magic) { if(mb_magic != MULTIBOOT_BOOTLOADER_MAGIC) { kprintf(PANIC,"Wrong Bootloader Magic\n"); for(;;); } multiboot_info_t* mb_info = (multiboot_info_t*)mb_addr; vbe_info_t* vbe_info = (vbe_info_t *)(mb_info->vbe_mode_info); uint32_t top = mb_info->mem_upper; uint32_t bot = mb_info->mem_lower; uint32_t mem = top+bot; clear_console(); char version[20]; get_version(version); kp("Welcome to ZOS v%s",version); kp("System Information"); kp(" Booting Flag: 0x%x",mb_info->flags); if(check_flag(mb_info->flags,0)) kp(" Available Memory: %d KB / %d MB",mem,mem/1024); if(check_flag(mb_info->flags,1)) kp(" Booting Device: 0x%x",mb_info->boot_device); if(check_flag(mb_info->flags,2)) { if(strlen((char*)mb_info->cmdline)>1) kp(" Booting Command: %s",(char*)mb_info->cmdline); } if(check_flag(mb_info->flags,3)) {} if(check_flag(mb_info->flags,4)) {} if(check_flag(mb_info->flags,5)) kernel_elf = elf_from_multiboot(mb_info); if(check_flag(mb_info->flags,6)) { /* multiboot_memory_map_t *mmap; kp ("mmap_addr = 0x%x, mmap_length = 0x%x", (unsigned) mb_info->mmap_addr, (unsigned) mb_info->mmap_length); for (mmap = (multiboot_memory_map_t *) mb_info->mmap_addr; (unsigned long) mmap < mb_info->mmap_addr + mb_info->mmap_length; mmap = (multiboot_memory_map_t *) ((unsigned long) mmap + mmap->size + sizeof (mmap->size))) { kp (" size = 0x%x, base_addr = 0x%x%x," " length = 0x%x%x, type = 0x%x", (unsigned) mmap->size, mmap->addr >> 32, mmap->addr & 0xffffffff, mmap->len >> 32, mmap->len & 0xffffffff, (unsigned) mmap->type); } */ } gdt_init(); /* Global Descriptor Table */ idt_init(); /* Interrupt Descriptor Table */ isrs_init(); /* Interrupt Service Requests */ irq_init(); /* Hardware Interrupt Requests */ open_serial_output(); timer_init(); paging_init(mem); heap_init(); keyboard_init(); //pci_init(); kp("login: "******"Welcome to ZOS\n", "Hello!\n", "abcdefghijklmnopqrstuvwxyz1234567890\n", 0 }; for(int i=0;i!=3;i++) { for(int j = 0;j!=strlen(str[i]);j++) { gfx_print(str[i][j]); } } void render(window_t* win) { } void update(window_t* win) { surface_fill(win->surface,0,rgb(255,255,255)); key_event_t* head; int len; keyboard_event_get(&head,&len); for(int i=0;i!=len;i++) { key_event_t* eve = head+i; if(eve->type == KEY_DOWN) { gfx_print(eve->character); } } keyboard_event_clear(); rect_t trect = {0,0,720,20}; for(int i=0;i!=24;i++) { if(strlen(gfx_con_buf[i])) { surface_t* surf = font_render(gfx_con_buf[i],col); surface_blend(surf,0,win->surface,&trect); surface_free(surf); } trect.y += 20; } }