void draw_creature_editor(editor_data_t * data, stage_draw_info_t * info) { char * str = NULL; draw_editor_creature_model(info, data->creature, info->screen_width / 2, info->screen_height / 2, 0, data->selected, 0); glLoadIdentity(); glTranslatef(info->screen_width / 2, 64, 0); switch(data->current_type) { case ADDITION_MOUTH: str = "Mouth"; break; case ADDITION_EYE: draw_eye(4); str = "Eye"; break; case ADDITION_SPIKE: draw_spike(4, 1); str = "Spike"; break; default: str = "?"; break; } font_write(info->font, info->screen_width / 2, 64, 16, 16, str); }
void draw_active_tab(tab_t tab) { video_no_clipping(&vid); video_set_colour(&vid, 55, 65, 75); /* JDH - same colour as highlight in list area */ video_filled_rectangle(&vid, tab.x1, tab.y1, tab.x2, tab.y2); video_set_colour(&vid, 230, 230, 230); video_rectangle(&vid, tab.x1, tab.y1, tab.x2, tab.y2); video_setpen(&vid, tab.x1 + 5, tab.y1 + 40); font_write(&font, &vid, tab.title); }
void draw_inactive_tab(tab_t tab) { video_no_clipping(&vid); video_set_colour(&vid, 20, 20, 40); /* JDH - same colour as background of list area */ video_filled_rectangle(&vid, tab.x1, tab.y1, tab.x2, tab.y2); video_set_colour(&vid, 230, 230, 230); video_rectangle(&vid, tab.x1, tab.y1, tab.x2, tab.y2); video_setpen(&vid, tab.x1 + 5, tab.y1 + 40); font_write(&font, &vid, tab.title); }
int main( int argc, char ** argv ) { ledscape_t * const leds = ledscape_init(width, height); printf("init done\n"); time_t last_time = time(NULL); unsigned last_i = 0; unsigned i = 0; uint32_t * const p = calloc(width*height,4); int scroll_x = 128; memset(p, 0x10, width*height*4); for (int x = 0 ; x < 128 ; x += 32) { for (int y = 0 ; y < 128 ; y += 16) { char buf[32]; snprintf(buf, sizeof(buf), "%d,%d", x, y); font_write(p, 0xFF0000, x, y, buf); } } while (1) { ledscape_draw(leds, p); usleep(20000); // wait for the previous frame to finish; //const uint32_t response = ledscape_wait(leds); const uint32_t response = 0; time_t now = time(NULL); if (now != last_time) { printf("%d fps. starting %d previous %"PRIx32"\n", i - last_i, i, response); last_i = i; last_time = now; } } ledscape_close(leds); return EXIT_SUCCESS; }
void draw_map(struct map * map, enum GAME_MODE game_mode, trait_t active_traits, int topleft_x, int topleft_y, int width, int height) { gfx_gl_log("%s:%s: map", __FILE__, __FUNCTION__); if(globals.map_tilting == true) topleft_y += map->tilt; if(globals.opengl) { #ifdef WITH_OPENGL glScissor(topleft_x, SCREEN_HEIGHT - topleft_y - height * 24 - 1, width * 24, height * 24); gfxgl_state(GL_SCISSOR_TEST, true); #endif } #ifdef WITH_NONOPENGL else { SDL_Rect r; r.x = topleft_x; r.y = topleft_y; r.w = width * 24; r.h = height * 24; SDL_SetClipRect(gfx_game_screen(), &r); } #endif enum MOVE_DIRECTION amstate; if(game_mode == GAME_MODE_CLASSIC) amstate = MOVE_UP; else if(map->ameba_blocked == -1 || map->ameba_blocked == 0) amstate = MOVE_UP; else if(map->ameba_blocked_timer > map->frames_per_second * 3) amstate = MOVE_UP; else if(map->ameba_blocked_timer > map->frames_per_second * 1) amstate = MOVE_RIGHT; else amstate = MOVE_DOWN; if(globals.opengl) { #ifdef WITH_OPENGL draw_map_opengl(map, game_mode, topleft_x, topleft_y, width, height, amstate); #endif } #ifdef WITH_NONOPENGL else draw_map_non_opengl(map, topleft_x, topleft_y, width, height, amstate); #endif #ifdef WITH_OPENGL bool texturechanged; texturechanged = false; if(globals.opengl && (game_mode == GAME_MODE_ADVENTURE || game_mode == GAME_MODE_PYJAMA_PARTY)) if(map->girl->mob->alive && map->girl->mob->chat_bubble_timer > 0) { int x, y, w, h; w = font_width(map->girl->mob->chat_bubble); h = font_height(); x = topleft_x + map->map_fine_x + (map->girl->mob->x - map->map_x ) * 24 + 12 - w / 2; y = topleft_y + map->map_fine_y + (map->girl->mob->y - map->map_y - 1) * 24; x += map->move_offsets[2 * (map->girl->mob->x + map->girl->mob->y * map->width) + 0]; y += map->move_offsets[2 * (map->girl->mob->x + map->girl->mob->y * map->width) + 1]; SDL_Rect r; r.x = x - 4; r.y = y - 2; r.w = w + 4 * 2; r.h = h + 2 * 2; gfx_draw_rectangle(&r, 0x00, 0x00, 0x00, 0x80); font_write(x, y, map->girl->mob->chat_bubble); texturechanged = true; } #endif if(map->level_start_anim_on > 0 && map->is_intermission == true) { struct image * img; img = gfx_image(GFX_IMAGE_INTERMISSION); if(img != NULL) { int x, y; x = 20 + get_rand(SCREEN_WIDTH - img->width - 40); y = 20 + get_rand(SCREEN_WIDTH - img->height - 40); gfx2d_draw_image(x, y, img); } } if(globals.opengl) { #ifdef WITH_OPENGL gfxgl_state(GL_SCISSOR_TEST, false); #endif } #ifdef WITH_NONOPENGL else SDL_SetClipRect(gfx_game_screen(), NULL); #endif gfx_gl_log("%s:%s: map cursor", __FILE__, __FUNCTION__); draw_map_cursor(map, topleft_x, topleft_y, width, height); #ifdef WITH_OPENGL if(texturechanged == true) gfx_set_current_glyph_set(0); #endif gfx_gl_log("%s:%s: map borders", __FILE__, __FUNCTION__); draw_map_borders(map, game_mode, active_traits, topleft_x, topleft_y, width, height); if(game_mode == GAME_MODE_ADVENTURE || game_mode == GAME_MODE_PYJAMA_PARTY || globals.smooth_classic_mode == true) if(map->girl->mob->moved_over_glyph != MAP_SIZEOF_) { int8_t * p; p = &map->move_offsets[2 * (map->girl->mob->x + map->girl->mob->y * map->width)]; if(abs(p[0]) < 12 && abs(p[1]) < 12) map->girl->mob->moved_over_glyph = MAP_SIZEOF_; } }