Пример #1
0
unsigned char* update_screen()
{
	#ifdef GUI_INTERFACE
	clean(SF_rgb_context);
	#endif
	#ifdef GUI_INTERFACE
	update_drawing(SF_rgb_context);
	#endif
	clean(SF_canvas);
	update_drawing(SF_canvas);
	return cairo_image_surface_get_data(surface);
}
Пример #2
0
gboolean
clone_obj_cb (GtkWidget *widget, gpointer data)
{
    tbo_object *obj = selector_tool_get_selected_obj ();
    Frame *frame = selector_tool_get_selected_frame ();
    Page *page = tbo_comic_get_current_page (((TboWindow*)data)->comic);

    if (!get_frame_view () && frame)
    {
        Frame *cloned_frame = tbo_frame_clone (frame);
        cloned_frame->x += 10;
        cloned_frame->y -= 10;
        tbo_page_add_frame (page, cloned_frame);
        set_selected (cloned_frame, (TboWindow*)data);
    }
    else if (obj && get_frame_view ())
    {
        tbo_object *cloned_obj = obj->clone (obj);
        cloned_obj->x += 10;
        cloned_obj->y -= 10;
        tbo_frame_add_obj (frame, cloned_obj);
        set_selected_obj (cloned_obj, (TboWindow*)data);
    }
    update_drawing ((TboWindow *)data);
    return FALSE;
}
Пример #3
0
gboolean
tutorial_cb (GtkWidget *widget, TboWindow *tbo){
    char *filename = DATA_DIR "/tut.tbo";
    tbo_comic_open (tbo, filename);
    tbo_window_set_path (tbo, filename);
    update_drawing (tbo);
    tbo_window_update_status (tbo, 0, 0);
    return FALSE;
}
Пример #4
0
gboolean
order_down_cb (GtkWidget *widget, gpointer data)
{
    tbo_object *obj = selector_tool_get_selected_obj ();
    if (obj)
        tbo_object_order_down (obj);
    update_drawing ((TboWindow *)data);
    return FALSE;
}
Пример #5
0
unsigned char* update_frame()
{
	// This should have the form clean -> sf_iter -> update, because bottom panel text will in
  // this  way be ereased, numerically updated, and then visually updated
	clean(SF_canvas);
	#ifdef GUI_INTERFACE
	clean(SF_rgb_context);
	#endif
	game_iteration();
	update_drawing(SF_canvas);
	#ifdef GUI_INTERFACE
	update_drawing(SF_rgb_context);
	#endif

	if(Jitter_Flag)
	{
		if(jitter_switch)
		{
				jitter_switch = 0;
		}
		else
		{
			Jitter_Step--;
			jitter_switch = 1;
		}
	}
	else if(Explosion_Flag)
	{
		Explosion_Step++;
	}

//	cairo_line(SF_canvas, 0, MaxY, MaxX, MaxY );
//	cairo_stroke(SF_canvas);
//	cairo_surface_t *surface2 = cairo_image_surface_create(CAIRO_FORMAT_A8, WINDOW_WIDTH/SCALE_F, WINDOW_HEIGHT/SCALE_F);

//	printf("Hey [1]\n");
//	cairo_t *des = cairo_create (surface2);
//	cairo_set_operator(des, CAIRO_OPERATOR_HSL_LUMINOSITY);
//	cairo_set_source_surface (des, surface, 0, 0);
//	printf("Hey [2]\n");
//	cairo_paint(des);
//	printf("Hey [3]\n");
	return cairo_image_surface_get_data(surface);
}
Пример #6
0
gboolean
on_doodle_click_cb (GtkWidget      *widget,
                    GdkEventButton *event,
                    gpointer       *data)
{
    Frame *frame = get_frame_view ();
    SVGImage *svgimage = tbo_svgimage_new_with_params (0, 0, 0, 0, (char*)data);
    update_drawing (TBO);
    tbo_frame_add_obj (frame, svgimage);
}
Пример #7
0
gboolean
delete_obj_cb (GtkWidget *widget, gpointer data)
{
    TboWindow *tbo = (TboWindow *)data;

    tbo_object *obj = selector_tool_get_selected_obj ();
    Frame *frame = selector_tool_get_selected_frame ();
    Page *page = tbo_comic_get_current_page (((TboWindow*)data)->comic);

    if (obj && get_frame_view ())
    {
        tbo_frame_del_obj (frame, obj);
        set_selected_obj (NULL, tbo);
    }
    else if (!get_frame_view () && frame)
    {
        tbo_page_del_frame (page, frame);
        set_selected (NULL, tbo);
    }
    update_drawing ((TboWindow *)data);
    return FALSE;
}
Пример #8
0
// Translate this to non gui call (i.e. keep some variable set stuff, and calc the time u need
// to wait still in this thingy)
static gboolean on_draw_event(GtkWidget *widget, cairo_t *cr, gpointer user_data)
{
//	printf("Ship pos on draw: %d %d\n", Ship_X_Pos, Ship_Y_Pos);

	// Oddly enough, clipping seems to work different accros surfaces. Therefore it is
	// sometimes wise to set things to always update here. (a clip within a quartz
	// surface erases everything outside of the clipping region)
	unsigned int elapsed_time;
	struct timeval loop_start_time, loop_end_time, loopDiff;
	struct timespec tim;
  tim.tv_sec = 0;

	gettimeofday(&loop_start_time, NULL); // Get the time at this point

	Initialize_Graphics(cr);  // Why is this needed again

	if(Initialized_Graphics == 0)
	{
	  reset_sf();
		Initialized_Graphics = 1;
	}

	clean(cr);
	SF_iteration();

	gettimeofday(&loop_end_time, NULL);
	timeval_subtract(&loopDiff, &loop_end_time, &loop_start_time);
	elapsed_time = round(loopDiff.tv_usec/1000.0);
   if(elapsed_time < SF_DELAY)
	{
	  	tim.tv_nsec = (SF_DELAY-elapsed_time) * 1000000L;
			nanosleep(&tim , NULL);
	}

	update_drawing(cr);
	return FALSE; // Not sure why this should return false
}