コード例 #1
0
ファイル: graph_disp.cpp プロジェクト: mattvchandler/graph3
Graph_disp::Graph_disp(const sf::VideoMode & mode, const int size_request, const sf::ContextSettings & context_settings):
    SFMLWidget(mode, size_request, context_settings),
    draw_cursor_flag(true), draw_axes_flag(true), use_orbit_cam(true),
    cam_light(glm::vec3(1.0f), 0.2f, glm::vec3(0.0f), 1.0f, 0.5f, 0.0f),
    dir_light(glm::vec3(0.5f), 0.2f, glm::vec3(-1.0f)),
    bkg_color(0.25f, 0.25f, 0.25f), ambient_color(0.4f, 0.4f, 0.4f),
    _cam(glm::vec3(0.0f, -10.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f)),
    _orbit_cam({10.0f, 0.0f, (float)M_PI / 2.0f}), _scale(1.0f), _perspective(1.0f),
    _active_graph(nullptr)
{
    // All OpenGL initialization has to wait until the drawing context actually exists
    // we do this in the initialize method
    // connect it to the draw signal, to be run only on the first drawing request
    _draw_connection = signal_draw().connect(sigc::mem_fun(*this, &Graph_disp::initiaize));

    // connect event signals
    signal_size_allocate().connect(sigc::mem_fun(*this, &Graph_disp::resize));
    signal_key_press_event().connect(sigc::mem_fun(*this, &Graph_disp::key_press));

    // input is checked every 10ms
    Glib::signal_timeout().connect(sigc::mem_fun(*this, &Graph_disp::input), 10);

    set_can_focus();
    set_can_default();
}
コード例 #2
0
ファイル: BreadCrumbs.hpp プロジェクト: ventosus/ingen
		BreadCrumb(const Raul::Path& path, SPtr<GraphView> view = SPtr<GraphView>())
			: _path(path)
			, _view(view)
		{
			assert(!view || view->graph()->path() == path);
			set_border_width(0);
			set_path(path);
			set_can_focus(false);
			show_all();
		}
コード例 #3
0
Simple_GOL_Area::Simple_GOL_Area(int width, int height):Gtk::DrawingArea()
{
	sim_data = new GOL_Pop_Sim(width, height); 
	show_grid = false;
	running = true;
	itteration_time = 100;
	mouse_button_one_down = true;
	//signal_key_press_event().connect(sigc::mem_fun(*this, &Simple_GOL_Area::on_key_press_event), false);
	//signal_key_release_event().connect(sigc::mem_fun(*this, &Simple_GOL_Area::on_key_press_event), false);
	
	set_can_focus(true);
	add_events(Gdk::KEY_PRESS_MASK | Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK |  Gdk::POINTER_MOTION_MASK);
	
	//begin timeout loop (tick + render)
	override_timeout_connection(itteration_time);
}