/* ypos is used only when pos == STATUSBAR_POS_MIDDLE */ STATUSBAR_REC *statusbar_create(int pos, int ypos) { STATUSBAR_REC *rec; rec = g_new0(STATUSBAR_REC, 1); statusbars = g_slist_append(statusbars, rec); rec->pos = pos; rec->line = pos == STATUSBAR_POS_MIDDLE ? ypos : mainwindows_reserve_lines(1, pos == STATUSBAR_POS_UP); rec->ypos = pos == STATUSBAR_POS_MIDDLE ? ypos : pos == STATUSBAR_POS_UP ? rec->line : LINES-1-rec->line; if (pos == STATUSBAR_POS_UP) { if (sbars_up == 0) sbar_uppest = rec->line; sbars_up++; rec->line -= sbar_uppest; } else if (pos == STATUSBAR_POS_DOWN) { if (sbars_down == 0) sbar_lowest = rec->line; sbars_down++; rec->line -= sbar_lowest; } set_bg(stdscr, settings_get_int("statusbar_background") << 4); move(rec->ypos, 0); clrtoeol(); set_bg(stdscr, 0); return rec; }
static void statusbar_topic(SBAR_ITEM_REC *item, int ypos) { CHANNEL_REC *channel; QUERY_REC *query; char *str, *topic; if (item->size != COLS-2) { /* get all space for topic */ statusbar_item_resize(item, COLS-2); return; } move(ypos, item->xpos); set_bg((1<<4)+7); clrtoeol(); set_bg(0); if (active_win == NULL) return; topic = NULL; channel = irc_item_channel(active_win->active); query = irc_item_query(active_win->active); if (channel != NULL && channel->topic != NULL) topic = channel->topic; if (query != NULL && query->address != NULL) topic = query->address; if (topic != NULL) { topic = strip_codes(topic); str = g_strdup_printf("%.*s", item->size, topic); set_color((1<<4)+15); addstr(str); g_free(str); g_free(topic); } screen_refresh(); }
static void statusbar_topic(SBAR_ITEM_REC *item, int ypos) { CHANNEL_REC *channel; QUERY_REC *query; char *str, *topic; if (item->size != COLS-2) { /* get all space for topic */ statusbar_item_resize(item, COLS-2); return; } move(ypos, item->xpos); set_bg(stdscr, settings_get_int("statusbar_background") << 4); clrtoeol(); set_bg(stdscr, 0); if (active_win == NULL) return; topic = NULL; channel = CHANNEL(active_win->active); query = QUERY(active_win->active); if (channel != NULL && channel->topic != NULL) topic = channel->topic; if (query != NULL && query->address != NULL) topic = query->address; if (topic != NULL) { topic = strip_codes(topic); str = g_strdup_printf("%.*s", item->size, topic); set_color(stdscr, sbar_color_normal); addstr(str); g_free(str); g_free(topic); } screen_refresh(NULL); }
t_bunny_response mainloop(void *_data) { t_data *data; data = (t_data *)_data; display_pos(data); dtraverse(data->tool, display_button, data); start(data); set_color_tool(data); set_bg(data->sup->pixarray, WHITE); dtraverse(data->sup->calc, add_calc, data); display_it(data, data->pixback, 78, 2); display_it(data, data->sup->pixarray, data->sup->pos.x, data->sup->pos.y); display_it(data, data->swatch.pix, WIN_WIDTH - 260, 5); display_it(data, data->swatch.pix2, WIN_WIDTH - 260, 112); display_it(data, data->pixinfo, 0, WIN_HEIGHT - 20); set_bg(data->pixinfocolor, data->tools.color.full); display_it(data, data->pixinfocolor, 7, WIN_HEIGHT - 87); display_it(data, data->square.pix_square, data->square.init_pos.x, data->square.init_pos.y); display_text(data, data->crs.tool, 10, WIN_HEIGHT - 18); display_pos(data); bunny_display(data->window); dtraverse(data->sup->calc, check_button_calc, data); draw(data); return (GO_ON); }
void load_trainer_bg(u8 gender) { if (gender) { // girl set_bg(2, (u8 *)&hero2_tiles, (u8 *)hero2_map, (u8 *)hero2_pal, 0, 0x20); } else { // boy set_bg(2, (u8 *)&hero1_tiles, (u8 *)hero1_map, (u8 *)hero1_pal, 0, 0x20); } }
void statusbar_redraw(STATUSBAR_REC *bar) { if (bar == NULL) { statusbar_redraw_all(); return; } set_bg(stdscr, settings_get_int("statusbar_background") << 4); move(bar->ypos, 0); clrtoeol(); set_bg(stdscr, 0); statusbar_redraw_line(bar); }
static void panel_style_set(GtkWidget *widget, GtkStyle *s, panel *p) { ENTER; gtk_rc_parse_string(transparent_rc); if (GTK_WIDGET_REALIZED(widget)) set_bg(widget, p); RET(); }
static gboolean panel_configure_event(GtkWidget *widget, GdkEventConfigure *event, panel *p) { static gint x = 0, y = 0, width = 0, height = 0; ENTER; if (x == event->x && y == event->y && width == event->width && height == event->height) RET(FALSE); x = event->x; y = event->y; width = event->width; height = event->height; set_bg(widget, p); RET(FALSE); }
void init_render(struct xinfo *X, struct panel *P) { bbwidth = P->width; bbheight = P->theme->height; bb = imlib_create_image(bbwidth, bbheight); bbcolor = imlib_create_image(bbwidth, bbheight); imlib_context_set_image(bb); imlib_image_set_has_alpha(1); bbdpy = X->display; bbvis = X->visual; bbwin = P->win; bbcm = X->colmap; bbx = P->x; bby = P->y; rootpmap = &X->rootpmap; theme = P->theme; imlib_context_set_display(bbdpy); imlib_context_set_visual(bbvis); imlib_context_set_colormap(bbcm); #ifdef WITH_COMPOSITE if (P->theme->use_composite) { XRenderPictFormat *fmt = XRenderFindStandardFormat(bbdpy, PictStandardARGB32); bbalpha = imlib_create_image(bbwidth, bbheight); pixcolor = XCreatePixmap(bbdpy, bbwin, bbwidth, bbheight, 32); pixalpha = XCreatePixmap(bbdpy, bbwin, bbwidth, bbheight, 32); piccolor = XRenderCreatePicture(bbdpy, pixcolor, fmt, 0, 0); picalpha = XRenderCreatePicture(bbdpy, pixalpha, fmt, 0, 0); XRenderPictureAttributes pwin; pwin.subwindow_mode = IncludeInferiors; rootpic = XRenderCreatePicture(bbdpy, bbwin, XRenderFindVisualFormat(bbdpy, bbvis), CPSubwindowMode, &pwin); } else #endif if (*rootpmap) { update_bg(); } else { set_bg(); } imlib_context_set_blend(0); imlib_context_set_operation(IMLIB_OP_COPY); }
void fb_rgb332_boxto(uint16_t x2,uint16_t y2) { uint16_t x1 = framebuffer->cursor_x; uint16_t y1 = framebuffer->cursor_y; int x,y; uint8_t *p; framebuffer->cursor_x = x2; framebuffer->cursor_y = y2; fb_sanitize_box(&x1,&y1,&x2,&y2); fb_rgb332_update_damage(x1,y1,x2,y2); for(y=y1; y<=y2; y++){ p = & fb_rgb332->mem[x1 + framebuffer->width * y]; for(x=x1;x<=x2;x++){ set_bg(p); if(y==y1 || y==y2 || x==x1 || x==x2) /* border */ set_fg(p); p++; } } }
static GdkFilterReturn panel_wm_events(GdkXEvent *xevent, GdkEvent *event, panel *p) { Atom at; Window win; XEvent *ev = (XEvent *) xevent; ENTER; DBG("win = 0x%x\n", ev->xproperty.window); if ( ev->type != PropertyNotify ) RET(GDK_FILTER_CONTINUE); at = ev->xproperty.atom; win = ev->xproperty.window; if (win == GDK_ROOT_WINDOW()) { if (at == a_XROOTPMAP_ID) { bg_rootbg_changed(); set_bg(p->topgwin, p); gtk_widget_queue_draw(p->topgwin); DBG("a_XROOTPMAP_ID\n"); } } RET(GDK_FILTER_CONTINUE); }
static void lcd_test(cyg_addrword_t p) { int i, pix, row, col; int on; diag_printf("LCD test here\n"); lcd_init(16); #if 0 for (i = 0; i < 16; i++) { on = true; diag_printf("Fill with 0x%x\n", i); for (row = 0; row < 240; row++) { for (col = 0; col < 320/2; col++) { if (on) { fp->pixels[row][col] = RGB_RED(i)|RGB_GREEN(i)|RGB_BLUE(i); } else { fp->pixels[row][col] = 0xFFFF; } } for (col = 320/2; col < 320; col++) { if (!on) { fp->pixels[row][col] = RGB_RED(i)|RGB_GREEN(i)|RGB_BLUE(i); } else { fp->pixels[row][col] = 0xFFFF; } } if ((row & 0x0F) == 0x0F) { if (on) { on = false; } else { on = true; } } } cyg_thread_delay(100); } #endif #if 0 for (i = 0; i < 4; i++) { for (row = 0; row < 240; row++) { for (col = 0; col < 320; col++) { switch (row/40) { case 0: pix = col / 20; // 0..15 fp->pixels[row][col] = RGB_RED(pix); break; case 1: pix = col / 10; // 0..31 fp->pixels[row][col] = RGB_GREEN(pix); break; case 2: pix = col / 20; // 0..15 fp->pixels[row][col] = RGB_BLUE(pix); break; case 3: pix = col / 20; // 0..15 fp->pixels[row][col] = RGB_BLUE(pix) | RGB_GREEN(pix); break; case 4: pix = col / 20; // 0..15 fp->pixels[row][col] = RGB_BLUE(15) | RGB_GREEN(pix); break; case 5: fp->pixels[row][col] = 0xFFFF; break; } } } cyg_thread_delay(100); #if 0 for (row = 0; row < 240; row++) { for (col = 0; col < 320; col++) { pix = col / 20; // 0..15 switch (row/60) { case 0: fp->pixels[row][col] = RGB_RED(pix); break; case 1: fp->pixels[row][col] = RGB_GREEN(pix); break; case 2: fp->pixels[row][col] = RGB_BLUE(pix); break; case 3: fp->pixels[row][col] = 0xFFFF; break; } } } cyg_thread_delay(100); #endif #if 0 on = true; for (row = 0; row < 240; row++) { for (col = 0; col < 320/2; col++) { if (on) { fp->pixels[row][col] = RGB_GREEN(15); } else { fp->pixels[row][col] = RGB_BLUE(8); } } for (col = 320/2; col < 320; col++) { if (!on) { fp->pixels[row][col] = RGB_GREEN(15); } else { fp->pixels[row][col] = RGB_BLUE(8); } } if ((row & 0x0F) == 0x0F) { if (on) { on = false; } else { on = true; } } } #endif } #endif #if 0 for (row = 0; row < 240; row++) { for (col = 0; col < 320; col++) { if (col == 59) { fp->pixels[row][col] = 0x0000; } else { fp->pixels[row][col] = 0xFFFF; } } } cyg_thread_delay(100); #endif #if 0 for (i = 0; i < 16; i++) { diag_printf("Value 0x%04x\n", (1<<i)); for (row = 0; row < 240; row++) { for (col = 0; col < 320; col++) { fp->pixels[row][col] = (1<<i); } } cyg_thread_delay(500); } #endif #if 0 for (i = 0; i < 32; i++) { diag_printf("Red at %d\n", i); for (row = 0; row < 240; row++) { for (col = 0; col < 320; col++) { fp->pixels[row][col] = RGB_RED(i); } } cyg_thread_delay(100); } #endif #if 0 for (i = 0; i < 64; i++) { diag_printf("Green at %d\n", i); for (row = 0; row < 240; row++) { for (col = 0; col < 320; col++) { fp->pixels[row][col] = RGB_GREEN(i); } } cyg_thread_delay(100); } #endif #if 0 for (i = 0; i < 32; i++) { diag_printf("BLUE at %d\n", i); for (row = 0; row < 240; row++) { for (col = 0; col < 320; col++) { fp->pixels[row][col] = RGB_BLUE(i); } } cyg_thread_delay(100); } #endif while (true) { for (i = 0; i < 1; i++) { show_xpm(redboot_xpm); cyg_thread_delay(15); show_xpm(eCos_xpm); cyg_thread_delay(25); show_xpm(redboot_xpm); cyg_thread_delay(15); show_xpm(redhat_xpm); cyg_thread_delay(25); show_xpm(redboot_xpm); cyg_thread_delay(25); show_xpm(redboot_xpm); cyg_thread_delay(15); show_xpm(escw_xpm); cyg_thread_delay(25); show_xpm(redboot_xpm); cyg_thread_delay(15); show_xpm(eCos2_xpm); cyg_thread_delay(25); show_xpm(redboot_xpm); cyg_thread_delay(15); show_xpm(redhat2_xpm); cyg_thread_delay(25); show_xpm(logo_xpm); cyg_thread_delay(25); show_xpm(redboot_xpm); cyg_thread_delay(50); } #if 0 // This doesn't seem to do anything on my unit assabet_BCR(SA1110_BCR_MOTOR, SA1110_BCR_MOTOR_ON); cyg_thread_delay(2*100); assabet_BCR(SA1110_BCR_MOTOR, SA1110_BCR_MOTOR_OFF); #endif show_xpm(redboot_xpm); cyg_thread_delay(15); lcd_clear(); lcd_printf("\n\n**** Hello world!\n"); cyg_thread_delay(5); for (i = 0; i < 64; i++) { lcd_printf("... testing line #%d\n", i); } cyg_thread_delay(50); show_xpm(redboot_xpm); cyg_thread_delay(15); set_bg(0,0,0); set_fg(31,63,0); lcd_clear(); for (i = 0; i < 32; i++) { lcd_printf("... testing line #%d\n", i); } cyg_thread_delay(50); } // while lcd_clear(); lcd_printf("*****"); cyg_thread_delay(200); cyg_test_exit(); }
void battle_ground_make() { task_exec(); objc_exec(); obj_sync_something(); //tilemaps_sync(); switch (superstate.multipurpose_state_tracker) { case 0: { temp_vars.var_8001 = 0; /*// REG_DISPCNT setup REG_DISPCNT.mode = 2; REG_DISPCNT.GBC_mode = 0; REG_DISPCNT.frame_select = 0; REG_DISPCNT.hblank_oam_process = 0; REG_DISPCNT.sprite_tile_mapping = 0; //2d or 3d mapping REG_DISPCNT.screen_blank = 0; REG_DISPCNT.BG0_enable = 1; REG_DISPCNT.BG1_enable = 1; REG_DISPCNT.BG2_enable = 1; REG_DISPCNT.BG3_enable = 0; REG_DISPCNT.sprite_enable = 1; REG_DISPCNT.win0_enable = 0; REG_DISPCNT.win1_enable = 0; REG_DISPCNT.oam_win_enable = 0; temp_vars.var_8000 = *DISPCNT; // REG_BGCNT u8 i; for (i = 0; i < 4; i ++) { BG_CNT[i].priority = i; BG_CNT[i].char_index = i; BG_CNT[i].padding = 0; BG_CNT[i].mosiac = 0; BG_CNT[i].color = 0; BG_CNT[i].map_index = (0x1F - i); BG_CNT[i].screen_over = 0; BG_CNT[i].size = 0; } BG_CNT[1].color = 1; lcd_io_set(0x50, 0x2F00); lcd_io_set(0x52, 0x0F);*/ test(); superstate.multipurpose_state_tracker++; break; } case 1: { // load VRAM BG background u8 bg_config_data[16] = {0xF0, 0x11, 0x0, 0x0, 0xE5, 0x09, 0x0, 0x0, 0xDA, 0x21, 0x0, 0x0, 0xCF, 0x31, 0x0, 0x0}; void bg_vram_setup(u8, u8 *, u8); // mode, setup, amount of bgs to config bg_vram_setup(0, (u8 *)&bg_config_data, 4); set_bg(0, (u8 *)sky_tiles, (u8 *)sky_map, (u8 *)sky_pal, 6, 32); set_bg(1, (u8 *)tree_tiles, (u8 *)tree_map, (u8 *)tree_pal, 0, 160); superstate.multipurpose_state_tracker++; break; } case 2: { // wtb better clouds task_add(sky_scroll, 0x1); superstate.multipurpose_state_tracker++; break; } case 3: { void gpu_bg_config_set_field(u8, u8, u8); gpu_bg_config_set_field(0, 5, 1); superstate.multipurpose_state_tracker++; break; } case 4: { make_player(0); make_opponent(0); superstate.multipurpose_state_tracker++; break; } case 5: { player_char_movement(); break; } case 99: { // waitstate + next command buffer player_movement_buffer(); break; } default: break; }; }