void Gmove_icon() { int cur_window, was_normal; if ( !icon_active ) return; if ( (cur_window = active) != 2 ) Wgmode(); drawIconPtr = &icon_buf[ 0 ]; if ( (was_normal = !GisXORmode()) ) icon_xormode(); draw_icon( iconx, icony ); /* Erase old */ *drawIconPtr = '\0'; #ifdef UNIX printf( "%s", &icon_buf[ 0 ] ); #else vms_outputchars( &icon_buf[ 0 ], drawIconPtr - &icon_buf[ 0 ] ); #endif drawIconPtr = &icon_buf[ 0 ]; draw_icon( cur_iconx, cur_icony ); /* Draw new */ if( was_normal) icon_normalmode(); *drawIconPtr = '\0'; #ifdef UNIX printf( "%s", &icon_buf[ 0 ] ); #else vms_outputchars( &icon_buf[ 0 ], drawIconPtr - &icon_buf[ 0 ] ); #endif if (cur_window != 2) Wsetactive( cur_window ); iconx = cur_iconx; icony = cur_icony; icon_moving = 0; }
void send_data(func) { int i,j,k ; for (i=0; i<VFB_MAX; i++) { if(i == get_MyLocation()) continue; if(func ==2 && sock[i] > 0) fb_send(sock[i], vfb_list[0], myfb->fbfix.smem_len); else if (func ==3 && sock[i]>0) { fb_send(sock[i], vfb_list[i], myfb->fbfix.smem_len); } #if DEBUG printf(" send data sock[%d] \n",i); #endif for (j=0; j<myicon_count; j++) draw_icon(&icon[j]); } }
void load_tray_icon() { if (!hime_status_tray) return; if (!tray_icon) { create_tray(NULL); return; } // wrong width & height if it is not embedded-ready if (!gtk_status_icon_is_embedded(tray_icon)) return; iw = gtk_status_icon_get_size(tray_icon), ih = gtk_status_icon_get_size(tray_icon); if (!pixbuf) { char icon_fname[128]; get_icon_path(HIME_TRAY_PNG, icon_fname); pixbuf = gdk_pixbuf_new_from_file_at_size(icon_fname, iw, ih, NULL); } char *iconame = HIME_TRAY_PNG; // if (current_CS && current_CS->in_method && inmd) // Workaround due to issue #161 if (current_CS && current_CS->im_state != HIME_STATE_DISABLED && current_CS->im_state != HIME_STATE_ENG_FULL) iconame = inmd[current_CS->in_method].icon; char fname[512]; if (iconame) get_icon_path(iconame, fname); if (strcmp(pixbuf_ch_fname, fname) && pixbuf_ch) { g_object_unref(pixbuf_ch); pixbuf_ch = NULL; } if (!pixbuf_ch) { strcpy(pixbuf_ch_fname, fname); pixbuf_ch = gdk_pixbuf_new_from_file_at_size(fname, iw, ih, NULL); } draw_icon(); iconame = NULL; }
void Canvas::draw_icon(uint8_t x, uint8_t y, const uint8_t* bp, uint8_t scale) { uint8_t width = pgm_read_byte(bp++); uint8_t height = pgm_read_byte(bp++); draw_icon(x, y, bp, width, height, scale); }
static void draw_found_stone_message_box(frame_t *frame, int param) { draw_string(1, 10, frame, "A geologist"); draw_string(1, 20, frame, "has found stone"); draw_icon(20, 14, 0x2b, frame); }
static void draw_1h_since_save_message_box(frame_t *frame, int param) { draw_string(1, 10, frame, "One hour passed"); draw_string(1, 20, frame, "since the last"); draw_string(1, 30, frame, "saving"); draw_icon(20, 14, 0x5d, frame); }
void onSelectComp (TPoint& po, TListBox *sender) { sender->SetState (stSelect, 0); canvas->SetState (stFocus, 1); gui_wmode( XOR_PUT ); state=stateDraggin; currn = NULL; delta = QPoint( 24, 24 ); size = QPoint( 48, 48 ); draw_icon( posold = po ); }
gboolean cb_expose(GtkWidget *da, cairo_t *event, gpointer data) #endif { if (!da) create_tray(NULL); // dbg("cb_expose\n"); draw_icon(); return FALSE; }
void draw_again(int id) { draw_background(id); unsigned short color = FONT_COLOR; if(id >= 3) color = 0x0000; draw_icon(ICON_FINDER, ICON_X1, ICON_Y); draw_string(ICON_X1 + 12, ICON_STRING_Y, "FINDER", color); draw_icon(ICON_PHOTO, ICON_X2, ICON_Y); draw_string(ICON_X2 + 12, ICON_STRING_Y, "PHOTO", color); draw_icon(ICON_TEXT, ICON_X3, ICON_Y); draw_string(ICON_X3 + 20, ICON_STRING_Y, "TEXT", color); draw_icon(ICON_GAME, ICON_X4, ICON_Y); draw_string(ICON_X4 + 17, ICON_STRING_Y, "GAME", color); draw_icon(ICON_DRAW, ICON_X5, ICON_Y); draw_string(ICON_X5 + 17, ICON_STRING_Y, "DRAW", color); draw_icon(ICON_SETTING, ICON_X6, ICON_Y); draw_string(ICON_X6 + 8, ICON_STRING_Y, "SETTING", color); draw_mouse(ori_x_mouse, ori_y_mouse); struct Window* win = Get_LastWindow(); while(win != 0) { draw_window(win); win = win->pre; } display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); }
void Keyswitch::groupChange(int index) { if (xkbConf->status==DONT_USE_XKB) return; currentGroup=index; if (currentGroup<groupeName.size()-1) nextGroupe = currentGroup+1; else if (currentGroup == groupeName.size()-1) nextGroupe = 0; draw_icon(); update(); }
static void draw_call_to_menu_message_box(frame_t *frame, int menu) { const int map_menu_sprite[] = { 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xeb, 0x12a, 0x12b }; draw_string(1, 10, frame, "You wanted me"); draw_string(1, 20, frame, "to call you"); draw_string(1, 30, frame, "to this menu"); draw_icon(18, 8, map_menu_sprite[menu], frame); }
void Keyswitch::reconfigure() { QStringList tmpGrName; keys->getGroupNames(tmpGrName); XKBConf* newConf = X11tools::loadXKBconf(); if (tmpGrName!=groupeName || newConf->layouts != xkbConf->layouts || newConf->showFlag != xkbConf->showFlag || newConf->showSingle != xkbConf->showSingle || newConf->status != xkbConf->status) { groupeName=tmpGrName; xkbConf=newConf; init(); draw_icon(); createMenu(); } }
static gint gtk_icon_entry_expose (GtkWidget *widget, GdkEventExpose *event) { GtkIconEntry *entry; GtkIconEntryPrivate *priv; g_return_val_if_fail (GTK_IS_ICON_ENTRY (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); entry = GTK_ICON_ENTRY (widget); priv = GTK_ICON_ENTRY_GET_PRIVATE (entry); if (GTK_WIDGET_DRAWABLE (widget)) { gboolean found = FALSE; int i; for (i = 0; i < MAX_ICONS && !found; i++) { EntryIconInfo *icon_info = &priv->icons[i]; if (event->window == icon_info->window) { gint width; GtkAllocation text_area_alloc; get_text_area_size (entry, &text_area_alloc); gdk_drawable_get_size (icon_info->window, &width, NULL); gtk_paint_flat_box (widget->style, icon_info->window, GTK_WIDGET_STATE (widget), GTK_SHADOW_NONE, NULL, widget, "entry_bg", 0, 0, width, text_area_alloc.height); draw_icon (widget, i); found = TRUE; } } if (!found) GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event); } return FALSE; }
Keyswitch::Keyswitch(XKeyboard *keyboard, QWidget *parent) : QLabel(parent) { keys=keyboard; QSettings * antico = new QSettings(QCoreApplication::applicationDirPath() + "/antico.cfg", QSettings::IniFormat, this); antico->beginGroup("Style"); map_path = antico->value("path").toString()+"/language/"; antico->endGroup(); //Style xkbConf = X11tools::loadXKBconf(); if (xkbConf->status!=DONT_USE_XKB) { load_rules(); qDebug()<<"XKB status : " <<xkbConf->status; if (xkbConf->status==USE_XKB) set_xkb(); init(); if (groupeName.count()>1 || xkbConf->showSingle) { draw_icon(); createMenu(); } } }
void Gactivate_icon() { int cur_window, was_normal; icon_active = 131071; icon_moving = 0; if ( (cur_window = active) != 2 ) Wgmode(); drawIconPtr = &icon_buf[ 0 ]; if ( (was_normal = !GisXORmode()) ) icon_xormode(); draw_icon( iconx, icony ); if( was_normal) icon_normalmode(); *drawIconPtr = '\0'; #ifdef UNIX printf( "%s", &icon_buf[ 0 ] ); #else vms_outputchars( &icon_buf[ 0 ], drawIconPtr - &icon_buf[ 0 ] ); #endif if (cur_window != 2) Wsetactive( cur_window ); }
void draw_bottom(int id) { /*int i, j; for(i = 0; i < SCREEN_WIDTH; ++i) { for(j = 0; j < SCREEN_HEIGHT; ++j) { unsigned int offset = j * SCREEN_WIDTH + i; *(VESA_ADDR + offset) = RECORD_COLOR[i][j]; } }*/ draw_background(id); unsigned short color = FONT_COLOR; if(id >= 3) color = 0x0000; draw_icon(ICON_FINDER, ICON_X1, ICON_Y); draw_string(ICON_X1 + 12, ICON_STRING_Y, "FINDER", color); draw_icon(ICON_PHOTO, ICON_X2, ICON_Y); draw_string(ICON_X2 + 12, ICON_STRING_Y, "PHOTO", color); draw_icon(ICON_TEXT, ICON_X3, ICON_Y); draw_string(ICON_X3 + 20, ICON_STRING_Y, "TEXT", color); draw_icon(ICON_GAME, ICON_X4, ICON_Y); draw_string(ICON_X4 + 17, ICON_STRING_Y, "GAME", color); draw_icon(ICON_DRAW, ICON_X5, ICON_Y); draw_string(ICON_X5 + 17, ICON_STRING_Y, "DRAW", color); draw_icon(ICON_SETTING, ICON_X6, ICON_Y); draw_string(ICON_X6 + 8, ICON_STRING_Y, "SETTING", color); draw_mouse(ori_x_mouse, ori_y_mouse); struct Window* win = Get_LastWindow(); while(win != 0) { if(win->pre != 0) draw_window(win); win = win->pre; } //display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); }
void draw_loading() { draw_background(0); draw_icon(ICON_FINDER, ICON_X1, ICON_Y); draw_string(ICON_X1 + 12, ICON_STRING_Y, "FINDER", FONT_COLOR); draw_icon(ICON_PHOTO, ICON_X2, ICON_Y); draw_string(ICON_X2 + 12, ICON_STRING_Y, "PHOTO", FONT_COLOR); draw_icon(ICON_TEXT, ICON_X3, ICON_Y); draw_string(ICON_X3 + 20, ICON_STRING_Y, "TEXT", FONT_COLOR); draw_icon(ICON_GAME, ICON_X4, ICON_Y); draw_string(ICON_X4 + 17, ICON_STRING_Y, "GAME", FONT_COLOR); draw_icon(ICON_DRAW, ICON_X5, ICON_Y); draw_string(ICON_X5 + 17, ICON_STRING_Y, "DRAW", FONT_COLOR); draw_icon(ICON_SETTING, ICON_X6, ICON_Y); draw_string(ICON_X6 + 8, ICON_STRING_Y, "SETTING", FONT_COLOR); display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); draw_mouse(ori_x_mouse, ori_y_mouse); InitNode(); InitWindow(); }
static void notification_box_draw(notification_box_t *box, frame_t *frame) { draw_background(box->obj.width, box->obj.height, 0x13a, frame); draw_icon(14, 128, 0x120, frame); /* Checkbox */ int param = box->param; switch (box->type) { case 1: draw_under_attack_message_box(frame, param); break; case 2: draw_lost_fight_message_box(frame, param); break; case 3: draw_victory_fight_message_box(frame, param); break; case 4: draw_mine_empty_message_box(frame, param); break; case 5: draw_call_to_location_message_box(frame, param); break; case 6: draw_knight_occupied_message_box(frame, param); break; case 7: draw_new_stock_message_box(frame, param); break; case 8: draw_lost_land_message_box(frame, param); break; case 9: draw_lost_buildings_message_box(frame, param); break; case 10: draw_emergency_active_message_box(frame, param); break; case 11: draw_emergency_neutral_message_box(frame, param); break; case 12: draw_found_gold_message_box(frame, param); break; case 13: draw_found_iron_message_box(frame, param); break; case 14: draw_found_coal_message_box(frame, param); break; case 15: draw_found_stone_message_box(frame, param); break; case 16: draw_call_to_menu_message_box(frame, param); break; case 17: draw_30m_since_save_message_box(frame, param); break; case 18: draw_1h_since_save_message_box(frame, param); break; case 19: draw_call_to_stock_message_box(frame, param); break; default: NOT_REACHED(); break; } }
/*! \brief Draw a player's status screen * * Draw the verbose stats of a single player. * \param fighter_index - Character to draw (index in pidx array) */ static void status_screen(size_t fighter_index) { int stop = 0; int bc = 0; unsigned int rect_fill_amount = 0, curr_fill, res_index, stats_y, equipment_index; size_t pidx_index, stats_index; play_effect(SND_MENU, 128); pidx_index = pidx[fighter_index]; update_equipstats(); while (!stop) { check_animation(); // Redraw the map, clearing any menus under this new window drawmap(); // Box around top-left square menubox(double_buffer, xofs, 16 + yofs, 18, 5, BLUE); draw_playerstat(double_buffer, pidx_index, 8 + xofs, 24 + yofs); // Box around bottom-left square menubox(double_buffer, xofs, 72 + yofs, 18, 17, BLUE); print_font(double_buffer, 8 + xofs, 80 + yofs, _("Exp:"), FGOLD); sprintf(strbuf, "%d", party[pidx_index].xp); print_font(double_buffer, 152 - (strlen(strbuf) * 8) + xofs, 80 + yofs, strbuf, FNORMAL); print_font(double_buffer, 8 + xofs, 88 + yofs, _("Next:"), FGOLD); // TT: Does this mean we can only level up to 50? if (party[pidx_index].lvl < 50) { sprintf(strbuf, "%d", party[pidx_index].next - party[pidx_index].xp); } else { sprintf(strbuf, "%d", 0); } print_font(double_buffer, 152 - (strlen(strbuf) * 8) + xofs, 88 + yofs, strbuf, FNORMAL); print_font(double_buffer, 8 + xofs, 104 + yofs, _("Strength"), FGOLD); print_font(double_buffer, 8 + xofs, 112 + yofs, _("Agility"), FGOLD); print_font(double_buffer, 8 + xofs, 120 + yofs, _("Vitality"), FGOLD); print_font(double_buffer, 8 + xofs, 128 + yofs, _("Intellect"), FGOLD); print_font(double_buffer, 8 + xofs, 136 + yofs, _("Sagacity"), FGOLD); print_font(double_buffer, 8 + xofs, 144 + yofs, _("Speed"), FGOLD); print_font(double_buffer, 8 + xofs, 152 + yofs, _("Aura"), FGOLD); print_font(double_buffer, 8 + xofs, 160 + yofs, _("Spirit"), FGOLD); // Blank space on display of 16 pixels print_font(double_buffer, 8 + xofs, 176 + yofs, _("Attack"), FGOLD); print_font(double_buffer, 8 + xofs, 184 + yofs, _("Hit"), FGOLD); print_font(double_buffer, 8 + xofs, 192 + yofs, _("Defense"), FGOLD); print_font(double_buffer, 8 + xofs, 200 + yofs, _("Evade"), FGOLD); print_font(double_buffer, 8 + xofs, 208 + yofs, _("Mag.Def"), FGOLD); for (stats_index = 0; stats_index < NUM_STATS; stats_index++) { // Coordinates of stats on display stats_y = stats_index * 8 + 104; // Add an extra 8-pixel space to separate these from the others if (stats_index > A_SPI) { stats_y += 8; } print_font(double_buffer, 96 + xofs, stats_y + yofs, "$", FGOLD); sprintf(strbuf, "%d", fighter[fighter_index].stats[stats_index]); print_font(double_buffer, 152 - (strlen(strbuf) * 8) + xofs, stats_y + yofs, strbuf, FNORMAL); } menubox(double_buffer, 160 + xofs, 16 + yofs, 18, 16, BLUE); print_font(double_buffer, 168 + xofs, 24 + yofs, _("Earth"), FNORMAL); print_font(double_buffer, 168 + xofs, 32 + yofs, _("Black"), FNORMAL); print_font(double_buffer, 168 + xofs, 40 + yofs, _("Fire"), FNORMAL); print_font(double_buffer, 168 + xofs, 48 + yofs, _("Thunder"), FNORMAL); print_font(double_buffer, 168 + xofs, 56 + yofs, _("Air"), FNORMAL); print_font(double_buffer, 168 + xofs, 64 + yofs, _("White"), FNORMAL); print_font(double_buffer, 168 + xofs, 72 + yofs, _("Water"), FNORMAL); print_font(double_buffer, 168 + xofs, 80 + yofs, _("Ice"), FNORMAL); print_font(double_buffer, 168 + xofs, 88 + yofs, _("Poison"), FNORMAL); print_font(double_buffer, 168 + xofs, 96 + yofs, _("Blind"), FNORMAL); print_font(double_buffer, 168 + xofs, 104 + yofs, _("Charm"), FNORMAL); print_font(double_buffer, 168 + xofs, 112 + yofs, _("Paralyze"), FNORMAL); print_font(double_buffer, 168 + xofs, 120 + yofs, _("Petrify"), FNORMAL); print_font(double_buffer, 168 + xofs, 128 + yofs, _("Silence"), FNORMAL); print_font(double_buffer, 168 + xofs, 136 + yofs, _("Sleep"), FNORMAL); print_font(double_buffer, 168 + xofs, 144 + yofs, _("Time"), FNORMAL); for (res_index = 0; res_index < R_TOTAL_RES; res_index++) { rectfill(double_buffer, 240 + xofs, res_index * 8 + 25 + yofs, 310 + xofs, res_index * 8 + 31 + yofs, 3); if (fighter[fighter_index].res[res_index] < 0) { bc = 18; // bright red, meaning WEAK defense rect_fill_amount = abs(fighter[fighter_index].res[res_index]); } else if (fighter[fighter_index].res[res_index] >= 0 && fighter[fighter_index].res[res_index] <= 10) { bc = 34; // bright green, meaning so-so defense rect_fill_amount = fighter[fighter_index].res[res_index]; } else if (fighter[fighter_index].res[res_index] > 10) { bc = 50; // bright blue, meaning STRONG defense rect_fill_amount = fighter[fighter_index].res[res_index] - 10; } if (rect_fill_amount > 0) { for (curr_fill = 0; curr_fill < rect_fill_amount; curr_fill++) { rectfill(double_buffer, curr_fill * 7 + 241 + xofs, res_index * 8 + 26 + yofs, curr_fill * 7 + 246 + xofs, res_index * 8 + 30 + yofs, bc + curr_fill); } } } menubox(double_buffer, 160 + xofs, 160 + yofs, 18, 6, BLUE); for (equipment_index = 0; equipment_index < NUM_EQUIPMENT; equipment_index++) { draw_icon(double_buffer, items[party[pidx_index].eqp[equipment_index]].icon, 168 + xofs, equipment_index * 8 + 168 + yofs); print_font(double_buffer, 176 + xofs, equipment_index * 8 + 168 + yofs, items[party[pidx_index].eqp[equipment_index]].name, FNORMAL); } blit2screen(xofs, yofs); readcontrols(); if (PlayerInput.left && fighter_index > 0) { unpress(); fighter_index--; pidx_index = pidx[fighter_index]; play_effect(SND_MENU, 128); } if (PlayerInput.right && fighter_index < numchrs - 1) { unpress(); fighter_index++; pidx_index = pidx[fighter_index]; play_effect(SND_MENU, 128); } if (PlayerInput.bctrl) { unpress(); play_effect(SND_MENU, 128); stop = 1; } } }
/*! \brief Player defeated the enemies * \author Josh Bolduc * \date Created ???????? * \date Updated * * Distribute the booty! */ static void heroes_win (void) { int tgp = 0; int index; int b; int c; int z; int nc = 0; int txp = 0; int found_item = 0; int nr = 0; int ent = 0; s_fighter t1; s_fighter t2; play_music ("rend5.s3m", 0); kq_wait (500); revert_equipstats (); for (index = 0; index < numchrs; index++) fighter[index].aframe = 4; battle_render (0, 0, 0); blit2screen (0, 0); kq_wait (250); for (index = 0; index < numchrs; index++) { if ((fighter[index].sts[S_STONE] == 0) && (fighter[index].sts[S_DEAD] == 0)) nc++; ta[index] = 0; } for (index = PSIZE; index < PSIZE + numens; index++) { txp += fighter[index].xp; tgp += fighter[index].gp; } /* JB: nc should never be zero if we won, but whatever */ if (nc > 0) txp /= nc; gp += tgp; if (tgp > 0) sprintf (strbuf, _("Gained %d xp and found %d gp."), txp, tgp); else sprintf (strbuf, _("Gained %d xp."), txp); menubox (double_buffer, 152 - (strlen (strbuf) * 4), 8, strlen (strbuf), 1, BLUE); print_font (double_buffer, 160 - (strlen (strbuf) * 4), 16, strbuf, FNORMAL); blit2screen (0, 0); blit (double_buffer, back, 0, 0, 0, 0, 352, 280); for (index = 0; index < numens; index++) { /* PH bug: (?) should found_item be reset to zero at the start of this loop? * If you defeat 2 enemies, you should (possibly) get 2 items, right? */ if ((rand () % 100) < fighter[index + PSIZE].dip) { if (fighter[index + PSIZE].defeat_item_common > 0) found_item = fighter[index + PSIZE].defeat_item_common; if (fighter[index + PSIZE].defeat_item_rare > 0) { if ((rand () % 100) < 5) found_item = fighter[index + PSIZE].defeat_item_rare; } if (found_item > 0) { if (check_inventory (found_item, 1) != 0) { sprintf (strbuf, _("%s found!"), items[found_item].name); menubox (double_buffer, 148 - (strlen (strbuf) * 4), nr * 24 + 48, strlen (strbuf) + 1, 1, BLUE); draw_icon (double_buffer, items[found_item].icon, 156 - (strlen (strbuf) * 4), nr * 24 + 56); print_font (double_buffer, 164 - (strlen (strbuf) * 4), nr * 24 + 56, strbuf, FNORMAL); nr++; } } } } if (nr > 0) { blit2screen (0, 0); wait_enter (); blit (back, double_buffer, 0, 0, 0, 0, 352, 280); } nr = 0; for (c = 0; c < numchrs; c++) { if ((party[pidx[c]].sts[S_STONE] == 0) && (party[pidx[c]].sts[S_DEAD] == 0)) { b = c * 160; player2fighter (pidx[c], &t1); if (give_xp (pidx[c], txp, 0) == 1) { menubox (double_buffer, b, 40, 18, 9, BLUE); player2fighter (pidx[c], &t2); print_font (double_buffer, b + 8, 48, _("Level up!"), FGOLD); print_font (double_buffer, b + 8, 56, _("Max HP"), FNORMAL); print_font (double_buffer, b + 8, 64, _("Max MP"), FNORMAL); print_font (double_buffer, b + 8, 72, _("Strength"), FNORMAL); print_font (double_buffer, b + 8, 80, _("Agility"), FNORMAL); print_font (double_buffer, b + 8, 88, _("Vitality"), FNORMAL); print_font (double_buffer, b + 8, 96, _("Intellect"), FNORMAL); print_font (double_buffer, b + 8, 104, _("Sagacity"), FNORMAL); sprintf (strbuf, "%3d>", t1.mhp); print_font (double_buffer, b + 96, 56, strbuf, FNORMAL); sprintf (strbuf, "%3d", t2.mhp); print_font (double_buffer, b + 128, 56, strbuf, FGREEN); sprintf (strbuf, "%3d>", t1.mmp); print_font (double_buffer, b + 96, 64, strbuf, FNORMAL); sprintf (strbuf, "%3d", t2.mmp); print_font (double_buffer, b + 128, 64, strbuf, FGREEN); for (z = 0; z < 5; z++) { sprintf (strbuf, "%3d>", t1.stats[z]); print_font (double_buffer, b + 96, z * 8 + 72, strbuf, FNORMAL); sprintf (strbuf, "%3d", t2.stats[z]); if (t2.stats[z] > t1.stats[z]) print_font (double_buffer, b + 128, z * 8 + 72, strbuf, FGREEN); else print_font (double_buffer, b + 128, z * 8 + 72, strbuf, FNORMAL); } nr++; } else menubox (double_buffer, b, 104, 18, 1, BLUE); sprintf (strbuf, _("Next level %7d"), party[pidx[c]].next - party[pidx[c]].xp); print_font (double_buffer, b + 8, 112, strbuf, FGOLD); } } blit2screen (0, 0); for (c = 0; c < numchrs; c++) if ((party[pidx[c]].sts[S_STONE] == 0) && (party[pidx[c]].sts[S_DEAD] == 0)) ent += learn_new_spells (pidx[c]); if (ent == 0) wait_enter (); }
void Canvas::run(uint8_t ix, const void_P* tab, uint8_t max) { if (ix >= max) return; const uint8_t* ip = (const uint8_t*) pgm_read_word(tab + ix); uint8_t x, y, r, g, b, w, h, s; int8_t dx, dy; char c; while (1) { switch (pgm_read_byte(ip++)) { case END_SCRIPT: return; case CALL_SCRIPT: ix = pgm_read_byte(ip++); if (ix >= max) return; run(ix, tab, max); break; case SET_CANVAS_COLOR: r = pgm_read_byte(ip++); g = pgm_read_byte(ip++); b = pgm_read_byte(ip++); set_canvas_color(color(r, b, g)); break; case SET_PEN_COLOR: r = pgm_read_byte(ip++); g = pgm_read_byte(ip++); b = pgm_read_byte(ip++); set_pen_color(color(r, g, b)); break; case SET_TEXT_COLOR: r = pgm_read_byte(ip++); g = pgm_read_byte(ip++); b = pgm_read_byte(ip++); set_text_color(color(r, g, b)); break; case SET_TEXT_SCALE: set_text_scale(pgm_read_byte(ip++)); break; case SET_TEXT_FONT: ix = pgm_read_byte(ip++); if (ix >= max) return; set_text_font((Font*) pgm_read_word(tab + ix)); break; case SET_CURSOR: x = pgm_read_byte(ip++); y = pgm_read_byte(ip++); set_cursor(x, y); break; case MOVE_CURSOR: dx = pgm_read_byte(ip++); dy = pgm_read_byte(ip++); move_cursor(dx, dy); break; case DRAW_BITMAP: ix = pgm_read_byte(ip++); if (ix >= max) return; w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); s = pgm_read_byte(ip++); draw_bitmap((const uint8_t*) pgm_read_word(tab + ix), w, h, s); break; case DRAW_ICON: ix = pgm_read_byte(ip++); if (ix >= max) return; s = pgm_read_byte(ip++); draw_icon((const uint8_t*) pgm_read_word(tab + ix), s); break; case DRAW_PIXEL: draw_pixel(); break; case DRAW_LINE: x = pgm_read_byte(ip++); y = pgm_read_byte(ip++); draw_line(x, y); break; case DRAW_POLY: ix = pgm_read_byte(ip++); if (ix >= max) return; s = pgm_read_byte(ip++); draw_poly_P((const int8_t*) pgm_read_word(tab + ix), s); break; case DRAW_STROKE: ix = pgm_read_byte(ip++); if (ix >= max) return; s = pgm_read_byte(ip++); draw_stroke_P((const int8_t*) pgm_read_word(tab + ix), s); break; case DRAW_RECT: w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); draw_rect(w, h); break; case FILL_RECT: w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); fill_rect(w, h); break; case DRAW_ROUNDRECT: w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); r = pgm_read_byte(ip++); draw_roundrect(w, h, r); break; case FILL_ROUNDRECT: w = pgm_read_byte(ip++); h = pgm_read_byte(ip++); r = pgm_read_byte(ip++); fill_roundrect(w, h, r); break; case DRAW_CIRCLE: r = pgm_read_byte(ip++); draw_circle(r); break; case FILL_CIRCLE: r = pgm_read_byte(ip++); fill_circle(r); break; case DRAW_CHAR: c = pgm_read_byte(ip++); draw_char(c); break; case DRAW_STRING: ix = pgm_read_byte(ip++); if (ix >= max) return; draw_string_P((const char*) pgm_read_word(tab + ix)); break; case FILL_SCREEN: fill_screen(); break; default: return; } } }
void QVisualBinding::MouseEvent( TEvent& e ) { if (e.type&evMouseDown) { currc=doc->inComponent( e.pos.x, e.pos.y ); if (e.btn==1) { if (currc) { state=stateDraggin; gui_wmode( XOR_PUT ); posold = e.pos; size = QPoint(currc->r.deltax(), currc->r.deltay()); delta = QPoint( e.pos.x-currc->r.a.x, e.pos.y-currc->r.a.y ); draw_icon( posold ); } else if (doc->inNode( e.pos.x, e.pos.y, &currn, &currp)) if (!simOn) { state=stateConnect; gui_wmode( XOR_PUT ); posold = posori = currp->pos(); } else { currn->state = !currn->state; do_draw_flags( bDrawNodes ); } } } ////////////////////////////////////////////////////////////////// if (e.type&evMouseMove) { if (state==stateDraggin) { draw_icon( posold ); draw_icon( posold=e.pos ); } else if (state==stateConnect) { draw_line( EGA_WHITE, posori.x, posori.y, posold.x, posold.y); posold = e.pos; draw_line( EGA_WHITE, posori.x, posori.y, posold.x, posold.y); } } ////////////////////////////////////////////////////////////////// if (e.type&evMouseUp) { if (state==stateDraggin) { draw_icon( posold ); gui_wmode( COPY_PUT ); state=0; if (currc) // cuando se mueve un componente currc->moveto( posold.x-currc->r.a.x-delta.x, posold.y-currc->r.a.y-delta.y); else if (canvas->Bounds.contain(e.pos)) // Cuando se coloca uno nuevo... doc->addComponent( createComponent( posold.x-delta.x, posold.y-delta.y, complist->pos ) ); currc=NULL; canvas->doDraw(); } else if (state==stateConnect) { draw_line( EGA_WHITE, posori.x, posori.y, posold.x, posold.y); state = 0; gui_wmode( COPY_PUT ); if (currn && currp) { QNode *n; QNodePoint *p; if (doc->inNode(posold.x, posold.y, &n, &p) && (n!=currn)) { doc->joinNodes( currn, n ); currn->addPoint(new QNodeNiple(currp, p)); } else currn->addPoint(new QNodePoint(posold, currp)); } currn = NULL; currp = NULL; canvas->doDraw(); } else if (e.btn==2) { QComponent *c=doc->inComponent( e.pos.x, e.pos.y ); if (c!=selectc) { selectc=c; do_draw_flags( bDrawComps ); } } } }
/*! \brief Show special items * * List any special items that the party has. * * WK: This function would be more appropriate in a script, such as global.lua. * This function is preventing me from completely removing progress.h */ void spec_items(void) { int a, num_items = 0, stop = 0, ptr = 0; short list_item_which[MAX_PLAYER_SPECIAL_ITEMS]; short list_item_quantity[MAX_PLAYER_SPECIAL_ITEMS]; /* Set number of items here */ for (a = 0; a < MAX_SPECIAL_ITEMS; a++) { if (player_special_items[a]) { list_item_which[num_items] = a; list_item_quantity[num_items] = player_special_items[a]; num_items++; } } if (num_items == 0) { play_effect(SND_BAD, 128); return; } play_effect(SND_MENU, 128); while (!stop) { check_animation(); drawmap(); menubox(double_buffer, 72 + xofs, 12 + yofs, 20, 1, BLUE); print_font(double_buffer, 108 + xofs, 20 + yofs, _("Special Items"), FGOLD); menubox(double_buffer, 72 + xofs, 36 + yofs, 20, 19, BLUE); for (a = 0; a < num_items; a++) { draw_icon(double_buffer, special_items[list_item_which[a]].icon, 88 + xofs, a * 8 + 44 + yofs); print_font(double_buffer, 96 + xofs, a * 8 + 44 + yofs, special_items[list_item_which[a]].name, FNORMAL); if (list_item_quantity[a] > 1) { sprintf(strbuf, "^%d", list_item_quantity[a]); print_font(double_buffer, 224 + xofs, a * 8 + 44 + yofs, strbuf, FNORMAL); } } menubox(double_buffer, 72 + xofs, 204 + yofs, 20, 1, BLUE); a = strlen(special_items[list_item_which[ptr]].description) * 4; print_font(double_buffer, 160 - a + xofs, 212 + yofs, special_items[list_item_which[ptr]].description, FNORMAL); draw_sprite(double_buffer, menuptr, 72 + xofs, ptr * 8 + 44 + yofs); blit2screen(xofs, yofs); readcontrols(); if (PlayerInput.down) { unpress(); ptr = (ptr + 1) % num_items; play_effect(SND_CLICK, 128); } if (PlayerInput.up) { unpress(); ptr = (ptr - 1 + num_items) % num_items; play_effect(SND_CLICK, 128); } if (PlayerInput.bctrl) { unpress(); stop = 1; } } }
static void draw_player_face(int x, int y, int player, frame_t *frame) { gfx_fill_rect(8*x, y, 48, 72, game.player[player]->color, frame); draw_icon(x+1, y+4, get_player_face_sprite(game.pl_init[player].face), frame); }
int main(int argc, char *argv[]) { int ret; struct tsdev *ts; lua_State *L; myfb = myfb_open(); set_vfb_buf(1); ts = ts_init(); L = luaL_newstate(); luaL_openlibs(L); lua_register(L, "SET_COUNT", lua_set_icon_count); lua_register(L, "SET_ICON", lua_set_icon_info); lua_register(L, "SET_CMD", lua_set_cmd_list); lua_register(L, "SET_BGCOLOR", lua_set_bgcolor); lua_register(L, "SET_BGIMAGE", lua_set_bgimage); luaL_dofile(L, file_ui); lua_close(L); while (1) { int c, da_count, old_da_count, pid, state = 0; struct ts_sample samp; struct icon *i; struct cmd_list *j; da_count = get_DeviceAttached(); if (!da_count) da_count = 0; if (!old_da_count) old_da_count = da_count; else { if (old_da_count != da_count) { clear_screen(); put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2 - 10, "Attached Info is changed!", white); put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2 + 10, "Touch the screen!", white); old_da_count = da_count; ret = ts_read(ts, &samp, 1); continue; } } set_bgimage(); set_bgcolor(); for (c=0; c<=da_count; c++) draw_block(myfb->fbvar.xres-12*c-12, 3); if (head == NULL) { put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2, "Sorry, No Apps. registered!", white); #ifdef DEBUG fprintf(stderr, "No Apps!\n"); #endif break; } for (i=head; i != NULL; i=i->next) draw_icon(i); ret = ts_read(ts, &samp, 1); if (ret < 0) { perror("ts_read"); continue; } if (ret != 1) continue; if (samp.x > 310 && samp.y >230) break; for (i=head, j=cmdlist; i != NULL; i=i->next, j=j->next) { if (icon_handle(i, &samp) > 0) { if (chat_count < 20) continue; chat_count = 0; pid = fork(); if (pid == 0) { #ifdef DEBUG fprintf(stderr, " *** This is CHILD! ***\n"); #endif if (j) ret = execl(j->path, j->args, 0); if (ret < 0) { perror("execl"); exit(1); } } else { sleep(1); wait(&state); no_count = 0; put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2, "End of Program!", white); #ifdef DEBUG fprintf(stderr, " *** End of CHILD! ***\n"); #endif } } } } clear_screen(); put_string_center(myfb->fbvar.xres/2, myfb->fbvar.yres/2, "Thanks for Use!", white); free_icon(); free_cmd(); ts_close(ts); free_vfb_buf(1); myfb_close(); return 0; }
static void drawcb_icon( LWControl *ectl, void *edata, DrMode mode ) { draw_icon( CON_HOTX( ectl ), CON_HOTY( ectl ), rasf, panel ); }
void CImageButtonWithStyle::OnNotifyCustomDraw (NMHDR * pNotifyStruct, LRESULT* result) { LPNMCUSTOMDRAW pCustomDraw = (LPNMCUSTOMDRAW) pNotifyStruct; ASSERT(pCustomDraw->hdr.hwndFrom == m_hWnd); ASSERT(pCustomDraw->hdr.code = NM_CUSTOMDRAW); DWORD style = GetStyle(); if ((style & (BS_BITMAP | BS_ICON)) == 0 || !g_xpStyle.IsAppThemed() || !g_xpStyle.IsThemeActive()) { // not icon or bitmap button, or themes not active - draw normally *result = CDRF_DODEFAULT; return; } if (pCustomDraw->dwDrawStage == CDDS_PREERASE) // erase background (according to parent window's themed background g_xpStyle.DrawThemeParentBackground(m_hWnd, pCustomDraw->hdc, &pCustomDraw->rc); if (pCustomDraw->dwDrawStage == CDDS_PREERASE || pCustomDraw->dwDrawStage == CDDS_PREPAINT) { // get theme handle HTHEME hTheme = g_xpStyle.OpenThemeData(m_hWnd, L"BUTTON"); ASSERT(hTheme != NULL); if (hTheme == NULL) { // fail gracefully *result = CDRF_DODEFAULT; return; } // determine state for DrawThemeBackground() // note: order of these tests is significant int state_id = PBS_NORMAL; if (style & WS_DISABLED) state_id = PBS_DISABLED; else if (pCustomDraw->uItemState & CDIS_SELECTED) state_id = PBS_PRESSED; else if (pCustomDraw->uItemState & CDIS_HOT) state_id = PBS_HOT; else if (GetCheck())//T4: Added Checkbox support state_id = PBS_PRESSED; else if (style & BS_DEFPUSHBUTTON) state_id = PBS_DEFAULTED; // draw themed button background appropriate to button state g_xpStyle.DrawThemeBackground(hTheme, pCustomDraw->hdc, BP_PUSHBUTTON, state_id, &pCustomDraw->rc, NULL); // get content rectangle (space inside button for image) CRect content_rect(pCustomDraw->rc); g_xpStyle.GetThemeBackgroundContentRect(hTheme, pCustomDraw->hdc, BP_PUSHBUTTON, state_id, &pCustomDraw->rc, &content_rect); // we're done with the theme g_xpStyle.CloseThemeData(hTheme); // draw the image if (style & BS_BITMAP) { draw_bitmap(pCustomDraw->hdc, &content_rect, style); } else { ASSERT(style & BS_ICON); // since we bailed out at top otherwise draw_icon(pCustomDraw->hdc, &content_rect, style); } // finally, draw the focus rectangle if needed //T4: We don't need focus here /*if (pCustomDraw->uItemState & CDIS_FOCUS) { // draw focus rectangle DrawFocusRect (pCustomDraw->hdc, &content_rect); }*/ *result = CDRF_SKIPDEFAULT; return; } // we should never get here, since we should only get CDDS_PREERASE or CDDS_PREPAINT ASSERT(false); *result = CDRF_DODEFAULT; }
int main(void) { pthread_t ts_thread; void* thread_result; int thread_res; int count ; int offset =0; unsigned short buf_pix ; struct color tmp_color; int i,j; int tmp = 0; signal(SIGSEGV, sig); signal(SIGINT, sig); signal(SIGTERM, sig); myfb = myfb_open(); insert_ipaddr(); for(i=0 ; i <10; i++) printf("\n"); for(i =0 ; i<4 ; i++) { printf(" ipaddr set [%d] = ", i ); for(j=0 ; j <16 ; j++) { printf("%c",ipaddr[i][j]); } printf("\n"); } set_vfb_buf(VFB_MAX); #if DEBUG printf(" set_ vfb buf () \n"); #endif register_icon(&icon[0], 40, 198,60,40, "Single", "" ); register_icon(&icon[1], 130, 198,60,40, "Mult", ""); register_icon(&icon[2], 220, 198,60,40, "Full Screen", ""); register_icon(&icon[3], 298, 5,20,20, "x", ""); thread_res = pthread_create(&ts_thread, NULL, ts_click,NULL); if (thread_res !=0) { perror (" thread create failed\n"); exit(1); } clear_screen(); for (i=0; i<myicon_count; i++) draw_icon(&icon[i]); while( event ==0) { sleep(1); // input delay } while(1) { // insert_ipaddr(); if (event == 9) { put_string_center(140, 100, " exit cam app ", white); sleep(2); goto end; } cam_set(func); if(func == 2 || func == 3) { for(i =0 ; i <VFB_MAX ; i++) { if(i == get_MyLocation()) continue; if (strlen(ipaddr[i]) > 13) { sock[i] = tcp_client_connect(ipaddr[i], ip2port(ipaddr[i],8000)); if (sock[i] < 0) { fprintf(stderr, "%s connect error\n", ipaddr[i]); } } } tmp = 1 ; } event = 0; while(1) { #if DEBUG printf(" main loop start func is %d \n",func); #endif count = read(cam_fd, (unsigned char*)cam_data, image_size); if( count <0) { perror(" cam_data read err \n"); exit(1); } offset = 0; for (i =0 ; i <camif_cfg.dst_y ; i++) { for(j = 0 ; j < camif_cfg.dst_x; j++) { memcpy(&buf_pix,cam_data+offset, sizeof(unsigned short)); offset+= 2; tmp_color = reveres_pixel(buf_pix); buf_pixel(j,i,tmp_color); } } for (i=0; i<myicon_count; i++) draw_icon(&icon[i]); if(func == 1) { show_vfb(vfb_list[0]);// demo ver need change 0 to mylocation } else if (func == 2) { if (tmp ==0) break; send_data(func); show_vfb(vfb_list[0]);// demo ver need change 0 to mylocation } else if (func == 3) { if (tmp ==0) break; send_data(func); show_vfb(vfb_list[get_MyLocation()]);// demo ver need change 0 to mylocation } for (i=0; i<myicon_count; i++) draw_icon(&icon[i]); if (event == 9) { put_string_center(140, 100, " exit cam app ", white); sleep(2); goto end; } else if( event != 0 ) { break; } }// end while "main lool" write(cam_fd,"X",2); /* Stop Camera */ if (cam_fd) close(cam_fd); for(i =0 ; i< VFB_MAX; i++) { if(sock[i]) close(sock[i]); } //clear_all_screen(); } end: clear_screen(); // clear_all_screen(); thread_res= pthread_join(ts_thread, &thread_result); for(i =0 ; i< VFB_MAX; i++) { if(sock[i]) close(sock[i]); } if (cam_fd > 0) { write(cam_fd,"X",2); close(cam_fd); } if (cam_data >0) free(cam_data); myfb_close(); free_vfb_buf(VFB_MAX); return 0; }
/*! \brief Display menu * * This displays the party's list of items. * * \param ptr Location of the cursor * \param pg Item menu page number * \param sl 1 if selecting an action, 0 if selecting an item to use/drop */ static void draw_itemmenu(int ptr, int pg, int sl) { int z, j, k, a, ck; menubox(double_buffer, 72 + xofs, 12 + yofs, 20, 1, BLUE); print_font(double_buffer, 140 + xofs, 20 + yofs, _("Items"), FGOLD); menubox(double_buffer, 72 + xofs, 36 + yofs, 20, 1, BLUE); if (sl == 1) { menubox(double_buffer, item_act * 56 + 72 + xofs, 36 + yofs, 6, 1, DARKBLUE); print_font(double_buffer, 92 + xofs, 44 + yofs, _("Use"), FGOLD); print_font(double_buffer, 144 + xofs, 44 + yofs, _("Sort Drop"), FGOLD); } else { if (item_act == 0) { print_font(double_buffer, 148 + xofs, 44 + yofs, _("Use"), FGOLD); } else { print_font(double_buffer, 144 + xofs, 44 + yofs, _("Drop"), FGOLD); } } menubox(double_buffer, 72 + xofs, 60 + yofs, 20, 16, BLUE); for (k = 0; k < 16; k++) { // j == item index # j = g_inv[pg * 16 + k][0]; // z == quantity of item z = g_inv[pg * 16 + k][1]; draw_icon(double_buffer, items[j].icon, 88 + xofs, k * 8 + 68 + yofs); if (items[j].use >= USE_ANY_ONCE && items[j].use <= USE_CAMP_INF) { ck = FNORMAL; } else { ck = FDARK; } if (j == I_SSTONE && use_sstone == 0) { ck = FDARK; } print_font(double_buffer, 96 + xofs, k * 8 + 68 + yofs, items[j].name, ck); if (z > 1) { sprintf(strbuf, "^%d", z); print_font(double_buffer, 224 + xofs, k * 8 + 68 + yofs, strbuf, ck); } } menubox(double_buffer, 72 + xofs, 204 + yofs, 20, 1, BLUE); if (sl == 0) { a = strlen(items[g_inv[pg * 16 + ptr][0]].desc) * 4; print_font(double_buffer, 160 - a + xofs, 212 + yofs, items[g_inv[pg * 16 + ptr][0]].desc, FNORMAL); draw_sprite(double_buffer, menuptr, 72 + xofs, ptr * 8 + 68 + yofs); } draw_sprite(double_buffer, pgb[pg], 238 + xofs, 194 + yofs); }