Exemplo n.º 1
0
uint32_t crshrace_state::screen_update_crshrace(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	if (m_gfxctrl & 0x04)   /* display disable? */
	{
		bitmap.fill(m_palette->black_pen(), cliprect);
		return 0;
	}

	bitmap.fill(0x1ff, cliprect);



	switch (m_gfxctrl & 0xfb)
	{
		case 0x00:  /* high score screen */
			m_spr->draw_sprites(m_spriteram->buffer(), 0x2000,  screen, bitmap, cliprect);
			draw_bg(screen, bitmap, cliprect);
			draw_fg(screen, bitmap, cliprect);
			break;
		case 0x01:
		case 0x02:
			draw_bg(screen, bitmap, cliprect);
			draw_fg(screen, bitmap, cliprect);
			m_spr->draw_sprites(m_spriteram->buffer(), 0x2000,  screen, bitmap, cliprect);
			break;
		default:
			popmessage("gfxctrl = %02x", m_gfxctrl);
			break;
	}
	return 0;
}
UIEngagement::UIEngagement( 
	Engagement* e, Display* d, World* w  
) : Actor( std::string("ui_engagement_bg"), d, w ){
	name = std::string("UIEngagement");
	eng = e;
	width = 32*4;
	height = 32*4;
	tex = display->get_empty_texture( width, height );
	att = world->get_character_by_id( eng->attacker->id );
	vic = world->get_character_by_id( eng->victim->id );

	leftoffset = 0;
	topoffset = 0;
	tex10h = display->get_text_height( 10 );
	tex20h = display->get_text_height( 20 );

	int ay = _getmin( vic->gety(), att->gety() ) * display->th + world->camy;
	int ah = (_getmax( vic->gety(), att->gety() ) + 1) * display->th + world->camy - ay;

	x = display->width/2 - width/2;
	y = display->height/2 - height/2;

	if( ay >= y && ay <= y + height ){
		y = offset_y_by_eng_position( ay, ah );
	} else if( ay + ah > y && ay + ah < y + height ){
		y = offset_y_by_eng_position( ay, ah );
	}

	draw_bg();
	draw_hp();
	draw_hpbars();
}
Exemplo n.º 3
0
static void board_resized(void)
{
	GtkWidget *widget = g_object_get_data(G_OBJECT(main_win),
					      "drawingarea");
	int w = widget->allocation.width, h = widget->allocation.height;

	if (rvr_buf) {
		g_object_unref(rvr_buf);
		g_object_unref(blackpiece);
		g_object_unref(whitepiece);
		g_object_unref(mydot);
		g_object_unref(enemydot);
	}

	gtk_widget_realize(widget);
	rvr_buf = gdk_pixmap_new(widget->window, w, h, -1);
	gdk_draw_rectangle(rvr_buf, widget->style->black_gc, TRUE,
			   0, 0, w, h);

	PIXSIZE = MIN(w, h) / 8;

	/* Create the white piece, black piece, and dot images. */
	blackpiece = load_pixmap("black");
	whitepiece = load_pixmap("white");
	mydot = load_pixmap("dot");
	enemydot = load_pixmap("enemydot");

	draw_bg(widget);
	display_board();
}
Exemplo n.º 4
0
void ofApp::draw(){

    ofSetLineWidth(1);
    glPointSize(1);
    ofBackground(255);

    ofPushMatrix();

        if(bHandy){
            ofRotateZ(90.0);
            ofTranslate(0, -ofGetWindowWidth());
        }

        ofPushMatrix();
        ofTranslate(start_point);
        draw_bg();
        draw_wave();
        draw_audioStats();
        ofPopMatrix();
        draw_info();
    ofPopMatrix();

//    draw_vid();

}
void get_bgal_pod_positions()
{
	// screen size (scols,srows), box size (bxcols,bxcols), separator m pixels
	// random block positions p1, p2 set by function picks
	int srows=120,scols=160, bpos, ppos;
	graphics_close(); // close any existing graphics window
	display_clear();  // prep screen
	set_a_button_text("COUNTDOWN");	set_b_button_text("-"); set_c_button_text("-");
	graphics_open(scols,srows);
	graphics_fill(WHITE);
	bpos=rand()%2;
	if (bpos==0) ppos=1;
	else ppos=0;	
	// draw field
	graphics_rectangle(3,3,157,117,BLACK);        // outline
	graphics_rectangle(3,3,70,50,BLACK);          // quads
	graphics_rectangle(90,3,157,50,BLACK);
	graphics_rectangle(3,70,70,117,BLACK);
	graphics_rectangle(90,70,157,117,BLACK);
	graphics_rectangle_fill(70,3,90,50,LTBROWN);         // mesa
	graphics_rectangle(70,3,90,50,BLACK);
	graphics_rectangle_fill(70,70,90,117,LTBROWN);
	graphics_rectangle(70,70,90,117,BLACK); 
	graphics_rectangle_fill(72,50,88,70,LTGRAY);  // caldera
	graphics_rectangle(72,50,88,70,BLACK);
	graphics_rectangle_fill(20,3,25,50,TEAL);     // lines
	graphics_rectangle_fill(135,3,140,50,TEAL);
	graphics_rectangle_fill(20,70,25,117,PINK);
	graphics_rectangle_fill(135,70,140,117,PINK);	
	if (bpos==0) { 
		draw_bg(73,13,0.2);
		graphics_rectangle_fill(74,87,86,102,GREEN);
	}
	else {
		draw_bg(73,82,0.2);
		graphics_rectangle_fill(74,18,86,32,GREEN);
	}
	graphics_update();
	
	display_printf(2,0,"Set Botgal and Botpod ");
	
	while(a_button()==0);
	while(a_button()==1); // debounce
}
Exemplo n.º 6
0
void kissSplashBG(int w, int h)
{
	int i,offX,offY;
	for (i=0;i<h;i=i+(h/50)+1) {
		offX=38*(((float)i)/(float)(h/8));
		offY=50*(((float)i)/(float)(h/8));
		draw_bg(w/2-offX,h/2-offY,((float)i)/(float)(h/8));
		sleep(.02);
		clear_bg(w/2-offX,h/2-offY,((float)i)/(float)(h/8));
	}
	graphics_fill(255,255,255);
}
Exemplo n.º 7
0
void Level::draw(BITMAP *bmp)
{
//   textprintf(bmp, font, 0, 8, makecol(255, 255, 255), "%02fx%02f", m_scroll.x, m_scroll.y);

  clear_to_color(bmp, makecol(0, 180, 190));

  BITMAP *bg1 = MEDIA_BITMAP(BG_PCX);
  BITMAP *bg2 = MEDIA_BITMAP(BG2_PCX);
  BITMAP *bg3 = MEDIA_BITMAP(BG3_PCX);

  draw_bg(bmp, bg1, -m_scroll.x/3, m_h*TILE_H-m_scroll.y-bg1->h-8);
  draw_bg(bmp, bg2, -m_scroll.x/2, m_h*TILE_H-m_scroll.y-bg2->h);
  draw_bg(bmp, bg3, -m_scroll.x/4, -m_scroll.y);

  int i, j, x, y, outx, outy;
  int x1, y1, x2, y2;

  get_first_visible_tile(x1, y1);

  x2 = x1 + LEVEL_W;
  y2 = y1 + LEVEL_H;

  outy = static_cast<int>(-std::fmod(std::floor(m_scroll.y), TILE_H));
  for (y=y1; y<=y2; ++y) {
    outx = static_cast<int>(-std::fmod(std::floor(m_scroll.x), TILE_W));
    for (x=x1; x<=x2; ++x) {
      if (x < 0 || x >= m_w ||
	  y < 0 || y >= m_h) break;

      Tile bg = m_tiles_bg[y*m_w+x];
      Tile fg = m_tiles_fg[y*m_w+x];

      Level::draw_tile(bmp, bg, outx, outy);
      Level::draw_tile(bmp, fg, outx, outy);
      outx += TILE_W;
    }
    outy += TILE_W;
  }
}
Exemplo n.º 8
0
/**
 * Handle the drawing related tasks of the rollers
 * @param roller pointer to an object
 * @param mask the object will be drawn only in this area
 * @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
 *                                  (return 'true' if yes)
 *             LV_DESIGN_DRAW: draw the object (always return 'true')
 *             LV_DESIGN_DRAW_POST: drawing after every children are drawn
 * @param return true/false, depends on 'mode'
 */
static bool lv_roller_design(lv_obj_t * roller, const lv_area_t * mask, lv_design_mode_t mode)
{
    /*Return false if the object is not covers the mask_p area*/
    if(mode == LV_DESIGN_COVER_CHK) {
    	return false;
    }
    /*Draw the object*/
    else if(mode == LV_DESIGN_DRAW_MAIN) {
        draw_bg(roller, mask);

        lv_style_t *style = lv_roller_get_style(roller, LV_ROLLER_STYLE_BG);
        const lv_font_t * font = style->text.font;
        lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
        lv_coord_t font_h = lv_font_get_height_scale(font);
        lv_area_t rect_area;
        rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
        rect_area.y2 = rect_area.y1 + font_h + style->text.line_space;
        rect_area.x1 = roller->coords.x1;
        rect_area.x2 = roller->coords.x2;

        lv_draw_rect(&rect_area, mask, ext->ddlist.sel_style);
    }
    /*Post draw when the children are drawn*/
    else if(mode == LV_DESIGN_DRAW_POST) {
        lv_style_t *style = lv_roller_get_style(roller, LV_ROLLER_STYLE_BG);
        lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
        const lv_font_t * font = style->text.font;
        lv_coord_t font_h = lv_font_get_height_scale(font);

        /*Redraw the text on the selected area with a different color*/
        lv_area_t rect_area;
        rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - style->text.line_space / 2;
        rect_area.y2 = rect_area.y1 + font_h + style->text.line_space;
        rect_area.x1 = roller->coords.x1;
        rect_area.x2 = roller->coords.x2;
        lv_area_t mask_sel;
        bool area_ok;
        area_ok = lv_area_union(&mask_sel, mask, &rect_area);
        if(area_ok) {
            lv_style_t *sel_style = lv_roller_get_style(roller, LV_ROLLER_STYLE_SEL);
            lv_style_t new_style;
            lv_style_copy(&new_style, style);
            new_style.text.color = sel_style->text.color;
            new_style.text.opa = sel_style->text.opa;
            lv_draw_label(&ext->ddlist.label->coords, &mask_sel, &new_style,
                          lv_label_get_text(ext->ddlist.label), LV_TXT_FLAG_CENTER, NULL);
        }
    }

    return true;
}
Exemplo n.º 9
0
void	disp_game(t_data *data)
{
  if (data->player.real_pos.x >= 0 && data->player.real_pos.x
      <= END_GAME)
    draw_bg(data);
  move_player(data);
  if (data->player.real_pos.x >= 0 && data->player.real_pos.x
      <= END_GAME)
    {
      bunny_blit(&data->window->buffer, data->back.fence,
		 &data->back.pos_fence);
      bunny_blit(&data->window->buffer, data->back.tree2,
		 &data->back.pos_tree2);
    }
}
Exemplo n.º 10
0
uint32_t buggychl_state::screen_update_buggychl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	if (m_sky_on)
		draw_sky(bitmap, cliprect);
	else
		bitmap.fill(0x20, cliprect); // stage 3 disables sky, wants background pen to be blue

	draw_bg(bitmap, cliprect);

	draw_sprites(bitmap, cliprect);

	draw_fg(bitmap, cliprect);

	return 0;
}
Exemplo n.º 11
0
UINT32 buggychl_state::screen_update_buggychl(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	if (m_sky_on)
		draw_sky(bitmap, cliprect);
	else
		bitmap.fill(0, cliprect);

	if (m_bg_on)
		draw_bg(bitmap, cliprect);

	draw_sprites(bitmap, cliprect);

	draw_fg(bitmap, cliprect);

	return 0;
}
Exemplo n.º 12
0
void kissSimComputerDraw()
{
	int oriX=ksWindow.simWidth, oriY=0, i;
	static char digitals[]="0 0 0 0 0 0 0 0";
	static char buttons[]="0 0 0 0 0 0 0";
	static char analogs[11][10]={"         ","         ","         ","         ","         ","         ","         ","         ","         ","         ","         "};
	static char actuators[4][25]={"                        ","                        ","                        ","                        "};
	static char servos[4][25]={"                        ","                        ","                        ","                        "};
	if(!glfwGetWindowParam(GLFW_OPENED)) return;
	graphics_rectangle_fill(oriX,oriY,oriX+1,ksWindow.height,BLACK); // draw left border
	draw_bg(oriX+5,oriY+9,0.36); // Botguy
	NOBOLD g_printString(" CBC SIMULATOR",oriX+25, oriY+10,TEAL,1.0);
	NOBOLD g_printString("    DIGITALS  ",oriX+25, oriY+40,TEAL,1.0);
	NOBOLD g_printString("0 1 2 3 4 5 6 7",oriX+25, oriY+55,TEAL,1.0);
	NOBOLD g_printString("    BUTTONS  ",oriX+25, oriY+90,TEAL,1.0);
	//NOBOLD g_printString("< ^ V > A B .",oriX+30, oriY+105,TEAL,1.0);
	NOBOLD g_printString("\xb \xd \xe \xc A B .",oriX+30, oriY+105,TEAL,1.0);
    // hex b, c, d, e are left, right, up, and down arrows
	NOBOLD g_printString(digitals,oriX+25, oriY+70,WHITE,1.0); // erase old digital values
	NOBOLD g_printString("    ANALOGS  ",oriX+25, oriY+140,TEAL,1.0);
	for(i=0;i<8;i++){
		digitals[2*i]=48+digital(i);
	}
	NOBOLD g_printString(digitals,oriX+25, oriY+70,BLACK,1.0); // write new digital values
	NOBOLD g_printString(buttons,oriX+30, oriY+120,WHITE,1.0); // erase old button values
	buttons[0]=48+!!left_button();
	buttons[2]=48+!!up_button();
	buttons[4]=48+!!down_button();
	buttons[6]=48+!!right_button();
	buttons[8]=48+!!a_button();
	buttons[10]=48+!!b_button();
	_bob.button=!!kiss_get_key('.');
	buttons[12]=48+black_button();
	NOBOLD g_printString(buttons,oriX+30, oriY+120,BLACK,1.0); // erase old button values
	for(i=8;i<16;i++){//print out analogs
		analogs[i-8][1]=(i<10)?48+i:48+i-10;
		analogs[i-8][0]=(i<10)?32:49;
		analogs[i-8][2]=':';
		analogs[i-8][3]=' ';
		NOBOLD g_printString(analogs[i-8],oriX+5, oriY+155+(15*(i-8)),WHITE,1.0);
		convertNumToString(analog10(i),4,*analogs,10,i-8,3);
		graphics_rectangle_fill(oriX+30,oriY+155+(15*(i-8)),oriX+157, oriY+165+(15*(i-8)),GRAY);
		graphics_line(oriX+30+analog(i)/2, oriY+155+(15*(i-8)),oriX+30+analog(i)/2,oriY+165+(15*(i-8)),RED);
		NOBOLD g_printString(analogs[i-8],oriX+5, oriY+155+(15*(i-8)),BLACK,1.0);

	}
	analogs[8][1]='X';
	analogs[8][0]='A';
	analogs[8][2]=':';
	analogs[8][3]=' ';
	NOBOLD g_printString(analogs[8],oriX+5, oriY+155+(15*(8)),WHITE,1.0);
	convertNumToString(accel_x(),5,*analogs,10,8,3);
	graphics_rectangle_fill(oriX+30,oriY+155+(15*(8)),oriX+157, oriY+165+(15*(8)),GRAY);
	graphics_line(oriX+30+(accel_x()+2048)/32, oriY+155+(15*(8)),oriX+30+(accel_x()+2048)/32,oriY+165+(15*(8)),RED);
	NOBOLD g_printString(analogs[8],oriX+5, oriY+155+(15*(8)),BLACK,1.0);
	analogs[9][1]='Y';
	analogs[9][0]='A';
	analogs[9][2]=':';
	analogs[9][3]=' ';
	NOBOLD g_printString(analogs[9],oriX+5, oriY+155+(15*(9)),WHITE,1.0);
	convertNumToString(accel_y(),5,*analogs,10,9,3);
	graphics_rectangle_fill(oriX+30,oriY+155+(15*(9)),oriX+157, oriY+165+(15*(9)),GRAY);
	graphics_line(oriX+30+(accel_y()+2048)/32, oriY+155+(15*(9)),oriX+30+(accel_y()+2048)/32,oriY+165+(15*(9)),RED);
	NOBOLD g_printString(analogs[9],oriX+5, oriY+155+(15*(9)),BLACK,1.0);
	analogs[10][1]='Z';
	analogs[10][0]='A';
	analogs[10][2]=':';
	analogs[10][3]=' ';
	NOBOLD g_printString(analogs[10],oriX+5, oriY+155+(15*(10)),WHITE,1.0);
	convertNumToString(accel_z(),5,*analogs,10,10,3);
	graphics_rectangle_fill(oriX+30,oriY+155+(15*(10)),oriX+157, oriY+165+(15*(10)),GRAY);
	graphics_line(oriX+30+(accel_z()+2048)/32, oriY+155+(15*(10)),oriX+30+(accel_z()+2048)/32,oriY+165+(15*(10)),RED);
	NOBOLD g_printString(analogs[10],oriX+5, oriY+155+(15*(10)),BLACK,1.0);

	NOBOLD g_printString("MOT PWM TPS  ENCODER VAL",oriX+5, oriY+330,TEAL,1.0);
	for(i=0;i<4;i++){
		actuators[i][0]=48+i;
		actuators[i][1]=':';
		actuators[i][2]=' ';
		NOBOLD g_printString(actuators[i],oriX+5, oriY+345+(15*(i)),WHITE,1.0);
		convertNumToString(_bob.motor_pwm[i],4,*actuators,25,i,2);
		convertNumToString(_bob.motor_tps[i],4,*actuators,25,i,7);
		convertNumToString(_bob.motor_counter[i],10,*actuators,25,i,12);
		NOBOLD g_printString(actuators[i],oriX+5, oriY+345+(15*(i)),BLACK,1.0);
	}
	if(_bob.enable_servos){
		NOBOLD g_printString("SERVO TARGET DISABLED",oriX+5, oriY+410,WHITE,1.0);
		NOBOLD g_printString("SERVO TARGET ENABLED",oriX+5, oriY+410,TEAL,1.0);
	}
	else {
		NOBOLD g_printString("SERVO TARGET ENABLED",oriX+5, oriY+410,WHITE,1.0);
		NOBOLD g_printString("SERVO TARGET DISABLED",oriX+5, oriY+410,TEAL,1.0);
	}
	for(i=0;i<4;i++){
		servos[i][2]=49+i;//servos are 1 indexed!!
		servos[i][3]=':';
		servos[i][4]=' ';
		NOBOLD g_printString(servos[i],oriX+5, oriY+425+(15*(i)),WHITE,1.0);
		convertNumToString(_bob.servo_targets[i],4,*servos,25,i,6);
		NOBOLD g_printString(servos[i],oriX+5, oriY+425+(15*(i)),BLACK,1.0);
	}

}
Exemplo n.º 13
0
static void draw (SsdWidget widget, RoadMapGuiRect *rect, int flags) {


   RoadMapGuiPoint points[5];
   int count = 5;
#ifdef OPENGL
   RoadMapGuiPoint position;
   RoadMapGuiPoint sign_bottom, sign_top;
   static RoadMapImage focus_image;
#endif
   const char* background = widget->bg_color;


   if (!(flags & SSD_GET_SIZE)) {


      if (widget->in_focus && widget->focus_highlight )
		 background = "#b0d504";
      else if (widget->background_focus)
         background = "#8a8a8a";

      if (background) {
      	if (widget->flags & SSD_ROUNDED_CORNERS){
      		RoadMapGuiRect erase_rect;
			erase_rect.minx = rect->minx + SSD_ROUNDED_CORNER_WIDTH;
      		erase_rect.miny = rect->miny + SSD_ROUNDED_CORNER_HEIGHT;
      		erase_rect.maxx = rect->maxx - SSD_ROUNDED_CORNER_WIDTH;
      		erase_rect.maxy = rect->maxy - SSD_ROUNDED_CORNER_HEIGHT;

      		roadmap_canvas_select_pen (bg);
         	roadmap_canvas_set_foreground (background);
	        //roadmap_canvas_erase_area (&erase_rect);

  	  	 }
  	  	 else{
  	  	    if (!(widget->flags & SSD_DIALOG_TRANSPARENT)){

         	roadmap_canvas_select_pen (bg);
         	roadmap_canvas_set_foreground (background);
            if ((widget->flags & SSD_CONTAINER_TXT_BOX) || (widget->flags & SSD_CONTAINER_SEARCH_BOX)){
      			rect->minx += 10;
      			rect->maxx -= 10;
            }
            else
               roadmap_canvas_erase_area (rect);
#if defined(OPENGL) && !defined(_WIN32)
            if (widget->in_focus && widget->focus_highlight ){
               if (!focus_image)
                  focus_image = roadmap_res_get( RES_BITMAP, RES_SKIN, "focus" );

               if (focus_image){
                  sign_top.x = rect->minx;
                  sign_top.y = rect->miny;
                  position.x = roadmap_canvas_image_width(focus_image)/2;
                  position.y = roadmap_canvas_image_height(focus_image) / 2;
                  sign_bottom.x = rect->maxx;
                  sign_bottom.y = rect->maxy;
                  roadmap_canvas_draw_image_stretch( focus_image, &sign_top, &sign_bottom, &position, 0, IMAGE_NORMAL );
               }

            }
#endif
  	  	    }
  	  	 }
      }
      if ((widget->flags & SSD_SHADOW_BG) )
      {
            draw_shadow_bg();
      }

      if ((widget->flags & SSD_CONTAINER_TITLE) &&
    		  !(widget->flags & SSD_DIALOG_FLOAT) &&
    		  !(widget->flags & SSD_DIALOG_TRANSPARENT) )
      {
   			draw_bg(rect);
      }
   }



   if (widget->flags & SSD_CONTAINER_BORDER) {

      points[0].x = rect->minx + 1;
#ifndef TOUCH_SCREEN
      points[0].y = rect->miny + 1;
      points[1].y = rect->miny + 1;
      points[4].y = rect->miny + 1;
#else
	  points[0].y = rect->miny;
	  points[1].y = rect->miny;
      points[4].y = rect->miny ;
#endif
      points[1].x = rect->maxx - 0;
      points[2].x = rect->maxx - 0;
      points[2].y = rect->maxy - 0;
      points[3].x = rect->minx + 1;
      points[3].y = rect->maxy - 0;
      points[4].x = rect->minx + 1;


      if (!(flags & SSD_GET_SIZE)) {
         const char *color = default_fg;
	 RoadMapPosition *position = NULL;

         roadmap_canvas_select_pen (border);
         if (widget->fg_color) color = widget->fg_color;
         roadmap_canvas_set_foreground (color);

		 if (widget->flags & SSD_ROUNDED_CORNERS){
		 	int pointer_type = POINTER_NONE;
		 	int header_type = HEADER_NONE;
		 	int style = STYLE_NORMAL;
		 	int position_offset = widget->offset_y;

#ifdef TOUCH_SCREEN
			widget->flags &=  ~SSD_POINTER_MENU;
#endif
		 	if (widget->flags & SSD_POINTER_MENU){

		 		pointer_type = POINTER_MENU;
#ifndef OPENGL
		 		points[2].y -= 17;
#endif
		 	}

		 	else if (widget->flags & SSD_POINTER_COMMENT){
		 		pointer_type = POINTER_COMMENT;
#ifdef OPENGL
		 		points[2].y += 20;		/* The height of the pointer */
#else
		 		points[2].y -= 7;
#endif
		 	}
		 	else if (widget->flags & SSD_POINTER_NONE){
		 		pointer_type = POINTER_NONE;
		 		if (!((widget->flags & SSD_ROUNDED_WHITE) || (widget->flags & SSD_ROUNDED_BLACK)))
		 			points[2].y -= 10;
		 	}

		 	if (widget->in_focus  && widget->focus_highlight )
				background = "#b0d504";
         	else if ((widget->flags & SSD_POINTER_COMMENT) | (widget->flags & SSD_POINTER_MENU) |  (widget->flags & SSD_POINTER_NONE))
         		background = "#e4f1f9";
         	else
         		background = "#f3f3f5";

		 	background = "#d2dfef";
	 	   header_type = HEADER_NONE;

			if (widget->flags & SSD_ROUNDED_WHITE){
				style = STYLE_WHITE;
				if (widget->in_focus  && widget->focus_highlight )
					background = "#b0d504";
        		else
					background = "#ffffff";
			}

			if (widget->flags & SSD_ROUNDED_BLACK){
            style = STYLE_BLACK;
            if (widget->in_focus  && widget->focus_highlight )
               background = "#b0d504";
            else
               background = "#000000";
         }

			if (widget->flags & SSD_POINTER_LOCATION){
				if (widget->context != NULL){
					pointer_type = POINTER_POSITION;
					position = (RoadMapPosition *)widget->context;
					//position_offset = ADJ_SCALE(-40);
				}
			}

			if (widget->flags & SSD_POINTER_FIXED_LOCATION){
            if (widget->context != NULL){
               pointer_type = POINTER_FIXED_POSITION;
               position = (RoadMapPosition *)widget->context;
            }
         }

			roadmap_display_border(style, header_type, pointer_type, &points[2], &points[0], background, position, position_offset);

		 }
		 else
	        roadmap_canvas_draw_multiple_lines (1, &count, points, 1);
      }

	  if (widget->flags & SSD_ROUNDED_CORNERS){
	  	if (widget->flags & SSD_ROUNDED_WHITE){
	      	rect->minx += 4;
    	  	rect->miny += 4;
      		rect->maxx -= 4;
      		rect->maxy -= 4;
	  	}
	  	else{
			rect->minx += 10;
			if ((widget->flags & SSD_CONTAINER_TITLE) || (widget->flags & SSD_POINTER_MENU) ||  (widget->flags & SSD_POINTER_NONE))
      			rect->miny += 10;
      		else
      			rect->miny += 4;
      		rect->maxx -= 10;
      		rect->maxy -= 10;
	  	}
  	  }
	  else{
      	rect->minx += 2;
      	rect->miny += 2;
      	rect->maxx -= 2;
      	rect->maxy -= 2;
	  }

   }

   if (widget->flags & SSD_CONTAINER_TXT_BOX){
      	if (!(flags & SSD_GET_SIZE)){
      		if (background){
      			rect->minx -= 10;
      			rect->maxx += 10;
      		}
   			draw_text_box(widget, rect);
      	}
      	rect->minx += 20;
      	rect->miny += 10;
      	rect->maxx -= 20;
      	rect->maxy -= 10;

   }

   if (widget->flags & SSD_CONTAINER_SEARCH_BOX){
         if (!(flags & SSD_GET_SIZE)){
            if (background){
               rect->minx -= 10;
               rect->maxx += 10;
            }
            draw_search_box(widget, rect);
         }
         rect->minx += 20;
         rect->miny += 10;
         rect->maxx -= 20;
         rect->maxy -= 10;

   }
   if (widget->flags & SSD_CONTAINER_TITLE){
   		ssd_widget_set_left_softkey_text(widget, widget->left_softkey);
   		ssd_widget_set_right_softkey_text(widget, widget->right_softkey);
   }

   if ((flags & SSD_GET_CONTAINER_SIZE) &&
       (widget->flags & SSD_CONTAINER_TITLE)) {
      SsdWidget title;

      title = ssd_widget_get (widget, "title_bar");

      if (title) {
         SsdSize title_size;
         SsdSize max_size;
         max_size.width = rect->maxx - rect->minx + 1;
         max_size.height = rect->maxy - rect->miny + 1;

         ssd_widget_get_size (title, &title_size, &max_size);
         rect->miny += title_size.height;

      }

   }
}
Exemplo n.º 14
0
int RunSettingsMenu() {
	static int index = 0;
	static int spy = 72;
	int done = 0, y, i;

	g_dirty = 1;
	while (!done) {
		// Parse input
		readkey();
		if (parsekey(DINGOO_B))
			done = 1;

		if (parsekey(DINGOO_UP, 1)) {
			if (index > 0) {
				index--;
				spy -= 16;
			} else {
				index = 3;
				spy = 72 + 16*index;
			}
		}

		if (parsekey(DINGOO_DOWN, 1)) {
			if (index < 3) {
				index++;
				spy += 16;
			} else {
				index = 0;
				spy = 72;
			}
		}

		if (parsekey(DINGOO_A)) {
			done = settings_menu[index].command();
		}

		// Must draw bg only when needed
		// Draw stuff
		if (g_dirty) {
			draw_bg(g_bg);
			
			//Draw Top and Bottom Bars
			DrawChar(gui_screen, SP_SELECTOR, 0, 37);
			DrawChar(gui_screen, SP_SELECTOR, 81, 37);
			DrawChar(gui_screen, SP_SELECTOR, 0, 225);
			DrawChar(gui_screen, SP_SELECTOR, 81, 225);
			DrawText(gui_screen, "B - Go Back", 235, 225);
			DrawChar(gui_screen, SP_LOGO, 12, 9);
			
			// Draw selector
			DrawChar(gui_screen, SP_SELECTOR, 56, spy);
			DrawChar(gui_screen, SP_SELECTOR, 77, spy);

			DrawText(gui_screen, "Settings", 8, 37);

			// Draw menu
			for (i = 0, y = 72; i < 4; i++, y += 16) {
				DrawText(gui_screen, settings_menu[i].name, 60, y);
			}

			// Draw info
			DrawText(gui_screen, settings_menu[index].info, 8, 225);

			g_dirty = 0;
		}

		SDL_Delay(16);

		// Update real screen
		FCEUGUI_Flip();
	}

	// Must update emulation core and drivers
	UpdateEMUCore(g_config);
	FCEUD_DriverReset();

	// Clear screen
	dingoo_clear_video();

	g_dirty = 1;
}
Exemplo n.º 15
0
void FCEUGUI_Run() {
	static int index = 0;
	static int spy = 72;
	int done = 0, y, i;

	load_preview();

	g_dirty = 1;
	while (!done) {

		// Parse input
		readkey();
		if (parsekey(DINGOO_B))
			done = 1;

		if (parsekey(DINGOO_UP, 1)) {
			if (index > 0) {
				index--;
				spy -= 16;
			} else {
				index = 7;
				spy = 72 + 16*index;
			}
		}

		if (parsekey(DINGOO_DOWN, 1)) {
			if (index < 7) {
				index++;
				spy += 16;
			} else {
				index = 0;
				spy = 72;
			}
		}

		if (parsekey(DINGOO_A)) {
			done = main_menu[index].command();
			if(index == 3) load_preview();
		}

		if (index == 3 || index == 4) {
			if (parsekey(DINGOO_RIGHT, 1)) {
				if (g_slot < 9) {
					g_slot++;
					FCEUI_SelectState(g_slot, 0);
					load_preview();
				}
			}

			if (parsekey(DINGOO_LEFT, 1)) {
				if (g_slot > 0) {
					g_slot--;
					FCEUI_SelectState(g_slot, 0);
					load_preview();
				}
			}
		}

		// Must draw bg only when needed
		// Draw stuff
		if (g_dirty) {
			draw_bg(g_bg);
			
			//Draw Top and Bottom Bars
			DrawChar(gui_screen, SP_SELECTOR, 0, 37);
			DrawChar(gui_screen, SP_SELECTOR, 81, 37);
			DrawChar(gui_screen, SP_SELECTOR, 0, 225);
			DrawChar(gui_screen, SP_SELECTOR, 81, 225);
			DrawText(gui_screen, "B - Go Back", 235, 225);
			DrawChar(gui_screen, SP_LOGO, 12, 9);
			
			// Draw selector
			DrawChar(gui_screen, SP_SELECTOR, 56, spy);
			DrawChar(gui_screen, SP_SELECTOR, 77, spy);

			if (index == 3 || index == 4) {
				// Draw state preview
				DrawChar(gui_screen, SP_PREVIEWBLOCK, 184, 73);
				draw_preview((unsigned short *)gui_screen->pixels, 185, 100);
				if (!g_ispreview)
					DrawChar(gui_screen, SP_NOPREVIEW, 207, 135);
			}

			if (index == 5) {
				DrawChar(gui_screen, SP_PREVIEWBLOCK, 184, 73);
				draw_shot_preview((unsigned short *)gui_screen->pixels, 185, 100);
			}

			DrawText(gui_screen, "Now Playing:", 8, 37);
			DrawText(gui_screen, g_romname, 96, 37);

			// Draw menu
			for (i = 0, y = 72; i < 8; i++, y += 16) {
				DrawText(gui_screen, main_menu[i].name, 60, y);
			}

			// Draw info
			DrawText(gui_screen, main_menu[index].info, 8, 225);

			// If save/load state render slot preview and number
			if (index == 3 || index == 4) {
				char tmp[32];
				sprintf(tmp, "Slot %d", g_slot);
				DrawText(gui_screen, tmp, 212, 80);

				if (g_slot > 0)
					DrawChar(gui_screen, SP_LEFTARROW, 197, 83);
				if (g_slot < 9)
					DrawChar(gui_screen, SP_RIGHTARROW, 259, 83);
			}

			// If screenshot render current frame preview
			if (index == 5) {
				DrawText(gui_screen, "Preview", 207, 80);
			}

			g_dirty = 0;
		}

		SDL_Delay(16);

		// Update real screen
		FCEUGUI_Flip();
	}

	g_psdl = FCEUD_GetPaletteArray16();

	// Clear screen
	dingoo_clear_video();
}
Exemplo n.º 16
0
/* TODO: Add color */
static int screen_clear(lua_State *L) {
  Screen *screen;
  screen = check_screen(L, -1);
  draw_bg(screen, screen->colors.grey);
  return 0;
}
Exemplo n.º 17
0
void draw_bar_screen_full(void)
{
    draw_bg();
    draw_blue_bar_full(red_val);
    draw_red_bar_full(blue_val);
}
Exemplo n.º 18
0
int RunFileBrowser(char *source, char *outname, const char *types[],
		const char *info) {

	int size = 0;
	int index;
	int offset_start, offset_end;
	static int max_entries = 8;
	int scrollModifier = 4;
	int justsavedromdir = 0;
	int scrollMult;

	static int spy;
	int y, i;
	
	// Try to get a saved romdir from a config file
	char* home = getenv("HOME");
	char romcfgfile [128];
	sprintf (romcfgfile, "%s/.fceux/romdir.cfg", home);
	FILE * pFile;
	pFile = fopen (romcfgfile,"r+");
	if (pFile != NULL) {
		fgets (s_LastDir , 128 , pFile);
		fclose (pFile);
	}

	// Create file list
	FileList *list = new FileList(source ? source : s_LastDir, types);
	if (list == NULL)
		return 0;

	
	scrollModifier *= max_entries;

	RESTART:

	spy = 72;

	size = list->Size();

	index = 0;
	offset_start = 0;
	offset_end = size > max_entries ? max_entries : size;

	

	g_dirty = 1;
	while (1) {
		// Parse input
		readkey();
		// TODO - put exit keys

		// Go to previous folder or return ...
		if (parsekey(DINGOO_B)) {
			list->Enter(-1);
			goto RESTART;
		}

		// Enter folder or select rom ...
		if (parsekey(DINGOO_A)) {
			if (list->GetSize(index) == -1) {
				list->Enter(index);
				goto RESTART;
			} else {
				strncpy(outname, list->GetPath(index), 128);
				break;
			}
		}

		if (parsekey(DINGOO_X)) {
			return 0;
		}
		
		if (parsekey(DINGOO_SELECT)) {
			// Save the current romdir in a config file
			char* home = getenv("HOME");
			char romcfgfile [128];
			strncpy(s_LastDir, list->GetCurDir(), 128);
			sprintf (romcfgfile, "%s/.fceux/romdir.cfg", home);
			FILE * pFile;
			pFile = fopen (romcfgfile,"w+");
			fputs (s_LastDir,pFile);
			fclose (pFile);
			justsavedromdir = 1;
		}

		if (size > 0) {
			// Move through file list

			if (parsekey(DINGOO_R, 0)) {
				index = size - 1;
				spy = 72 + 15*(max_entries-1);
				offset_end = size;
				offset_start = offset_end - max_entries;
			}

			if (parsekey(DINGOO_L, 0)) {
				goto RESTART;
			}

			if (parsekey(DINGOO_UP, 1)) {
				if (index > offset_start){
					index--;
					spy -= 15;
				} else if (offset_start > 0) {
					index--;
					offset_start--;
					offset_end--;
				} else {
					index = size - 1;
					offset_end = size;
					offset_start = size <= max_entries ? 0 : offset_end - max_entries;
					spy = 72 + 15*(index - offset_start);
				}
			}

			if (parsekey(DINGOO_DOWN, 1)) {
				if (index < offset_end - 1){
					index++;
					spy += 15;
				} else if (offset_end < size) {
					index++;
					offset_start++;
					offset_end++;
				} else {
					index = 0;
					offset_start = 0;
					offset_end = size <= max_entries ? size : max_entries;
					spy = 72;
				}
			}

			if (parsekey(DINGOO_LEFT, 1)) {
				if (index > offset_start) {
					index = offset_start;

					spy = 72;

				} else if (index - scrollModifier >= 0){
						index -= scrollModifier;
						offset_start -= scrollModifier;
						offset_end = offset_start + max_entries;
				} else
					goto RESTART;
			}

			if (parsekey(DINGOO_RIGHT, 1)) {
				if (index < offset_end-1) {
					index = offset_end-1;

					spy = 72 + 15*(index-offset_start);

				} else if (offset_end + scrollModifier <= size) {
						index += scrollModifier;
						offset_end += scrollModifier;
						offset_start += scrollModifier;
				} else {
					index = size - 1;
					spy = 72 + 15*(max_entries-1);
					offset_end = size;
					offset_start = offset_end - max_entries;
				}
			}
		}

		// Draw stuff
		if (g_dirty) {
			draw_bg(g_bg);
			
			//Draw Top and Bottom Bars
			DrawChar(gui_screen, SP_SELECTOR, 0, 37);
			DrawChar(gui_screen, SP_SELECTOR, 81, 37);
			DrawChar(gui_screen, SP_SELECTOR, 0, 225);
			DrawChar(gui_screen, SP_SELECTOR, 81, 225);
			DrawText(gui_screen, "B - Go Back", 235, 225);
			DrawChar(gui_screen, SP_LOGO, 12, 9);
			
			// Draw selector
			DrawChar(gui_screen, SP_SELECTOR, 4, spy);
			DrawChar(gui_screen, SP_SELECTOR, 81, spy);

			DrawText(gui_screen, "ROM Browser", 8, 37);

			// Draw file list
			for (i = offset_start, y = 72; i < offset_end; i++, y += 15) {
				DrawText(gui_screen, list->GetName(i), 8, y);
			}

			// Draw info
			if (info)
				DrawText(gui_screen, info, 8, 225);
			else {
				if (justsavedromdir == 1){
					DrawText(gui_screen, "ROM dir successfully saved!", 8, 225);
				} else {
					if (list->GetSize(index) == -1)
						DrawText(gui_screen, "SELECT - Save ROM dir", 8, 225);
					else
						DrawText(gui_screen, "SELECT - Save ROM dir", 8, 225);
				}
				justsavedromdir = 0;
			}

			// Draw offset marks
			if (offset_start > 0)
				DrawChar(gui_screen, SP_UPARROW, 157, 57);
			if (offset_end < list->Size())
				DrawChar(gui_screen, SP_DOWNARROW, 157, 197);

			g_dirty = 0;
		}

		SDL_Delay(4);

		// Update real screen
		FCEUGUI_Flip();
		
	}

	if (source == NULL)
		strncpy(s_LastDir, list->GetCurDir(), 128);
	delete list;

	return 1;
}
int RunMainSettings()
{
    static int index = 0;
    static int spy = 74;
    int done = 0, y, i;

    int max_entries = 8;
#ifdef FRAMESKIP
    int menu_size = 12;
#else
    int menu_size = 11;
#endif

    static int offset_start = 0;
    static int offset_end = menu_size > max_entries ? max_entries : menu_size;

    char tmp[32];
    int  itmp;

    g_dirty = 1;
    while (!done) {
    	// Get time and battery every second
        if (update_time()) {
	         update_battery();
	        g_dirty = 1;
        }

        // Parse input
        readkey();
        if (parsekey(DINGOO_B)) done = 1;
    	if (parsekey(DINGOO_UP, 1)) {
	    	if (index > 0) {
	    	 	index--; 

                if (index >= offset_start) spy -= 15;

                if ((offset_start > 0) && (index < offset_start)) {
                    offset_start--;
                    offset_end--;
                }
	    	}
	    }
    	
    	if (parsekey(DINGOO_DOWN, 1)) {
       	    if (index < (menu_size-1)) {
    	        index++;

                if (index < offset_end) spy += 15;

                if ((offset_end < menu_size) && (index >= offset_end)) {
                    offset_end++;
                    offset_start++;
                }
      	    }
    	}

        if (parsekey(DINGOO_LEFT, 1) || parsekey(DINGOO_RIGHT, 1) || parsekey(DINGOO_A))
       	    st_menu[index].update(g_key);
  
        // Draw stuff
        if( g_dirty ) 
        {
    	    draw_bg(vbuffer, g_bg);

            DrawChar(vbuffer, SP_MAIN_SETTINGS, 40, 38); 

    	    // Draw time and battery every minute
        	DrawText(vbuffer, g_time, 148, 5);
            DrawText(vbuffer, g_battery, 214, 5);	
	
        	// Draw menu
           	for(i=offset_start,y=70;i < offset_end;i++,y+=15) {
        	    DrawText(vbuffer, st_menu[i].name, 60, y);
    	
        	    g_config->getOption(st_menu[i].option, &itmp);
#ifdef FRACTIONAL_FRAMESKIP
                if (!strncmp(st_menu[i].name, "Frameskip", 8)) {
            		int j;
            		if (itmp > 3) itmp = 3;
            		for (j=0;j<4;j++) if (itmp == frame_tag[j].val) break;
            		strcpy(tmp, frame_tag[j].str);
        	    }
        	    else 
#endif
                if (!strncmp(st_menu[i].name, "Custom palette", 6)) {
                    std::string palname;
                    g_config->getOption(st_menu[i].option, &palname);
                
                    // Remove path of string
                    const int sz = static_cast<int>(palname.size());
                    const int path_sz = palname.rfind("/",palname.size());

                    if (path_sz == sz) strncpy(tmp, palname.c_str(), 32);
                    else strncpy(tmp, palname.substr(path_sz + 1,sz - 1 - path_sz).c_str(), 32);                 
                }
                else
    	            sprintf(tmp, "%d", itmp);
    	        DrawText(vbuffer, tmp, 210, y);
            }

    	    // Draw info
        	DrawText(vbuffer, st_menu[index].info, 16, 225);

	        // Draw selector 
	        DrawChar(vbuffer, SP_SELECTOR, 44, spy);

            // Draw offset marks
            if (offset_start > 0 ) DrawChar(vbuffer, SP_UPARROW, 274, 62);
            if (offset_end < menu_size) DrawChar(vbuffer, SP_DOWNARROW, 274, 203);

            g_dirty = 0;
        }

        dingoo_timer_delay(16);
        
        // Update real screen
        memcpy(dingoo_screen15, vbuffer, 320*240*sizeof(unsigned short));
    }    
    
    g_dirty = 1;
    return 0;
}
Exemplo n.º 20
0
void display_board(void)
{
	int i, x, y;
	GtkWidget *tmp;
	GdkPixbuf *piece = NULL;
	GtkStyle *style;
	GtkWidget *white_label;
	GtkWidget *black_label;
	char score[29];

	tmp = g_object_get_data(G_OBJECT(main_win), "drawingarea");
	style = gtk_widget_get_style(main_win);

	draw_bg(main_win);

	for (i = 0; i < 64; i++) {
		if (game.board[i] == BLACK) {
			piece = blackpiece;
		} else if (game.board[i] == WHITE) {
			piece = whitepiece;
		} else if (game_check_move(game.turn, i)) {
			if (game.turn == game.num) {
				piece = mydot;
			} else if (game.turn == -game.num) {
				piece = enemydot;
			} else {
				continue;
			}
		} else {
			continue;
		}

		x = (X(i) - 1) * PIXSIZE;
		y = (Y(i) - 1) * PIXSIZE;

		if (i == game.last_move) {
			/* if last move, mark it (draw using a different
			 * background). */
			gdk_draw_rectangle(rvr_buf, last_gc, TRUE,
					   x + 1, y + 1, PIXSIZE - 2,
					   PIXSIZE - 2);
		}
		gdk_draw_pixbuf(rvr_buf, pix_gc, piece,
				0, 0, x + 1, y + 1,
				PIXSIZE - 2, PIXSIZE - 2,
				GDK_RGB_DITHER_NONE, 0, 0);
	}

	if (game.state == RVR_STATE_PLAYING && game.turn == game.num)
		game_status("It's your turn!");
	else if (game.state == RVR_STATE_PLAYING && game.turn == -game.num)
		game_status("Wait for your oponnents turn");

	// Update the scores
	white_label = g_object_get_data(G_OBJECT(main_win), "white_label");
	black_label = g_object_get_data(G_OBJECT(main_win), "black_label");
	sprintf(score, "White(%s): %d", game.names[PLAYER2SEAT(WHITE)],
		game.white);
	gtk_label_set_text(GTK_LABEL(white_label), score);
	sprintf(score, "Black(%s): %d", game.names[PLAYER2SEAT(BLACK)],
		game.black);
	gtk_label_set_text(GTK_LABEL(black_label), score);


	gtk_widget_queue_draw(tmp);
}
Exemplo n.º 21
0
int RunControlSettings()
{
	static int index = 0;
	static int spy = 72;
	int done = 0, y, i;
	int err = 1;
	int editMode = 0;

	g_dirty = 1;
	while (!done) {
		// Parse input
		readkey();
		if (parsekey(DINGOO_SELECT)) {
			editMode = 1;
			DrawText(gui_screen, ">>", 185, spy);
			g_dirty = 0;
		}

		if (!editMode) {
			if (parsekey(DINGOO_A)) {
				if (index == 4) {
					cm_menu[index].update(g_key);
				}
			}
			if (parsekey(DINGOO_B)) {
				//ERROR CHECKING
				int iBtn1 = -1;
				int iBtn2 = -1;
				err = 1;
				for ( int i = 0; i < 4; i++ ) {
					for ( int y = 0; y < 4; y++ ) {
						g_config->getOption(cm_menu[i].option, &iBtn1);
						if (i != y) {
							g_config->getOption(cm_menu[y].option, &iBtn2);
							if (iBtn1 == iBtn2) {
								err = 0;
								g_dirty = 1;
							}
							
						}
					}
				}

				done= err;
			}
		}	
		if ( !editMode ) {
	   		if (parsekey(DINGOO_UP, 1)) {
				if (index > 0) {
					index--; 
					spy -= 15;
				} else {
					index = CONTROL_MENUSIZE - 1;
					spy = 72 + 15*index;
				}
			}

			if (parsekey(DINGOO_DOWN, 1)) {
				if (index < CONTROL_MENUSIZE - 1) {
					index++;
					spy += 15;
				} else {
					index = 0;
					spy = 72;
				}
			}
		}

		if ( editMode ) {
			if (parsekey(DINGOO_A, 0) || parsekey(DINGOO_B, 0) || parsekey(DINGOO_X, 0) || parsekey(DINGOO_Y, 0)) {
				cm_menu[index].update(g_key);
				g_dirty = 1;
				editMode = 0;
			}
		}
  
		// Draw stuff
		if( g_dirty ) 
		{
			draw_bg(g_bg);
			
			//Draw Top and Bottom Bars
			DrawChar(gui_screen, SP_SELECTOR, 0, 37);
			DrawChar(gui_screen, SP_SELECTOR, 81, 37);
			DrawChar(gui_screen, SP_SELECTOR, 0, 225);
			DrawChar(gui_screen, SP_SELECTOR, 81, 225);
			DrawText(gui_screen, "B - Go Back", 235, 225);
			DrawChar(gui_screen, SP_LOGO, 12, 9);
			
			// Draw selector
			DrawChar(gui_screen, SP_SELECTOR, 56, spy);
			DrawChar(gui_screen, SP_SELECTOR, 77, spy);
			if (err == 0) {
				DrawText(gui_screen, "!!!Error - Duplicate Key Mapping!!! ", 8, 37);
			} else {
				DrawText(gui_screen, "Control Settings - Press select to edit", 8, 37);
			}

			// Draw menu
			for(i=0,y=72;i < CONTROL_MENUSIZE;i++,y+=15) {
				int iBtnVal = -1;
				char cBtn[32];

				DrawText(gui_screen, cm_menu[i].name, 60, y);
				
				g_config->getOption(cm_menu[i].option, &iBtnVal);
				
				if (i == CONTROL_MENUSIZE-1)
					sprintf(cBtn, "%s", "");
				else if (iBtnVal == DefaultGamePad[0][0])
					sprintf(cBtn, "%s", "GCW_A");
				else if (iBtnVal == DefaultGamePad[0][1])
					sprintf(cBtn, "%s", "GCW_B");
				else if (iBtnVal == DefaultGamePad[0][8])
					sprintf(cBtn, "%s", "GCW_Y");
				else if (iBtnVal == DefaultGamePad[0][9])
					sprintf(cBtn, "%s", "GCW_X");
				else
					sprintf(cBtn, "%s", "<empty>");


				DrawText(gui_screen, cBtn, 210, y);
				
			}

			// Draw info
			DrawText(gui_screen, cm_menu[index].info, 8, 225);

			g_dirty = 0;
		}

		SDL_Delay(16);
		
		// Update real screen
		FCEUGUI_Flip();
	}	

	// Clear screen
	dingoo_clear_video();

	g_dirty = 1;
	return 0;
}
Exemplo n.º 22
0
void s32_console_print_char(Console *console, u8 ch)
{

    if (console->type == GRAPHIC_CONSOLE)
    {
        //BOCHS_MB
        //draw_char(console->cur_x, console->cur_y, ch);
        draw_8x16_ch(console->cur_x, console->cur_y, ch, 5);
        console->cur_x += 8;
        if (console->cur_x >= 320)
        {
            console->cur_x = 0;
            console->cur_y += 16;
        }
#if 1
        if (ch == '`')
        {
            static u8 odd=0;
            extern u8 bg_raw_data[];
            extern int bg_w;
            extern int bg_h;
            extern u8 palette_data[];

            extern u8 os_bg_raw_data[];
            extern int os_bg_w;
            extern int os_bg_h;
            extern u8 os_palette_data[];
            draw_256_grid();
            switch (odd)
            {
            case 0:
            {
                draw_bg(120, 0, bg_raw_data, bg_w, bg_h, palette_data);
                break;
            }
            case 1:
            {
                draw_bg(0, 0, os_bg_raw_data, os_bg_w, os_bg_h, os_palette_data);
                break;
            }
            case 2:
            {
                draw_bg(0, 0, pe_320_180_256_bmp, pe_320_180_256_wb, pe_320_180_256_hb, pe_320_180_256_palette_data);
                break;
            }
            }
            odd = (odd+1) % 3;
        }
#endif
        return;
    }

    u8 *console_vb = (u8*)console->cur_vm;
    u32 vm = console->vm_start;
    //u8 *console_vb = (u8*)(0xb8000);
    //s32_put_char(ch, (u8*)(0xb8000+160*19));
    //if (console->cur_y >= ((VIDEO_RAM_SIZE/4000) * 25) )
    if (console->cur_y >= 50)
        return;

    switch (ch)
    {
    case '\r':
        console->cur_x = 0;
        break;
    case '\n':
        ++console->cur_y;
        break;
    case 0x20 ... 0x7e: // ascii printable char. gnu extension: I don't want use gnu extension, but it is very convenience.
        //*console_vb = ch;
        //*(console_vb+1) = (text_fg|text_bg);
        *((u8 *)(vm + (console->cur_x + console->cur_y * 80)*2)) = ch;
        *((u8 *)(vm + (console->cur_x + console->cur_y * 80)*2)+1) = 7; // WHITE
        ++console->cur_x;
        if (console->cur_x >= 80)
        {
            console->cur_x = 0;
            ++console->cur_y;
        }
        break;
    default:
        break;
    }
    console_vb = (console->cur_x + console->cur_y*80)*2 + console->vm_start;

    if (console->cur_y >= 25 )
        set_video_start_addr(80*(console->cur_y - 24));
    set_cursor((console->vm_start - 0xb8000)/2 + console->cur_x + console->cur_y * 80);
    console->cur_vm = (u32)console_vb;
}
int RunSettingsMenu()
{
    static int index = 0;
    static int spy = 80;
    int done = 0, y, i;

    g_dirty = 1;
    while (!done) {
	    // Get time and battery every second
        if (update_time()) {
    	    update_battery();
	        g_dirty = 1;
        }

        // Parse input
        readkey();
        if (parsekey(DINGOO_B)) done = 1;
         
        if (parsekey(DINGOO_UP, 1)) {
	        if (index > 0) {
	        	index--; 
       			spy -= 16;
    	    }
	    } 

	    if (parsekey(DINGOO_DOWN, 1)) {
	        if (index < 3) {
	            index++;  
	            spy += 16;
   		    } 
    	}

   		if (parsekey(DINGOO_A)) {
    	    done = settings_menu[index].command();
        }

	    // Must draw bg only when needed  
        // Draw stuff 
        if( g_dirty )  
        {
	        draw_bg(vbuffer, g_bg);

            // Draw time and battery every minute
    	    DrawText(vbuffer, g_time, 148, 5); 
            DrawText(vbuffer, g_battery, 214, 5);	

            DrawChar(vbuffer, SP_SETTINGS, 40, 38); 
	
	        // Draw menu 
	        for(i=0,y=76;i < 4;i++,y+=16) {
	           DrawText(vbuffer, settings_menu[i].name, 50, y);
            }
 
	        // Draw info
        	DrawText(vbuffer, settings_menu[index].info, 16, 225);

	        // Draw selector
	        DrawChar(vbuffer, SP_SELECTOR, 34, spy);
    
            g_dirty = 0;
        }

        dingoo_timer_delay(16);

        // Update real screen
        memcpy(dingoo_screen15, vbuffer, 320*240*sizeof(unsigned short));
    }      

    // Must update emulation core and drivers
    UpdateEMUCore(g_config);     
    FCEUD_DriverReset();

    g_dirty = 1;
}
Exemplo n.º 24
0
int RunSoundSettings() {
	static int index = 0;
	static int spy = 72;
	int done = 0, y, i;

	int max_entries = 8;
	int menu_size = 10;

	static int offset_start = 0;
	static int offset_end = menu_size > max_entries ? max_entries : menu_size;

	char tmp[32];
	int itmp;

	g_dirty = 1;
	while (!done) {
		// Parse input
		readkey();
		if (parsekey(DINGOO_B))
			done = 1;
		if (parsekey(DINGOO_UP, 1)) {
			if (index > 0) {
				index--;

				if (index >= offset_start)
					spy -= 15;

				if ((offset_start > 0) && (index < offset_start)) {
					offset_start--;
					offset_end--;
				}
			} else {
				index = menu_size-1;
				offset_end = menu_size;
				offset_start = menu_size <= max_entries ? 0 : offset_end - max_entries;
				spy = 72 + 15*(index - offset_start);
			}
		}

		if (parsekey(DINGOO_DOWN, 1)) {
			if (index < (menu_size - 1)) {
				index++;

				if (index < offset_end)
					spy += 15;

				if ((offset_end < menu_size) && (index >= offset_end)) {
					offset_end++;
					offset_start++;
				}
			} else {
				index = 0;
				offset_start = 0;
				offset_end = menu_size <= max_entries ? menu_size : max_entries;
				spy = 72;
			}
		}

		if (parsekey(DINGOO_RIGHT, 1) || parsekey(DINGOO_LEFT, 1))
			sd_menu[index].update(g_key);

		// Draw stuff
		if (g_dirty) {
			draw_bg(g_bg);
			
			//Draw Top and Bottom Bars
			DrawChar(gui_screen, SP_SELECTOR, 0, 37);
			DrawChar(gui_screen, SP_SELECTOR, 81, 37);
			DrawChar(gui_screen, SP_SELECTOR, 0, 225);
			DrawChar(gui_screen, SP_SELECTOR, 81, 225);
			DrawText(gui_screen, "B - Go Back", 235, 225);
			DrawChar(gui_screen, SP_LOGO, 12, 9);
			
			// Draw selector
			DrawChar(gui_screen, SP_SELECTOR, 56, spy);
			DrawChar(gui_screen, SP_SELECTOR, 77, spy);

			DrawText(gui_screen, "Sound Settings", 8, 37);

			// Draw menu
			for (i = offset_start, y = 72; i < offset_end; i++, y += 15) {
				DrawText(gui_screen, sd_menu[i].name, 60, y);

				g_config->getOption(sd_menu[i].option, &itmp);
				sprintf(tmp, "%d", itmp);

				DrawText(gui_screen, tmp, 210, y);
			}

			// Draw info
			DrawText(gui_screen, sd_menu[index].info, 8, 225);

			// Draw offset marks
			if (offset_start > 0)
				DrawChar(gui_screen, SP_UPARROW, 218, 57);
			if (offset_end < menu_size)
				DrawChar(gui_screen, SP_DOWNARROW, 218, 197);

			g_dirty = 0;
		}

		SDL_Delay(16);

		// Update real screen
		FCEUGUI_Flip();
	}

	// Clear screen
	dingoo_clear_video();

	g_dirty = 1;
	return 0;
}
Exemplo n.º 25
0
static void gba_draw_bg_mode0 (void)
{

//   goto show_tiles;

   RETRO_PERFORMANCE_INIT(draw_bgs_procs);
   RETRO_PERFORMANCE_START(draw_bgs_procs);

   sceGuEnable(GU_BLEND);
   sceGuBlendFunc(GU_ADD,GU_SRC_ALPHA,GU_ONE_MINUS_SRC_ALPHA,0xFFFFFFFF,0xFFFFFFFF);
//   sceGuEnable(GU_DEPTH_TEST);
   sceGuDepthMask(GU_FALSE);
   sceGuDepthFunc(GU_GEQUAL);
//   sceGuDisable(GU_BLEND);
   //BG0


   if (gba_video_registers->lcd_control.screen_display_BG3)
      draw_bg(&gba_video_registers->BG3_control, &gba_video_registers->BG3_scroll);
   if (gba_video_registers->lcd_control.screen_display_BG2)
      draw_bg(&gba_video_registers->BG2_control, &gba_video_registers->BG2_scroll);
   if (gba_video_registers->lcd_control.screen_display_BG1)
      draw_bg(&gba_video_registers->BG1_control, &gba_video_registers->BG1_scroll);
   if (gba_video_registers->lcd_control.screen_display_BG0)
      draw_bg(&gba_video_registers->BG0_control, &gba_video_registers->BG0_scroll);

   RETRO_PERFORMANCE_STOP(draw_bgs_procs);

   RETRO_PERFORMANCE_INIT(draw_sprites_proc);
   RETRO_PERFORMANCE_START(draw_sprites_proc);
//   draw_sprites_old();
//   sceGuClutMode(GU_PSM_5551,0,0xFF,32);
   draw_sprites();
   RETRO_PERFORMANCE_STOP(draw_sprites_proc);




   return;

show_tiles:

   sceGuTexMode(GU_PSM_T16, 0, 0, GU_TRUE);
   sceGuClutMode(GU_PSM_5551,0,0xFF,0);
   sceGuClutLoad(32, palette_ram);
   sceGuDisable(GU_BLEND);

   sceGuEnable(GU_TEXTURE_2D);
   sceGuTexFunc(GU_TFX_REPLACE,GU_TCC_RGB);
//   sceGuClutMode(GU_PSM_4444,0,0xFF,0);
//   sceGuClutLoad(32, index_copy_clut);

   if (show_4bit_tilemap)
   {
      sceGuTexImage(0, 256, 256, 256, ((u16*)GBA_VRAMTEXTURE_4bit)
            + 256 * 256 * tilemap_offset);

      sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT |
            GU_TRANSFORM_2D, 2, NULL,(void*)frame_256_256);
   }
   else
   {
      sceGuTexImage(0, 128, 256, 128, ((u16*)GBA_VRAMTEXTURE_8bit)
            + 128 * 256 * tilemap_offset);

      sceGuDrawArray(GU_SPRITES, GU_TEXTURE_16BIT | GU_VERTEX_16BIT |
            GU_TRANSFORM_2D, 2, NULL,(void*)frame_128_256);
   }




}