Exemplo n.º 1
0
/*!
	@brief 描画プロシージャ
*/
void mine_tile::paint(Graphics* g){
	switch(state){
	case init:
	case init_lock:
		draw_frame(g);
		break;
	case opened:
		draw_grid(g);
		draw_number(g);
		break;
	case marked:
	case mark_lock:
		draw_frame(g);
		draw_flag(g);
		break;
	case bomb:
		draw_grid(g);
		draw_bomb(g);
		break;
	case exploded:
		draw_grid(g);
		draw_bomb(g);
		draw_cross(g);
		break;
	case missmark:
		draw_frame(g);
		draw_flag(g);
		draw_cross(g);
		break;
	default:
		break;
	}
}
Exemplo n.º 2
0
void gui_el_t6::draw_d(float _dx, float _dy, int8_t plane)
{
    int32_t pl = 1;
    float xx = -w * sx + _dx;

    if (intg > 0)
    {
        for (int8_t i=0; i<intg; i++)
        {
            if (vard < 0 && pl > abs(vard) && i == (intg-1))
            {
                draw_frame(11, xx, _dy, plane);
            }
            else
            {
                int32_t cf = abs(vard / pl) % 10;
                draw_frame(cf, xx, _dy, plane);
                pl *= 10;
                xx -= (w + dw) * sx;
            }
        }
    }
    else
    {
        while ( pl <= abs(vard) || pl == 1)
        {
            int32_t cf = abs(vard / pl) % 10;
            draw_frame(cf, xx, _dy, plane);
            pl *= 10;
            xx -= (w + dw) * sx;
        }
        if (vard < 0)
            draw_frame(11, xx, _dy, plane);
    }
}
Exemplo n.º 3
0
void life(void){

	char led;

	while(1){
		int f, frame_number;
		frame_number = 0;
		
		initialize_frame_log();
		
		//fade to all-on LED grid
		for ( led=0; led<=19; led++ ) { led_grid_next[led] = 100; }
		fade_to_next_frame();
		for( f=0 ; f<300 ; f++ ){ draw_frame(); } //display this frame for awhile
		
		//fade to random start frame
		set_random_next_frame();
		fade_to_next_frame();
		
		while(1){
			
			if( frame_number==0 ){ log_current_frame(); } //log every 20th frame, compare future frames against it to check for oscillators
			
			for( f=0 ; f<300 ; f++ ){
				draw_frame();
			}
			
			generate_next_generation();			
			
			if( current_equals_next() == 1 ){
				//next generated frame is the same as the current frame... "still life" achieved
				for( f=0 ; f<1500 ; f++ ){ draw_frame(); } //stay on frame for awhile
				break; //exit this loop & start over
			}
			//next frame is not the same as the last
			
			if( next_equals_logged_frame() == 1 ){
				//next frame matches one we've had before, we have a repeating pattern
				//show the next frame
				fade_to_next_frame();
				for( f=0 ; f<300 ; f++ ){ draw_frame(); }
				break; //exit this loop & start over
			}
			
			fade_to_next_frame();
			frame_number++;
			if( frame_number==20 ){ frame_number = 0; }
			
			if( current_living_cells() == 0 ){
				for( f=0 ; f<1500 ; f++ ){ draw_frame(); } //stay on dead frame for awhile
				break; //all cells dead, exit this loop & start over
			}
			
		}
		
		
	}

}
Exemplo n.º 4
0
Arquivo: main.c Projeto: Touzen/snake
int tick() {
    // Handle user input
    Direction in = get_direction();
    if (in != NO_DIRECTION) {
        push_move(move_list, in);
    }
    
    // Handle snake movement
    update_direction(snake, move_list);
    move_snake(snake);

    // Draw everything
    draw_frame(snake, food_list);

    Collision collision = find_collision(snake, food_list, screen);
    switch(collision){
        case SNAKE:
        case SCREEN:
            return 0;
        
        case FOOD:
            grow_snake();
            new_food();
            break;

        case NONE:
            break;
    }
    
    snake_sleep();
    return 1;
}
Exemplo n.º 5
0
static void redraw_wwin(WWindow *wwin)
{
	if(WTHING_IS(wwin, WFrame))
		draw_frame((WFrame*)wwin, FALSE);
	else if(WTHING_IS(wwin, WInput))
		input_draw((WInput*)wwin, FALSE);
}
Exemplo n.º 6
0
/* prints help window */
void print_help_window(void)
{
	draw_frame(HELP_X,HELP_Y,HELP_WIDTH,HELP_HEIGHT,14);
	print2screen(HELP_X+((HELP_WIDTH-4)>>1),HELP_Y+1,11,"HELP");
	print2screen(HELP_X+3,HELP_Y+3,10,"ARROWS");
	print2screen(HELP_X+12,HELP_Y+3,7,"move");
	print2screen(HELP_X+3,HELP_Y+4,10,"F1,O");
	print2screen(HELP_X+12,HELP_Y+4,7,"toggle online help");
	print2screen(HELP_X+3,HELP_Y+5,10,"Q");
	print2screen(HELP_X+12,HELP_Y+5,7,"quit and save");
	print2screen(HELP_X+3,HELP_Y+6,10,"ENTER");
	print2screen(HELP_X+12,HELP_Y+6,7,"switch command/drawing mode");
	print2screen(HELP_X+3,HELP_Y+7,10,"[");
	print2screen(HELP_X+12,HELP_Y+7,7,"copy previous position into actual");
	print2screen(HELP_X+3,HELP_Y+8,10,"]");
	print2screen(HELP_X+12,HELP_Y+8,7,"copy next position into actual");
	print2screen(HELP_X+3,HELP_Y+9,10,"+");
	print2screen(HELP_X+12,HELP_Y+9,7,"increase position");
	print2screen(HELP_X+3,HELP_Y+10,10,"-");
	print2screen(HELP_X+12,HELP_Y+10,7,"decrease position");
	print2screen(HELP_X+3,HELP_Y+11,10,",");
	print2screen(HELP_X+12,HELP_Y+11,7,"shift actual position left");
	print2screen(HELP_X+3,HELP_Y+12,10,".");
	print2screen(HELP_X+12,HELP_Y+12,7,"shift actual position right");
	print2screen(HELP_X+3,HELP_Y+13,10,"G");
	print2screen(HELP_X+12,HELP_Y+13,7,"start animation");
	print2screen(HELP_X+3,HELP_Y+14,10,"H");
	print2screen(HELP_X+12,HELP_Y+14,7,"stop animation");
	print2screen(HELP_X+3,HELP_Y+15,10,"TAB");
	print2screen(HELP_X+12,HELP_Y+15,7,"toggle help");
}
Exemplo n.º 7
0
void Fl_Input_Browser::draw()
{
    Fl_Flags f = flags();
    if (!active_r()) f.set(FL_INACTIVE);
    //minw_ = w();
    if (damage()&FL_DAMAGE_ALL) draw_frame();
    int X = 0, Y = 0, W = w(), H = h(); box()->inset(X, Y, W, H);
    int W1 = H*4/5;
    if (damage()&(FL_DAMAGE_ALL|FL_DAMAGE_CHILD)) {
        input()->resize(X, Y, W-W1, H);
        input()->set_damage(FL_DAMAGE_ALL);
        input()->copy_style(style()); // force it to use this style
        input()->box(FL_FLAT_BOX);

        // fix for relative coordinates
        fl_push_matrix();
        fl_translate(X,Y);

        input()->draw();

        fl_pop_matrix();
        input()->set_damage(0);
    }
    if(damage()&(FL_DAMAGE_ALL|FL_DAMAGE_VALUE|FL_DAMAGE_HIGHLIGHT))
    {
        if(over_now) f.set(FL_HIGHLIGHT);
        X += W-W1;
        W = W1;
	button_box(FL_DIV_UP_BOX);
        // draw the little mark at the right:
        draw_glyph(FL_GLYPH_DOWN_BUTTON, X, Y, W, H, f);
        over_last = over_now;
    }
}
Exemplo n.º 8
0
static int end_frame(AVFilterLink *inlink)
{
    AVFilterContext *ctx = inlink->dst;
    AlphaMergeContext *merge = ctx->priv;

    int is_alpha = (inlink == ctx->inputs[1]);
    struct FFBufQueue *queue =
        (is_alpha ? &merge->queue_alpha : &merge->queue_main);
    ff_bufqueue_add(ctx, queue, inlink->cur_buf);
    inlink->cur_buf = NULL;

    while (1) {
        AVFilterBufferRef *main_buf, *alpha_buf;

        if (!ff_bufqueue_peek(&merge->queue_main, 0) ||
            !ff_bufqueue_peek(&merge->queue_alpha, 0)) break;

        main_buf = ff_bufqueue_get(&merge->queue_main);
        alpha_buf = ff_bufqueue_get(&merge->queue_alpha);

        ctx->outputs[0]->out_buf = main_buf;
        ff_start_frame(ctx->outputs[0], avfilter_ref_buffer(main_buf, ~0));
        merge->frame_requested = 0;
        draw_frame(ctx, main_buf, alpha_buf);
        ff_end_frame(ctx->outputs[0]);
        avfilter_unref_buffer(alpha_buf);
    }
    return 0;
}
Exemplo n.º 9
0
void
draw_guard_frame (ALLEGRO_BITMAP *bitmap, struct anim *g, enum vm vm)
{
    struct coord c;

    if (! is_guard (g)) return;
    if (g->invisible) return;

    struct frame f = g->f;
    struct frame_offset xf = g->xf;

    f.b = apply_guard_palette (f.b, g->type, g->style, vm);
    xf.b = apply_guard_palette (xf.b, g->type, g->style, vm);

    draw_xframe (bitmap, &f, &xf);
    draw_frame (bitmap, &f);

    if (g->splash && g->type != SKELETON) {
        ALLEGRO_BITMAP *splash = (g->type == SHADOW) ? v_kid_splash : guard_splash;
        palette pal = get_guard_palette (g->style, vm);
        splash = apply_palette (splash, pal);
        if (hgc) splash = apply_palette (splash, hgc_palette);
        draw_bitmapc (splash, bitmap, splash_coord (&g->f, &c), g->f.flip);
    }
}
Exemplo n.º 10
0
Arquivo: FED.C Projeto: MegaGod/TW
void print_table( int page ) {
	int x1, y1, x2, y2;
	calculate_page_frame( &x1, &y1, &x2, &y2 );
	draw_frame( x1, y1, x2, y2 );
	lower_limit = y2;
	print_page( page, char_per_row( ) * char_per_col( ) );
}
static int filter_frame(AVFilterLink *inlink, AVFrame *buf)
{
    AVFilterContext *ctx = inlink->dst;
    AlphaMergeContext *merge = ctx->priv;

    int ret = 0;
    int is_alpha = (inlink == ctx->inputs[1]);
    struct FFBufQueue *queue =
        (is_alpha ? &merge->queue_alpha : &merge->queue_main);
    ff_bufqueue_add(ctx, queue, buf);

    do {
        AVFrame *main_buf, *alpha_buf;

        if (!ff_bufqueue_peek(&merge->queue_main, 0) ||
            !ff_bufqueue_peek(&merge->queue_alpha, 0)) break;

        main_buf = ff_bufqueue_get(&merge->queue_main);
        alpha_buf = ff_bufqueue_get(&merge->queue_alpha);

        merge->frame_requested = 0;
        draw_frame(ctx, main_buf, alpha_buf);
        ret = ff_filter_frame(ctx->outputs[0], main_buf);
        av_frame_free(&alpha_buf);
    } while (ret >= 0);
    return ret;
}
Exemplo n.º 12
0
void Flcc_ValueBox::draw()
{
    int d = damage();
    int x1 = 0; int y1 = 0; int w1 = w(); int h1 = h();

    box()->inset(x1,y1,w1,h1);

    Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();
    c->hsv2rgb(c->hue(), c->saturation(), 1.0f, tr, tg, tb);

    if(d & FL_DAMAGE_ALL) {
        draw_frame();
        generate();     
    }

    if (d == FL_DAMAGE_VALUE) fl_push_clip(x1,y1+py,w1,6);
    bg->draw(x1,y1,w1,h1);
    if (d == FL_DAMAGE_VALUE) fl_pop_clip();

    int Y = int((1-c->v()) * (h1-6));
    if (Y < 0) Y = 0; else if (Y > h1-6) Y = h1-6;
    button_box()->draw(x1, y1+Y, w1, 6, color(), 0);

    py = Y;
}
Exemplo n.º 13
0
void Flcc_HueBox::draw()
{
    if (damage() & FL_DAMAGE_ALL) {
        draw_frame();
    }

    int x1 = 0; int y1 = 0; int w1 = w(); int h1 = h();
    box()->inset(x1,y1,w1,h1);

    if (damage() == FL_DAMAGE_VALUE) fl_push_clip(x1+px,y1+py,BUTTON_SIZE,BUTTON_SIZE);
    if(bg) bg->draw(x1,y1,w1,h1);
    if (damage() == FL_DAMAGE_VALUE) fl_pop_clip();

    Fl_Color_Chooser* c = (Fl_Color_Chooser*)parent();

#ifdef CIRCLE
    int X = int(.5f*(cos(c->hue()*float(M_PI/3.0))*c->saturation()+1) * (w1-BUTTON_SIZE));
    int Y = int(.5f*(1-sin(c->hue()*float(M_PI/3.0))*c->saturation()) * (h1-BUTTON_SIZE));
#else
    int X = int(c->hue()/6.0f*(w1-BUTTON_SIZE));
    int Y = int((1-c->saturation())*(h1-BUTTON_SIZE));
#endif

    if (X < 0) X = 0; else if (X > w1-BUTTON_SIZE) X = w1-BUTTON_SIZE;
    if (Y < 0) Y = 0; else if (Y > h1-BUTTON_SIZE) Y = h1-BUTTON_SIZE;

    button_box()->draw(x1+X, y1+Y, BUTTON_SIZE, BUTTON_SIZE, button_color(), 0);
    px = X;
    py = Y;
}
Exemplo n.º 14
0
void Fl_Popup_ListView::draw() {
    draw_frame();
    if((damage() & ~FL_DAMAGE_CHILD))
        draw_child(*m_listView);
    else
        update_child(*m_listView);
    //Fl_Popup_Window::draw();
}
Exemplo n.º 15
0
    void draw() {
        if(!(damage()&FL_DAMAGE_ALL)) return;

        int X=0,Y=0,W=w(),H=h();
        box()->inset(X,Y,W,H);

        if(image()) {
            draw_frame();
            fl_push_clip(X,Y,W,H);

            Fl_Image *im = image();

            W=im->width();
            H=im->height();
            int pbw = w() - 10;
            int pbh = h() - 10;
            if(W > pbw || H > pbh) {
                W = pbw;
                H = W * im->height() / im->width();
                if(H > pbh) {
                    H = pbh;
                    W = H * im->width() / im->height();
                }
            }
            X=(w()/2)-W/2;
            Y=(h()/2)-H/2;
            if(X<5) X=5;
            if(Y<5) Y=5;

            im->mask_type(MASK_NONE);
            im->draw(X,Y,W,H,FL_ALIGN_SCALE);

            fl_clip_out(X,Y,W,H);

            X=0,Y=0,W=w(),H=h();
            box()->inset(X,Y,W,H);

            fl_color(color());
            fl_rectf(X,Y,W,H);

            fl_pop_clip();

        } else {

            draw_box();

            if(w()<=120) label_size(8);
            if(w()>120) label_size(10);
            if(w()>180) label_size(12);
            if(w()>250) label_size(14);

            if(label()[0]=='?'&&label()[1]=='\0') label_size(100);

            draw_label(X, Y, W, H, align());
        }
    }
Exemplo n.º 16
0
void draw_map (int map[]) {
  int i = 0;

  for (tiley = 0; tiley < scrollbmp->h; tiley += TILEH) {
    for (tilex = 0; tilex < scrollbmp->w; tilex += TILEW) {
      draw_frame (tilesbmp, scrollbmp, tilex, tiley, TILEW, TILEH, 0, 0,
                  COLS, map[i++]);
    }
  }
}
Exemplo n.º 17
0
Arquivo: main.c Projeto: elekmad/snake
/**
* Use first to init the world and place the apple
*/
void draw_world(SDL_Surface *s, char world[SCREEN_X_SIZE][SCREEN_Y_SIZE][4])
{
    int x, y;
    for(x = 0; x < SCREEN_X_SIZE; x++)
    {
	for(y = 0; y < SCREEN_Y_SIZE; y++)
	    draw_frame(s, x, y, background);
    }
    place_apple(s); 
}
Exemplo n.º 18
0
void
draw_mouse_frame (ALLEGRO_BITMAP *bitmap, struct anim *m, enum vm vm)
{
  if (m->invisible) return;
  struct frame f = m->f;
  palette pal = get_palette (vm);
  f.b = apply_palette (f.b, pal);
  if (hgc) f.b = apply_palette (f.b, hgc_palette);
  draw_frame (bitmap, &f);
}
Exemplo n.º 19
0
void draw_reset(void) 
{
    clear_screen();
    draw_frame(); 
    draw_keymap();
    draw_street();
    draw_walk(RED);
    draw_lights();
    hide_cursor();
}
Exemplo n.º 20
0
void x_and_o(struct visual_params *arg) {
    char f1[4][4] = {
        {1,0,0,1},
        {0,1,1,0},
        {0,1,1,0},
        {1,0,0,1}
    };
    char f2[4][4] = {
        {0,4,4,0},
        {4,0,0,4},
        {4,0,0,4},
        {0,4,4,0}
    };
    if ((arg->iterations % 2) == 0) {
        draw_frame(arg, f1, arg->energy);
    } else {
        draw_frame(arg, f2, arg->energy);
    }
}
Exemplo n.º 21
0
static gboolean lcd_expose (GtkWidget *widget, GdkEventExpose *event)
{
	Lcd *lcd;
	cairo_t *cr;
	
	//g_debug ("expose event");

	lcd = LCD (widget);

	/* get a cairo_t */
	cr = gdk_cairo_create (widget->window);
	
	cairo_set_antialias (cr, CAIRO_ANTIALIAS_DEFAULT);
	
	// Antialiasing
	/*
	switch (cairo_get_antialias (cr)) {
		case CAIRO_ANTIALIAS_DEFAULT:
			g_message ("Antialiasing: Default");
			break;
		case CAIRO_ANTIALIAS_GRAY:
			g_message ("Antialiasing: GRAY");
			break;
		case CAIRO_ANTIALIAS_NONE:
			g_message ("Antialiasing: NONE");
			break;
		case CAIRO_ANTIALIAS_SUBPIXEL:
			g_message ("Antialiasing: SUBPIXEL");
			break;
	}
	*/
	cairo_font_options_t *font_options;
	
	font_options = cairo_font_options_create ();
	cairo_get_font_options (cr, font_options);

	cairo_set_font_options (cr, font_options);

	/* set a clip region for the expose event */
	cairo_rectangle (cr, event->area.x, event->area.y,
					 event->area.width, event->area.height);
	cairo_clip (cr);

	draw_frame (lcd, cr);
	draw_text (lcd, cr);
	
	// Alles zeichnen
	//cairo_stroke (cr);

	// free cairo_t *
	cairo_destroy (cr);

	return FALSE;
}
Exemplo n.º 22
0
void* engine_loading_tick (void* ptr) {
	Context* context = (Context*) ptr;
	
	while (!context->pthread_stop) {
		draw_frame(context);
		usleep(5000);
	}
	
	pthread_exit(NULL);
	return NULL;
}
Exemplo n.º 23
0
void squares(struct visual_params *arg) {
    char frame[4][4];
    int color_index = rand() % 7;
    int i, j;
    for (i = 0; i < 4; i++) {
        for (j = 0; j < 4; j++) {
            frame[i][j] = color_index;
        }
    }
    draw_frame(arg, frame, arg->energy);
}
Exemplo n.º 24
0
void Fl_Tool_Bar::draw()
{
    int n;

    if(opened())
    {
        // make it not draw the inside label:
        int saved = flags(); align(FL_ALIGN_TOP);

        if(damage() & ~FL_DAMAGE_CHILD) {
            draw_frame();
            fl_push_clip(box()->dx(), box()->dy(), w()-box()->dw()-(m_menubut->visible()?20:0), h()-box()->dh());
            for (n = children(); n--;) draw_child(*child(n));
            draw_box();
            draw_inside_label();
            fl_pop_clip();

            if(m_menubut->visible()) {
                fl_push_clip(w()-box()->dw()-(m_menubut->visible()?20:0), box()->dy(), 30, h()-box()->dh());
                draw_child(*m_menubut);
                draw_box();
                fl_pop_clip();
            }

            for (n = 0; n < children(); n++) draw_outside_label(*child(n));
        } else {
            fl_push_clip(box()->dx(), box()->dy(), w()-box()->dw()-(m_menubut->visible()?20:0), h()-box()->dh());

            for(n = 0; n < children(); n++) {
                Fl_Widget& w = *child(n);
                if (w.damage() & FL_DAMAGE_CHILD_LABEL) {
                    draw_outside_label(w);
                    w.set_damage(w.damage() & ~FL_DAMAGE_CHILD_LABEL);
                }
                update_child(w);
            }

            fl_pop_clip();
        }

        flags(saved);

        if (damage() & (FL_DAMAGE_EXPOSE|FL_DAMAGE_HIGHLIGHT|FL_DAMAGE_ALL))
        {
            Fl_Flags f = 0;
            if (pushed) f.set(FL_VALUE);
            if (highlighted) f.set(FL_HIGHLIGHT);
            draw_glyph(0, 0, 0, glyph_size(), h(), f);
        }

    } else
        Fl_Bar::draw();
}
Exemplo n.º 25
0
GLvoid window_display()
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    gluLookAt(cam_x, cam_y, cam_z, po_x, po_y, po_z, 0, 1, 0);

    draw_frame();
    render_scene();

    glFlush();
}
Exemplo n.º 26
0
void Fl_Scrollbar::draw()
{
    if (damage()&FL_DAMAGE_ALL) draw_frame();

    int X=0; int Y=0; int W=w(); int H=h(); box()->inset(X,Y,W,H);
    int ix = X; int iy = Y; int iw = W; int ih = H;

    char pushed_ = this==Fl::pushed() ? which_pushed : NOTHING;
    char highlight_ = this==Fl::belowmouse() ? which_highlight : NOTHING;

    // 1 = left/top   2 = right/bottom   5 = slider button
    Fl_Flags f1 = 0, f2 = 0, f5 = 0;
    if (!active_r())
    {
        f1 = f2 = f5 = FL_INACTIVE;
    }
    else
    {
        if (pushed_ == UP_ARROW) f1 = FL_VALUE|FL_HIGHLIGHT;
        else if (highlight_ == UP_ARROW) f1 = FL_HIGHLIGHT;
        if (pushed_ == DOWN_ARROW) f2 = FL_VALUE|FL_HIGHLIGHT;
        else if (highlight_ == DOWN_ARROW) f2 = FL_HIGHLIGHT;
        if (pushed_ == SLIDER) f5 = FL_VALUE|FL_HIGHLIGHT;
        else if (highlight_ == SLIDER) f5 = FL_HIGHLIGHT;
    }

    if (vertical() && H >= 3*W)
    {
        if (damage()&FL_DAMAGE_ALL || last_ == UP_ARROW || highlight_ == UP_ARROW)
            draw_glyph(FL_GLYPH_UP_BUTTON, X, Y, W, W, f1);
        if (damage()&FL_DAMAGE_ALL || last_ ==DOWN_ARROW|| highlight_ ==DOWN_ARROW)
            draw_glyph(FL_GLYPH_DOWN_BUTTON, X, Y+H-W, W, W, f2);
        iy += W; ih -= 2*W;

    }                            // horizontal:
    else if (W >= 3*H)
    {
        if (damage()&FL_DAMAGE_ALL || last_ == UP_ARROW || highlight_ == UP_ARROW)
            draw_glyph(FL_GLYPH_LEFT_BUTTON, X, Y, H, H, f1);
        if (damage()&FL_DAMAGE_ALL || last_ ==DOWN_ARROW|| highlight_ ==DOWN_ARROW)
            draw_glyph(FL_GLYPH_RIGHT_BUTTON, X+W-H, Y, H, H, f2);
        ix += H; iw -= 2*H;
    }
    last_ = highlight_;

    if (Fl_Slider::draw(ix, iy, iw, ih, f5, false))
    {
        fl_color(color());
        fl_rectf(ix, iy, iw, ih);
        fl_pop_clip();
    }

}
Exemplo n.º 27
0
//------- Begin of function Firm::draw -----------//
//
// Draw the firm on the map
//
// [int] displayLayer   : 1 = same layer with units (default : 1)
//                      : 2 = layer above units
//                      : 4 = layer below units
//
void Firm::draw(int displayLayer)
{
	FirmBuild* firmBuild = firm_res.get_build(firm_build_id);

	// if in construction, don't draw ground unless the last construction frame
	if( firmBuild->ground_bitmap_recno &&
		(!under_construction || construction_frame() >= firmBuild->under_construction_bitmap_count-1))
	{
		firm_res.get_bitmap(firmBuild->ground_bitmap_recno)
			->draw_at(loc_x1*ZOOM_LOC_WIDTH, loc_y1*ZOOM_LOC_HEIGHT, NULL, displayLayer);
	}

	if( firmBuild->animate_full_size )
	{
		draw_full_size(displayLayer);
	}
	else
	{
		if( under_construction )
		{
			draw_full_size(displayLayer);
		}
		else if( !is_operating() )
		{
			FirmBuild* firmBuild = firm_res.get_build(firm_build_id);
			if( firm_res.get_bitmap(firmBuild->idle_bitmap_recno) )
				draw_full_size(displayLayer);
			else
			{
				draw_frame(1, displayLayer);
				draw_frame(2, displayLayer);
			}
		}
		else
		{
			draw_frame(1, displayLayer);				// the first frame is the common frame for multi-segment bitmaps
			draw_frame(cur_frame, displayLayer);
		}
	}
}
Exemplo n.º 28
0
void DungeonMap::draw(sf::RenderTarget& target)
{
  const int mapPosX = config::GAME_RES_X / 2 - m_mapTexture->getSize().x / 2;
  const int mapPosY = config::GAME_RES_Y / 2 - m_mapTexture->getSize().y / 2;

  draw_frame(target, 0, 0, config::GAME_RES_X, config::GAME_RES_Y);
  draw_texture(target, m_mapTexture, mapPosX, mapPosY);
  m_minimap.draw(target);

  int left  = POS_X - 19;
  int right = POS_X + WIDTH + 19;
  int top   = POS_Y - 19;
  int bottom = POS_Y + HEIGHT + 19;

  int middle_x = config::GAME_RES_X / 2;
  int middle_y = config::GAME_RES_Y / 2;

  sf::Sprite sprite;
  sprite.setTexture(*m_arrowTexture);
  sprite.setOrigin(m_arrowTexture->getSize().x / 2, m_arrowTexture->getSize().y / 2);

  // RIGHT
  sprite.setPosition(right, middle_y);
  if (m_centerX < (m_map->getWidth() - 1))
  {
    target.draw(sprite);
  }

  // DOWN
  sprite.rotate(90);
  sprite.setPosition(middle_x, bottom);
  if (m_centerY < (m_map->getHeight() - 1))
  {
    target.draw(sprite);
  }

  // LEFT
  sprite.rotate(90);
  sprite.setPosition(left, middle_y);
  if (m_centerX > 0)
  {
    target.draw(sprite);
  }

  // UP
  sprite.rotate(90);
  sprite.setPosition(middle_x, top);
  if (m_centerY > 0)
  {
    target.draw(sprite);
  }
}
Exemplo n.º 29
0
void fade_to_next_frame(void){
	char led, changes;	
	
	while(1){
		changes = 0;
		for ( led=0; led<=19; led++ ) {
			if( led_grid[led] < led_grid_next[led] ){ led_grid[led] = (led_grid[led]+1); changes++; }
			if( led_grid[led] > led_grid_next[led] ){ led_grid[led] = (led_grid[led]-1); changes++; }
		}
		draw_frame();
		if( changes == 0 ){break;}
	}
}
Exemplo n.º 30
0
void Tetris_game_loop(Tetris *tetris)
{
    while (1) {
        get_key_input(tetris);

        update(tetris);

        if (tetris->renderer->buffer->dirty) {
            draw_frame(tetris);
        }

        Tetris_sleep_ms(30);
    }
}