Example #1
0
/***************************************************************************

  Draw the game screen in the given osd_bitmap.
  Do NOT call osd_update_display() from this function, it will be called by
  the main emulation engine.

***************************************************************************/
void vigilant_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh)
{
	int i;


	if (rear_disable)	 /* opaque foreground */
	{
		for (i = 0;i < 8;i++)
			palette_used_colors[256 + 16*i] = PALETTE_COLOR_USED;
	}
	else
	{
		for (i = 0;i < 8;i++)
			palette_used_colors[256 + 16*i] = PALETTE_COLOR_TRANSPARENT;
	}


	/* copy the background palette */
	for (i = 0;i < 16;i++)
	{
		int r,g,b;


		r = (paletteram[0x400 + 16 * rear_color + i] << 3) & 0xFF;
		g = (paletteram[0x500 + 16 * rear_color + i] << 3) & 0xFF;
		b = (paletteram[0x600 + 16 * rear_color + i] << 3) & 0xFF;

		palette_change_color(512 + i,r,g,b);

		r = (paletteram[0x400 + 16 * rear_color + 32 + i] << 3) & 0xFF;
		g = (paletteram[0x500 + 16 * rear_color + 32 + i] << 3) & 0xFF;
		b = (paletteram[0x600 + 16 * rear_color + 32 + i] << 3) & 0xFF;

		palette_change_color(512 + 16 + i,r,g,b);
	}

	if (palette_recalc())
	{
		fast_memset(dirtybuffer,1,videoram_size);
		rear_refresh = 1;
	}

	if (rear_disable)	 /* opaque foreground */
	{
		draw_foreground(bitmap,0,1);
		draw_sprites(bitmap);
		draw_foreground(bitmap,1,1);
	}
	else
	{
		draw_background(bitmap);
		draw_foreground(bitmap,0,0);
		draw_sprites(bitmap);
		draw_foreground(bitmap,1,0); 
	}
}
Example #2
0
static void draw_lineitem(char* name,char* value)
{
	if((current_lineitem < scroll_offset+10)&&(current_lineitem>=scroll_offset))
	{
		draw_background(current_lineitem-scroll_offset,current_lineitem);
		draw_text_8x6(10,45+(current_lineitem-scroll_offset)*18,name,255,255,0);
		draw_text_8x6(80,45+(current_lineitem-scroll_offset)*18,value,255,0,255);
	}
	current_lineitem++;
}
Example #3
0
void scope_paint(t_scope *x, t_object *view)
{
    t_rect rect;
    ebox_get_rect_for_view((t_ebox *)x, &rect);
    draw_background(x, view, &rect);
    if(x->f_mode)
        draw_signalXY(x, view, &rect);
    else
        draw_signal(x, view, &rect);
}
Example #4
0
UINT32 welltris_state::screen_update_welltris(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
	m_char_tilemap->set_scrollx(0, m_scrollx);
	m_char_tilemap->set_scrolly(0, m_scrolly);

	draw_background(bitmap, cliprect);
	m_char_tilemap->draw(screen, bitmap, cliprect, 0, 0);
	m_spr_old->turbofrc_draw_sprites(m_spriteram, m_spriteram.bytes(), m_spritepalettebank, machine(), bitmap, cliprect, screen.priority(), 0);
	return 0;
}
void hoa_gain_paint(t_hoa_gain *x, t_object *view)
{
    t_rect rect;
    char isHoriz;
    jbox_get_rect_for_view((t_object *)x, view, &rect);
    isHoriz = hoa_gain_ishorizontal(x, &rect);
    draw_background(x, view, &rect, isHoriz);
    draw_cursor(x, view, &rect, isHoriz);
    draw_valuerect(x, view, &rect, isHoriz);
}
Example #6
0
void
draw_water()
{
	float get_arena_alpha(void);
	float texture_max_u, texture_max_v;

	render_background_to_texture();

	glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
	glPushMatrix();
	set_modelview_rotation();
	draw_background(gc.cur_level, get_arena_alpha(), 1);
	glPopMatrix();

#if 1
	texture_max_u = texture_max_v = 1.f;

	/* arena stencil */
	glPushAttrib(GL_ALL_ATTRIB_BITS);

	glEnable(GL_STENCIL_TEST);
	glClear(GL_STENCIL_BUFFER_BIT);

	glStencilFunc(GL_ALWAYS, 1, 1);
	glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE);
	glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
	glDisable(GL_CULL_FACE);

	draw_filled_arena(cur_arena);

	glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
	glEnable(GL_STENCIL_TEST);
	glStencilFunc(GL_EQUAL, 1, 1);
	glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);

	/* finally, the water */
	draw_water_grid(texture_max_u, texture_max_v);

	glPopAttrib();
#else
	glEnable(GL_TEXTURE_2D);
	glBindTexture(GL_TEXTURE_2D, backg_texture_id);

	glBegin(GL_QUADS);
	glTexCoord2f(0, 0);
	glVertex2f(-WATER_QUAD_RADIUS, -WATER_QUAD_RADIUS);
	glTexCoord2f(1, 0);
	glVertex2f(WATER_QUAD_RADIUS, -WATER_QUAD_RADIUS);
	glTexCoord2f(1, 1);
	glVertex2f(WATER_QUAD_RADIUS, WATER_QUAD_RADIUS);
	glTexCoord2f(0, 1);
	glVertex2f(-WATER_QUAD_RADIUS, WATER_QUAD_RADIUS);
	glEnd();
#endif
}
static gboolean
on_tick (MateBGCrossfade *fade)
{
	gdouble now, percent_done;
	cairo_t *cr;
	cairo_status_t status;

	g_return_val_if_fail (MATE_IS_BG_CROSSFADE (fade), FALSE);

	now = get_current_time ();

	percent_done = (now - fade->priv->start_time) / fade->priv->total_duration;
	percent_done = CLAMP (percent_done, 0.0, 1.0);

	/* If it's taking a long time to get to the first frame,
	 * then lengthen the duration, so the user will get to see
	 * the effect.
	 */
	if (fade->priv->is_first_frame && percent_done > .33) {
		fade->priv->is_first_frame = FALSE;
		fade->priv->total_duration *= 1.5;
		return on_tick (fade);
	}

	if (fade->priv->fading_surface == NULL ||
	    fade->priv->end_surface == NULL) {
		return FALSE;
	}

	if (animations_are_disabled (fade)) {
		return FALSE;
	}

	/* We accumulate the results in place for performance reasons.
	 *
	 * This means 1) The fade is exponential, not linear (looks good!)
	 * 2) The rate of fade is not independent of frame rate. Slower machines
	 * will get a slower fade (but never longer than .75 seconds), and
	 * even the fastest machines will get *some* fade because the framerate
	 * is capped.
	 */
	cr = cairo_create (fade->priv->fading_surface);

	cairo_set_source_surface (cr, fade->priv->end_surface,
				  0.0, 0.0);
	cairo_paint_with_alpha (cr, percent_done);

	status = cairo_status (cr);
	cairo_destroy (cr);

	if (status == CAIRO_STATUS_SUCCESS) {
		draw_background (fade);
	}
	return percent_done <= .99;
}
Example #8
0
static void
canvas_repaint_proc()
{
    /*fprintf(stderr,"repaint()\n");/*CMP*/
    if (!vsi.canvas){
	return;
    }

    draw_background();
    draw_curve();
}
void hoa_scope_paint(t_hoa_scope *x, t_object *view)
{
    t_rect rect;
    ebox_get_rect_for_view((t_ebox *)x, &rect);

    x->f_center = rect.width * .5;
    x->f_radius = x->f_center * 0.95;

    draw_background(x, view, &rect);
    draw_harmonics(x, view, &rect);
}
Example #10
0
void element_if::do_draw(mat3 const& vp_matrix)
{
    mat3 new_vp_matrix = vp_matrix * child_to_parent_matrix();

    draw_background(new_vp_matrix);
    draw(new_vp_matrix);
    for (auto& child_ptr : _children)
    {
        child_ptr->do_draw(new_vp_matrix);
    }
}
Example #11
0
static gboolean draw_event (GtkWidget * widget, cairo_t * cr, GtkWidget * area)
{

    draw_background (widget, cr);
    draw_visualizer (widget, cr);
#if 0
    draw_grid (widget, cr);
#endif

    return TRUE;
}
Example #12
0
static void dsp_tilde_paint(t_dsp_tilde *x, t_object *view)
{
    t_rect rect;
    if(!x->f_init)
    {
        x->f_state = sys_getdspstate();
        x->f_init = 1;
    }
    
    ebox_get_rect_for_view((t_ebox *)x, &rect);
    draw_background(x, view, &rect);
}
Example #13
0
/*! \brief Draws the navigation on the screen.
 */
static bool draw_navigation(int offset_x, int offset_y)
{
  if(ram_files[DISK_NAV_IMAGE].start_addr)
  {
    draw_background(DISK_NAV_IMAGE, offset_x, offset_y);
  }
  else
  {
    et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, (et024006_color_t)APPLI_BG_COLOR);
  }
  return true;
}
Example #14
0
static void
draw(game_state *state, SDL_Surface *screen)
{
    switch_state_data *data = state->data->switch_data;

    draw_background(screen);

    if (HAS_DEBUG)
        debug_draw_space(data->space, screen);

    SDL_Flip(screen);
}
Example #15
0
int main (int argc, char **argv)
{
  char options[1000];
  int i;
  char gamename[255];

  //create options string for later passing to runtime
  options[0] = '\0';
  if(argc > 1) {
    for(i=1;i<argc;i++) {
      strcat(options, argv[i]);
      strcat(options, " ");
    }
  }

  frontend_init();

  /* Initialize list of available games */
  game_list_init_nocache();

  while(1)
  {
    fe_S9xInitInputDevices();

    //Initialise SDL input after each game run
    initSDL();

    if (game_num_avail==0)
    {
      /* Draw background image */
      draw_background();
      fe_gamelist_text_out(35, 110, "ERROR: NO AVAILABLE GAMES FOUND",color16(255,255,255));
      frontend_display();
      sleep(5);
      fe_exit();
    }

    /* Select Game */
    select_game(playgame);

    //Quit SDL input before starting Game
    SDL_Quit();

    //Run the actual game
    //Using system seems to work better with snes9x
    sprintf(gamename, "./snes9x %s \"roms/%s\"", options, playgame);
    system(gamename);

    usleep(500000);

  }

}
static gint
timeout (C2NetworkTraffic *nt)
{
	gint current_recv, current_send, record;
	gint seconds_to_display; /* This is a dynamic value, the
							  * SECONDS_TO_DISPLAY constant
							  * is about how much we WISH to
							  * display, not how much we WILL
							  * display.
							  */
	GtkWidget *widget = GTK_WIDGET (nt);

	seconds_to_display = widget->allocation.width / PIXELS_PER_SECOND;

	current_recv = c2_net_speed_tracker_recv ();
	current_send = c2_net_speed_tracker_send ();

	if (g_slist_length (nt->recv) > seconds_to_display)
		nt->recv = g_slist_remove_link (nt->recv, g_slist_last (nt->recv));
	nt->recv = g_slist_prepend (nt->recv, (gpointer) current_recv);

	if (g_slist_length (nt->send) > seconds_to_display)
		nt->send = g_slist_remove_link (nt->send, g_slist_last (nt->send));
	nt->send = g_slist_prepend (nt->send, (gpointer) current_send);

	/* Update the maximum speed */
	record = current_send > current_recv ? current_send : current_recv;
	if (record > nt->top_speed)
		nt->top_speed = record;
	else
	{
		GSList *l;

		nt->top_speed = 1024;

		for (l = nt->send; l; l = g_slist_next (l))
			if (GPOINTER_TO_INT (l->data) > nt->top_speed)
				nt->top_speed = GPOINTER_TO_INT (l->data);
		for (l = nt->recv; l; l = g_slist_next (l))
			if (GPOINTER_TO_INT (l->data) > nt->top_speed)
				nt->top_speed = GPOINTER_TO_INT (l->data);
	}

	/* Time to draw */
	draw_background (nt);
	draw_top_speed (nt);
	draw_list (nt, nt->send);
	draw_list (nt, nt->recv);
	draw_screen (nt);
	
	return TRUE;
}
Example #17
0
File: engine.c Project: gsrr/Python
/**	Completely draws the screen during game.
 *
 * 	The usleep() function interrupts the program for 'n' microseconds.
 * 	It was difficult to get a stable value for the game progression.
 *
 *	@note This is the main function of this file because it shows
 * 	      logically how the process of drawing the screen sould be
 */
void engine_show_screen ()
{
	draw_background ();
	draw_borders ();
	draw_fruit ();
	draw_player ();
	draw_fruit_bonus();
	draw_score ();

	usleep (REFRESH_DELAY);

	refresh();
}
Example #18
0
void display()
{
        glClearColor(0, 0, 0, 1);
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
        int w = glutGet(GLUT_WINDOW_WIDTH);
        int h = glutGet(GLUT_WINDOW_HEIGHT);
        glMatrixMode(GL_MODELVIEW);
        glLoadIdentity();
        gluPerspective(5.0, w/h, 0.1, 100.0);
        gluLookAt(0, 0, 50, 0, 0, 40, 0, 1, 0);       
        draw_background(texture);
        glutSwapBuffers();
}
void hoa_meter_paint(t_hoa_meter *x, t_object *view)
{
	t_rect rect;
	ebox_get_rect_for_view((t_ebox *)x, &rect);
	
    x->f_center = rect.width * .5;
	x->f_radius = x->f_center * 0.95;
	x->f_radius_center = x->f_radius / 5.;
	
	draw_background(x, view, &rect);
    draw_leds(x, view, &rect);
    draw_vectors(x, view, &rect);
}
Example #20
0
/*! \brief Draw the play view.
 * Draws all elements in the play view.
 *
 * \param offset_x X offset of the picture.
 * \param offset_y Y offset of the picture.
 */
static bool draw_play_view(int offset_x, int offset_y)
{
  // draw background if available
  if(ram_files[AUDIO_PLAYER_IMAGE].start_addr)
  {
    draw_background(AUDIO_PLAYER_IMAGE, offset_x, offset_y);
  }
  else
  {
    et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, BLACK);
  }
  return true;
}
Example #21
0
File: main.c Project: tthimm/c_sim
void draw(SDL_Surface *screen, int *mouse_x, int *mouse_y, struct Player *p, SDL_Surface *text, TTF_Font *font, SDL_Color color, int sv_msg, SDL_Surface *save_message) {
	draw_background(screen);
	draw_all_tiles(screen);
	draw_text(p, screen, text, font, color);
	if(sv_msg) {
		draw_save_msg(p, screen, save_message, font, color);
	}
	draw_player(screen, p);
	draw_cursor(screen, mouse_x, mouse_y);

	SDL_Flip(screen);
	SDL_Delay(1);
}
Example #22
0
static void
tweet_overlay_constructed (GObject *gobject)
{
  TweetOverlayPrivate *priv = TWEET_OVERLAY (gobject)->priv;

  priv->base = clutter_cairo_new (128, 128);
  clutter_actor_set_parent (priv->base, CLUTTER_ACTOR (gobject));

  draw_background (TWEET_OVERLAY (gobject));
  clutter_actor_set_size (priv->base, 128, 128);
  clutter_actor_set_position (priv->base, 0, 0);
  clutter_actor_show (priv->base);
}
Example #23
0
void HoaMapComponent::paint(Graphics& g)
{
    float center = getWidth() /2.;
    
    Path P;
    P.addCentredArc(center, center, center - 4, center - 4, 0, 0, HOA_2PI, 1);
    g.strokePath(P, PathStrokeType(1));
    P.clear();
    P.addCentredArc(center, center, center - 5, center - 5, 0, 0, HOA_2PI, 1);
    g.reduceClipRegion (P, AffineTransform::identity);
    
    draw_background(g);
    draw_sources(g);
}
Example #24
0
void do_graphics(world_t*w){
	int i = 0;
	particle_t *p = NULL;
	draw_background();
	qsort(	w->visible_particle,
		w->visible_particle_count,
		sizeof(particle_t*),
		particle_z_sort);
	
	while((p = world_next_drawable(w,&i))){
			p->draw(p);
	}
	draw_flush();
}
Example #25
0
// FUNCTION: changes the shape when user clicks on the changing shape icon
// RETURNS: current shape (r,c,s)
// RUNTIME: O(1) (time increased slightly if current shape is not (r)ectangle)
void change_shape() {
  draw_background();
  char shape_array[] = "rcs"; // the 3 possible shapes

  if(current_shape == 's') {
    current_shape = 'r';
  } else { // changes shape to the next in the array (r->c->s) and loops
    for(int i=0; i<3; ++i) {
      if(current_shape == shape_array[i]) {
	current_shape = shape_array[i+1];
        break;
      }
    }
  }
}
Example #26
0
int main(int argc, char **argv)
{
    SDL_Surface *screen, *background,
                *pause_text, *press_enter_text, *game_over_text;

    const SDL_VideoInfo *video_info;
    Uint32 frame_start, frame_end = 0, game_frame_end = 0;

    systems_init();

    screen = SDL_SetVideoMode(800, 600, 0, SDL_HWSURFACE|SDL_DOUBLEBUF);
    video_info = SDL_GetVideoInfo();

    create_images(&press_enter_text, &pause_text, &game_over_text, &background);
    create_entities();

    for(;;) {
        start_frame(&frame_start, &frame_end);

        if(check_SDL_events())
            break;

        draw_background(background, screen, video_info);

        update_entities(game_frame_end  );

        if(is_paused()) {
            if(is_game_over()) {
                draw_centered(screen, video_info, game_over_text);
            } else if(is_started()) {
                draw_centered(screen, video_info, pause_text);
            } else {
                draw_centered(screen, video_info, press_enter_text);
            }
        }

        SDL_Flip(screen);

        finish_frame(&frame_start, &frame_end, &game_frame_end);
    }

    SDL_FreeSurface(background);
    SDL_FreeSurface(pause_text);
    SDL_FreeSurface(press_enter_text);

    systems_shutdown();
    return 0;
}
Example #27
0
/**
 * \brief Draws the map with all its entities on the screen.
 */
void Map::draw() {

  if (is_loaded()) {
    // background
    draw_background();

    // draw all entities (including the hero)
    entities->draw();

    // foreground
    draw_foreground();

    // Lua
    get_lua_context().map_on_draw(*this, *visible_surface);
  }
}
bool Simple_GOL_Area::on_draw(const Cairo::RefPtr<Cairo::Context>& cr)
{
	Gtk::Allocation allocation = get_allocation();
	const int width = allocation.get_width();
	const int height = allocation.get_height();
	
	draw_background(cr);	
	draw_sim_data(cr, width, height);
	
	if(show_grid)
	{
		draw_grid(cr, width, height);
	}
 	
	return true;
}
Example #29
0
static void game_list_view(int *pos) {

  int i;
  int view_pos;
  int aux_pos=0;
  int screen_y = 45;
  int screen_x = 40;

  /* Draw background image */
  draw_background();

  /* Check Limits */
  if (*pos<0)
    *pos=game_num_avail-1;
  if (*pos>(game_num_avail-1))
    *pos=0;

  /* Set View Pos */
  if (*pos<10) {
    view_pos=0;
  } else {
    if (*pos>game_num_avail-11) {
      view_pos=game_num_avail-21;
      view_pos=(view_pos<0?0:view_pos);
    } else {
      view_pos=*pos-10;
    }
  }

  /* Show List */
  for (i=0;i<game_num_avail;i++) {
    if (aux_pos>=view_pos && aux_pos<=view_pos+28) {

      if (aux_pos==*pos) {
        fe_gamelist_text_out(screen_x    , screen_y, fe_drivers[i].name, color16(0  , 150, 255));
        fe_gamelist_text_out(screen_x - 5, screen_y, ">"               , color16(255, 255, 255));
        //sq            fe_gamelist_text_out( screen_x-7, screen_y-1,"-",color16(255,255,255) );
      }
      else {
        fe_gamelist_text_out( screen_x, screen_y, fe_drivers[i].name, color16(255,255,255));
      }

      screen_y+=6;
    }
    aux_pos++;
  }
}
Example #30
0
/*! \brief Draw the startup image on the display.
 */
static bool draw_startup(int offset_x, int offset_y)
{
  if(ram_files[STARTUP_IMAGE].start_addr)
  {
    draw_background(STARTUP_IMAGE, offset_x, offset_y);
  }
  else
  {
    et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, (et024006_color_t)APPLI_BG_COLOR);
  }

    et024006_PrintString(AUDIO_PLAYER_APPLICATION_VERSION,
            (unsigned char *) VERSION_FONT, VERSION_POS_X, VERSION_POS_Y,
	    VERSION_FONT_COLOR, APPLI_BG_COLOR);

  return true;
}