void render_highlights(scene *scene) { melee_local *local = scene_get_userdata(scene); game_player *player2 = game_state_get_player(scene->gs, 1); int trans; if (player2->selectable && local->row_a == local->row_b && local->column_a == local->column_b) { video_render_sprite_tint(&local->select_hilight, 11 + (62*local->column_a), 115 + (42*local->row_a), color_create(250-local->ticks, 0, 250-local->ticks, 0), 0); } else { if (player2->selectable) { if (local->done_b) { trans = 250; } else { trans = 250 - local->ticks; } video_render_sprite_tint(&local->select_hilight, 11 + (62*local->column_b), 115 + (42*local->row_b), color_create(0, 0, trans, 0), 0); } if (local->done_a) { trans = 250; } else { trans = 250 - local->ticks; } video_render_sprite_tint(&local->select_hilight, 11 + (62*local->column_a), 115 + (42*local->row_a), color_create(trans, 0, 0, 0), 0); } }
static void textinput_render(component *c) { textinput *tb = widget_get_obj(c); int chars = strlen(tb->buf); video_render_sprite(&tb->sur, c->x + (c->w - tb->sur.w)/2, c->y - 2, BLEND_ALPHA, 0); if(component_is_selected(c)) { if(chars > 0) { tb->tconf.cforeground = color_create(80, 220, 80, 255); tb->buf[chars] = '\x7F'; tb->buf[chars+1] = 0; text_render(&tb->tconf, c->x, c->y, c->w, c->h, tb->buf); tb->buf[chars] = 0; } } else if(component_is_disabled(c)) { if(chars > 0) { tb->tconf.cforeground = color_create(121, 121, 121, 255); text_render(&tb->tconf, c->x, c->y, c->w, c->h, tb->buf); } } else { if(chars > 0) { tb->tconf.cforeground = color_create(0, 121, 0, 255); text_render(&tb->tconf, c->x, c->y, c->w, c->h, tb->buf); } } if(chars == 0) { tb->tconf.cforeground = color_create(121, 121, 121, 255); text_render(&tb->tconf, c->x, c->y, c->w, c->h, tb->buf); } }
void textslider_render(component *c) { textslider *tb = c->obj; char buf[100]; int chars; int width; int xoff; sprintf(buf, "%s ", tb->text); chars = strlen(buf); for(int i = 0; i < tb->positions; i++) { if (i+1 > *tb->pos) { buf[chars+i] = '|'; } else { buf[chars+i] = 127; } } // null terminator buf[chars+tb->positions] = '\0'; chars = strlen(buf); width = chars*tb->font->w; xoff = (c->w - width)/2; if(c->selected) { int t = tb->ticks / 2; font_render(tb->font, buf, c->x + xoff, c->y, color_create(80 - t, 220 - t*2, 80 - t, 255)); } else if (c->disabled) { font_render(tb->font, buf, c->x + xoff, c->y, color_create(121, 121, 121, 255)); } else { font_render(tb->font, buf, c->x + xoff, c->y, color_create(0, 121, 0, 255)); } }
design_defaults_s *design_defaults_create(void) { design_defaults_s *d; d = (design_defaults_s *)malloc(sizeof(design_defaults_s)); memset(d, 0, sizeof(design_defaults_s)); d->units = units_type_mm; d->line_weight = 1.0; d->line_style = strdup("solid"); d->fill_style = strdup("NONE"); d->dimension_text_size = 4.0; d->dimension_precision = 2; d->angular_gap = 5.0; d->angular_extension = 25.0; d->linear_gap = 6.0; d->linear_extension_above = 12.0; d->linear_extension_below = 6.0; d->tolerance_text_size = 4.0; d->tolerance_plus = 0.0; d->tolerance_minus = 0.0; d->tolerance_precision = 2; d->background_color = color_create(); color_set_tag(d->background_color, "background-color"); color_white(d->background_color); d->element_color = color_create(); color_set_tag(d->element_color, "element-color"); color_black(d->element_color); // Return RETVAL return d; }
t_material *material_init(t_material *m, char *name) { if (m) { ft_strncpy(m->name, name, MATERIAL_NAME_LENGTH); m->specular = color_create(0.0f, 0.0f, 0.0f, 1.0f); m->diffuse = color_create(1.0f, 1.0f, 1.0f, 1.0f); m->ambient = color_create(0.0f, 0.0f, 0.0f, 1.0f); m->shininess = 1.0f; } return (m); }
void textbutton_render(component *c) { textbutton *tb = c->obj; int chars = strlen(tb->text); int width = chars*tb->font->w; int xoff = (c->w - width)/2; if(c->selected) { int t = tb->ticks / 2; font_render(tb->font, tb->text, c->x + xoff, c->y, color_create(80 - t, 220 - t*2, 80 - t, 255)); } else if (c->disabled) { font_render(tb->font, tb->text, c->x + xoff, c->y, color_create(121, 121, 121, 255)); } else { font_render(tb->font, tb->text, c->x + xoff, c->y, color_create(0, 121, 0, 255)); } }
component* menu_video_confirm_create(scene *s, settings_video *old_settings) { video_menu_confirm_data *local = malloc(sizeof(video_menu_confirm_data)); memset(local, 0, sizeof(video_menu_confirm_data)); local->video_accept_secs = 20; local->old_video_settings = old_settings; time(&local->video_accept_timer); // Text config text_settings tconf; text_defaults(&tconf); tconf.font = FONT_BIG; tconf.halign = TEXT_CENTER; tconf.cforeground = color_create(0, 121, 0, 255); component* menu = menu_create(11); menu_attach(menu, label_create(&tconf, "ACCEPT RESOLUTION?")); menu_attach(menu, filler_create()); local->timeout_label = label_create(&tconf, ""); menu_attach(menu, local->timeout_label); menu_attach(menu, filler_create()); menu_attach(menu, textbutton_create(&tconf, "OK", COM_ENABLED, video_confirm_ok_clicked, local)); menu_attach(menu, textbutton_create(&tconf, "CANCEL", COM_ENABLED, video_confirm_cancel_clicked, local)); menu_set_userdata(menu, local); menu_set_free_cb(menu, menu_video_confirm_free); menu_set_tick_cb(menu, menu_video_confirm_tick); menu_video_confirm_update(menu); return menu; }
void object_render_shadow(object *obj) { if(obj->cur_sprite == NULL || !obj->cast_shadow) { return; } // Scale of the sprite on Y axis should be less than the // height of the sprite because of light position float scale_y = 0.25f; // Determine X int flipmode = obj->sprite_state.flipmode; int x = obj->pos.x + obj->cur_sprite->pos.x + obj->sprite_state.o_correction.x; if(object_get_direction(obj) == OBJECT_FACE_LEFT) { x = (obj->pos.x + obj->sprite_state.o_correction.x) - obj->cur_sprite->pos.x - object_get_size(obj).x; flipmode ^= FLIP_HORIZONTAL; } // Determine Y float temp = object_h(obj) * scale_y; int y = 190 - temp - (object_h(obj) - temp) / 2; // Render shadow object twice with different offsets, so that // the shadows seem a bit blobbier and shadow-y for(int i = 0; i < 2; i++) { video_render_sprite_flip_scale_opacity_tint( obj->cur_sprite->data, x+i, y+i, BLEND_ALPHA, obj->pal_offset, flipmode, scale_y, 50, color_create(0,0,0,255)); } }
int main(void) { // Create IP connection IPConnection ipcon; ipcon_create(&ipcon); // Create device object Color c; color_create(&c, UID, &ipcon); // Connect to brickd if(ipcon_connect(&ipcon, HOST, PORT) < 0) { fprintf(stderr, "Could not connect\n"); return 1; } // Don't use device before ipcon is connected // Get threshold callbacks with a debounce time of 10 seconds (10000ms) color_set_debounce_period(&c, 10000); // Register color reached callback to function cb_color_reached color_register_callback(&c, COLOR_CALLBACK_COLOR_REACHED, (void *)cb_color_reached, NULL); // Configure threshold for color "greater than 100, 200, 300, 400" color_set_color_callback_threshold(&c, '>', 100, 0, 200, 0, 300, 0, 400, 0); printf("Press key to exit\n"); getchar(); color_destroy(&c); ipcon_destroy(&ipcon); // Calls ipcon_disconnect internally return 0; }
component* menu_connect_create(scene *s) { connect_menu_data *local = malloc(sizeof(connect_menu_data)); memset(local, 0, sizeof(connect_menu_data)); local->s = s; // Text config text_settings tconf; text_defaults(&tconf); tconf.font = FONT_BIG; tconf.halign = TEXT_CENTER; tconf.cforeground = color_create(0, 121, 0, 255); component* menu = menu_create(11); menu_attach(menu, label_create(&tconf, "CONNECT TO SERVER")); menu_attach(menu, filler_create()); local->addr_input = textinput_create(&tconf, "Host/IP", settings_get()->net.net_connect_ip); local->connect_button = textbutton_create(&tconf, "CONNECT", COM_ENABLED, menu_connect_start, s); local->cancel_button = textbutton_create(&tconf, "CANCEL", COM_ENABLED, menu_connect_cancel, s); widget_set_id(local->connect_button, NETWORK_CONNECT_IP_BUTTON_ID); menu_attach(menu, local->addr_input); menu_attach(menu, local->connect_button); menu_attach(menu, local->cancel_button); menu_set_userdata(menu, local); menu_set_free_cb(menu, menu_connect_free); menu_set_tick_cb(menu, menu_connect_tick); return menu; }
static void textbutton_render(component *c) { textbutton *tb = widget_get_obj(c); // Select color and render if(component_is_selected(c)) { int t = tb->ticks / 2; tb->tconf.cforeground = color_create(80 - t, 220 - t*2, 80 - t, 255); } else if (component_is_disabled(c)) { tb->tconf.cforeground = color_create(121, 121, 121, 255); } else { tb->tconf.cforeground = color_create(0, 121, 0, 255); } text_render(&tb->tconf, c->x, c->y, c->w, c->h, tb->text); // Border if(tb->border_enabled) { video_render_sprite(&tb->border, c->x-2, c->y-2, BLEND_ALPHA, 0); } }
component* menu_audio_create(scene *s) { // Menu userdata audio_menu_data *local = malloc(sizeof(audio_menu_data)); memset(local, 0, sizeof(audio_menu_data)); local->old_audio_settings = settings_get()->sound; // Text config text_settings tconf; text_defaults(&tconf); tconf.font = FONT_BIG; tconf.halign = TEXT_CENTER; tconf.cforeground = color_create(0, 121, 0, 255); // Create menu and its header component* menu = menu_create(11); menu_attach(menu, label_create(&tconf, "AUDIO")); menu_attach(menu, filler_create()); menu_attach(menu, textslider_create_bind(&tconf, "SOUND", 10, 1, menu_audio_sound_slide, NULL, &settings_get()->sound.sound_vol)); menu_attach(menu, textslider_create_bind(&tconf, "MUSIC", 10, 1, menu_audio_music_slide, NULL, &settings_get()->sound.music_vol)); menu_attach(menu, textselector_create_bind_opts(&tconf, "MONO", NULL, NULL, &settings_get()->sound.music_mono, mono_opts, 2)); local->lib_selector = textselector_create(&tconf, "PLAYBACK:", menu_audio_library_toggled, local); module_source *sources = music_get_module_sources(); for(int i = 0; sources[i].name != 0; i++) { textselector_add_option(local->lib_selector, sources[i].name); if(sources[i].id == settings_get()->sound.music_library) { textselector_set_pos(local->lib_selector, i); } } menu_attach(menu, local->lib_selector); local->freq_selector = textselector_create(&tconf, "FREQUENCY:", menu_audio_freq_toggled, local); menu_audio_reset_freqs(local, 1); menu_attach(menu, local->freq_selector); local->resampler_selector = textselector_create(&tconf, "RESAMPLE:", menu_audio_resampler_toggled, local); menu_audio_reset_resamplers(local, 1); menu_attach(menu, local->resampler_selector); menu_attach(menu, textbutton_create(&tconf, "DONE", COM_ENABLED, menu_audio_done, local)); // Userdata & free function for it menu_set_userdata(menu, local); menu_set_free_cb(menu, menu_audio_free); return menu; }
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 video_render_sprite_flip_scale_opacity( surface *sur, int sx, int sy, unsigned int rendering_mode, int pal_offset, unsigned int flip_mode, float y_percent, uint8_t opacity) { video_render_sprite_flip_scale_opacity_tint( sur, sx, sy, rendering_mode, pal_offset, flip_mode, y_percent, opacity, color_create(0xFF, 0xFF, 0xFF, 0xFF)); }
component* menu_listen_create(scene *s) { listen_menu_data *local = malloc(sizeof(listen_menu_data)); s->gs->role = ROLE_SERVER; local->s = s; // Form address (host) ENetAddress address; address.host = ENET_HOST_ANY; address.port = settings_get()->net.net_listen_port; // Set up host local->host = enet_host_create(&address, 1, 2, 0, 0); if(local->host == NULL) { DEBUG("Failed to initialize ENet server"); free(local); return NULL; } enet_socket_set_option(local->host->socket, ENET_SOCKOPT_REUSEADDR, 1); // Text config text_settings tconf; text_defaults(&tconf); tconf.font = FONT_BIG; tconf.halign = TEXT_CENTER; tconf.cforeground = color_create(0, 121, 0, 255); // Create the menu component* menu = menu_create(11); menu_attach(menu, label_create(&tconf, "START SERVER")); menu_attach(menu, filler_create()); menu_attach(menu, label_create(&tconf, "Waiting ...")); menu_attach(menu, filler_create()); local->cancel_button = textbutton_create(&tconf, "CANCEL", COM_ENABLED, menu_listen_cancel, s); menu_attach(menu, local->cancel_button); menu_set_userdata(menu, local); menu_set_free_cb(menu, menu_listen_free); menu_set_tick_cb(menu, menu_listen_tick); return menu; }
paper_s *paper_create(void) { paper_s *p; p = (paper_s *)malloc(sizeof(paper_s)); memset(p, 0, sizeof(paper_s)); p->margins = margins_create(); p->size = paper_size_type_iso_a4; p->orientation = paper_orientation_type_portrait; dimensions(p); margins_set_units(p->margins, p->units); p->color = color_create(); color_set_tag(p->color, "color"); color_white(p->color); // Return RETVAL return p; }
void video_render_sprite_size( surface *sur, int sx, int sy, int sw, int sh) { // Position SDL_Rect dst; dst.w = sw; dst.h = sh; dst.x = sx; dst.y = sy; // Render state.cb.render_fsot( &state, sur, &dst, SDL_BLENDMODE_BLEND, // blendmode 0, // Pal offset 0, // flip 0xFF, // opacity color_create(0xFF, 0xFF, 0xFF, 0xFF)); // tint }
component* menu_gameplay_create(scene *s) { const char* fightmode_opts[] = {"NORMAL","HYPER"}; const char* hazard_opts[] = {"OFF","ON"}; // Text config text_settings tconf; text_defaults(&tconf); tconf.font = FONT_BIG; tconf.halign = TEXT_CENTER; tconf.cforeground = color_create(0, 121, 0, 255); component* menu = menu_create(11); menu_attach(menu, label_create(&tconf, "GAMEPLAY")); menu_attach(menu, filler_create()); menu_attach(menu, textslider_create_bind(&tconf, "SPEED", 10, 1, menu_gameplay_speed_slide, s, &settings_get()->gameplay.speed)); menu_attach(menu, textselector_create_bind_opts(&tconf, "FIGHT MODE", NULL, NULL, &settings_get()->gameplay.fight_mode, fightmode_opts, 2)); menu_attach(menu, textslider_create_bind(&tconf, "POWER 1", 8, 0, NULL, NULL, &settings_get()->gameplay.power1)); menu_attach(menu, textslider_create_bind(&tconf, "POWER 2", 8, 0, NULL, NULL, &settings_get()->gameplay.power2)); menu_attach(menu, textselector_create_bind_opts(&tconf, "HAZARDS", NULL, NULL, &settings_get()->gameplay.hazards_on, hazard_opts, 2)); menu_attach(menu, textselector_create_bind_opts(&tconf, "CPU:", NULL, NULL, &settings_get()->gameplay.difficulty, ai_difficulty_names, NUMBER_OF_AI_DIFFICULTY_TYPES)); menu_attach(menu, textselector_create_bind_opts(&tconf, "", NULL, NULL, &settings_get()->gameplay.rounds, round_type_names, NUMBER_OF_ROUND_TYPES)); menu_attach(menu, textbutton_create(&tconf, "DONE", COM_ENABLED, menu_gameplay_done, NULL)); return menu; }
void object_render(object *obj) { // Stop here if cur_sprite is NULL if(obj->cur_sprite == NULL) return; // Set current surface obj->cur_surface = obj->cur_sprite->data; // Something to ease the pain ... player_sprite_state *rstate = &obj->sprite_state; // Position int y = obj->pos.y + obj->cur_sprite->pos.y + rstate->o_correction.y; int x = obj->pos.x + obj->cur_sprite->pos.x + rstate->o_correction.x; if(object_get_direction(obj) == OBJECT_FACE_LEFT) { x = obj->pos.x - obj->cur_sprite->pos.x + rstate->o_correction.x - object_get_size(obj).x; } // Flip to face the right direction int flipmode = rstate->flipmode; if(obj->direction == OBJECT_FACE_LEFT) { flipmode ^= FLIP_HORIZONTAL; } // Blend start / blend finish uint8_t opacity = rstate->blend_finish; if(rstate->duration > 0) { float moment = (float)rstate->timer / (float)rstate->duration; float d = ((float)rstate->blend_finish - (float)rstate->blend_start) * moment; opacity = rstate->blend_start + d; } // Default Tint color color tint = color_create(0xFF, 0xFF, 0xFF, 0xFF); // These two force set the sprite color, so handle them first if(obj->video_effects & EFFECT_SHADOW) { tint = color_create(0x20, 0x20, 0x20, 0xFF); } if(obj->video_effects & EFFECT_DARK_TINT) { tint = color_create(0x60, 0x60, 0x60, 0xFF); } if(obj->video_effects & EFFECT_STASIS) { opacity = 128; } // This changes the tint depending on position, so handle next if(obj->video_effects & EFFECT_POSITIONAL_LIGHTING) { float p = (x > 160) ? 320 - x : x; float shade = 0.65f + p / 320; if(shade > 1.0f) shade = 1.0f; tint.r *= shade; tint.g *= shade; tint.b *= shade; } // Render video_render_sprite_flip_scale_opacity_tint( obj->cur_surface, x, y, rstate->blendmode, obj->pal_offset, flipmode, obj->y_percent, opacity, tint); }
component* lab_dash_main_create(scene *s, dashboard_widgets *dw) { component *xy = xysizer_create(); text_settings tconf_dark; text_defaults(&tconf_dark); tconf_dark.font = FONT_SMALL; tconf_dark.cforeground = color_create(0, 200, 0, 255); text_settings tconf_light; text_defaults(&tconf_light); tconf_light.font = FONT_SMALL; tconf_light.cforeground = color_create(50, 240, 50, 255); // Pilot image dw->photo = pilotpic_create(PIC_PLAYERS, 1); xysizer_attach(xy, dw->photo, 12, -1, -1, -1); // Texts dw->name = label_create(&tconf_light, "NO NAME"); dw->rank = label_create(&tconf_dark, "RANK: 0"); dw->wins = label_create(&tconf_dark, "WINS: 0"); dw->losses = label_create(&tconf_dark, "LOSES: 0"); dw->money = label_create(&tconf_dark, "MONEY: $ 0K"); dw->tournament = label_create(&tconf_light, "NO TOURNAMENT"); xysizer_attach(xy, dw->name, 12, 58, 200, 6); xysizer_attach(xy, dw->rank, 18, 64, 200, 6); xysizer_attach(xy, dw->wins, 18, 70, 200, 6); xysizer_attach(xy, dw->losses, 12, 76, 200, 6); xysizer_attach(xy, dw->money, 12, 82, 200, 6); xysizer_attach(xy, dw->tournament, 12, 88, 200, 6); // Bars and texts (bottom left side) xysizer_attach(xy, label_create(&tconf_dark, "POWER"), 12, 95, -1, -1); dw->power = gauge_create(GAUGE_SMALL, 25, 3); xysizer_attach(xy, dw->power, 12, 102, -1, -1); xysizer_attach(xy, label_create(&tconf_dark, "AGILITY"), 12, 106, -1, -1); dw->agility = gauge_create(GAUGE_SMALL, 25, 3); xysizer_attach(xy, dw->agility, 12, 113, -1, -1); xysizer_attach(xy, label_create(&tconf_dark, "ENDURANCE"), 12, 117, -1, -1); dw->endurance = gauge_create(GAUGE_SMALL, 25, 3); xysizer_attach(xy, dw->endurance, 12, 124, -1, -1); // Bars and texts (bottom middle) xysizer_attach(xy, label_create(&tconf_dark, "ARM POWER"), 125, 95, 200, 6); dw->arm_power = gauge_create(GAUGE_BIG, 8, 3); xysizer_attach(xy, dw->arm_power, 125, 102, -1, -1); xysizer_attach(xy, label_create(&tconf_dark, "LEG POWER"), 125, 106, 200, 6); dw->leg_power = gauge_create(GAUGE_BIG, 8, 3); xysizer_attach(xy, dw->leg_power, 125, 113, -1, -1); xysizer_attach(xy, label_create(&tconf_dark, "ARMOR"), 125, 117, 200, 6); dw->armor = gauge_create(GAUGE_BIG, 8, 3); xysizer_attach(xy, dw->armor, 125, 124, -1, -1); // Bars and texts (bottom right side) xysizer_attach(xy, label_create(&tconf_dark, "ARM SPEED"), 228, 95, 200, 6); dw->arm_speed = gauge_create(GAUGE_BIG, 8, 3); xysizer_attach(xy, dw->arm_speed, 228, 102, -1, -1); xysizer_attach(xy, label_create(&tconf_dark, "LEG SPEED"), 228, 106, 200, 6); dw->leg_speed = gauge_create(GAUGE_BIG, 7, 3); xysizer_attach(xy, dw->leg_speed, 228, 113, -1, -1); xysizer_attach(xy, label_create(&tconf_dark, "STUN RES"), 228, 117, 200, 6); dw->stun_resistance = gauge_create(GAUGE_BIG, 7, 3); xysizer_attach(xy, dw->stun_resistance, 228, 124, -1, -1); return xy; }
void text_defaults(text_settings *settings) { memset(settings, 0, sizeof(text_settings)); settings->cforeground = color_create(0xFF,0xFF,0xFF,0xFF); settings->opacity = 0xFF; }
int melee_init(scene *scene) { char bitmap[51*36*4]; memset(&bitmap, 255, 51*36*4); ticks = 0; pulsedir = 0; selection = 0; row_a = 0; column_a = 0; row_b = 0; column_b = 4; done_a = 0; done_b = 0; for(int i = 0; i < 10; i++) { players[i].sprite = scene->bk->anims[3]->animation->sprites[i]; DEBUG("found sprite %d x %d at %d, %d", players[i].sprite->img->w, players[i].sprite->img->h, players[i].sprite->pos_x, players[i].sprite->pos_y); players_big[i].sprite = scene->bk->anims[4]->animation->sprites[i]; int row = i / 5; int col = i % 5; sd_rgba_image * out = sub_sprite(scene->bk->anims[1]->animation->sprites[0], scene->bk->palettes[0], (62*col), (42*row), 51, 36); texture_create(&harportraits[i], out->data, 51, 36); sd_rgba_image_delete(out); } menu_background2_create(&feh, 90, 61); menu_background2_create(&bleh, 160, 43); texture_create(&select_hilight, bitmap, 51, 36); // set up the magic controller hooks if (scene->player1.ctrl->type == CTRL_TYPE_NETWORK) { controller_add_hook(scene->player2.ctrl, scene->player1.ctrl, scene->player1.ctrl->controller_hook); } if (scene->player2.ctrl->type == CTRL_TYPE_NETWORK) { controller_add_hook(scene->player1.ctrl, scene->player2.ctrl, scene->player2.ctrl->controller_hook); } const color bar_color = color_create(0, 190, 0, 255); const color bar_bg_color = color_create(80, 220, 80, 0); const color bar_border_color = color_create(0, 96, 0, 255); const color bar_top_left_border_color = color_create(0, 255, 0, 255); const color bar_bottom_right_border_color = color_create(0, 125, 0, 255); progressbar_create(&bar_power[0], 74, 12, 20*4, 8, bar_border_color, bar_border_color, bar_bg_color, bar_top_left_border_color, bar_bottom_right_border_color, bar_color, PROGRESSBAR_LEFT); progressbar_create(&bar_agility[0], 74, 30, 20*4, 8, bar_border_color, bar_border_color, bar_bg_color, bar_top_left_border_color, bar_bottom_right_border_color, bar_color, PROGRESSBAR_LEFT); progressbar_create(&bar_endurance[0], 74, 48, 20*4, 8, bar_border_color, bar_border_color, bar_bg_color, bar_top_left_border_color, bar_bottom_right_border_color, bar_color, PROGRESSBAR_LEFT); progressbar_create(&bar_power[1], 320-66-feh.w, 12, 20*4, 8, bar_border_color, bar_border_color, bar_bg_color, bar_top_left_border_color, bar_bottom_right_border_color, bar_color, PROGRESSBAR_LEFT); progressbar_create(&bar_agility[1], 320-66-feh.w, 30, 20*4, 8, bar_border_color, bar_border_color, bar_bg_color, bar_top_left_border_color, bar_bottom_right_border_color, bar_color, PROGRESSBAR_LEFT); progressbar_create(&bar_endurance[1], 320-66-feh.w, 48, 20*4, 8, bar_border_color, bar_border_color, bar_bg_color, bar_top_left_border_color, bar_bottom_right_border_color, bar_color, PROGRESSBAR_LEFT); for(int i = 0;i < 2;i++) { progressbar_set(&bar_power[i], 50); progressbar_set(&bar_agility[i], 50); progressbar_set(&bar_endurance[i], 50); } refresh_pilot_stats(); memset(&harplayer_a, 0, sizeof(harplayer_a)); memset(&harplayer_b, 0, sizeof(harplayer_b)); // All done return 0; }