Example #1
0
bool
Editor::on_mousemotion( SDL_Event &e )
{
	DisplayEngine *engine = m_display.get_engine();
	V2 worldpos = engine->to_world( V2( e.motion.x, e.motion.y ) );
	current_tool()->round_coordinates( &worldpos );
	m_cursor.move( worldpos );
	return true;
}
Example #2
0
bool
Editor::on_mousebutton( SDL_Event &e )
{
	DisplayEngine *engine = m_display.get_engine();
	V2 worldpos = engine->to_world( V2( e.motion.x, e.motion.y ) );

	if( Tool *tool = current_tool() ) {
		tool->on_mousebutton( e, worldpos );
	}
	return true;
}
Example #3
0
void Editor::update_cursor()
{
	// set proper position
	int mx;
	int my;
	SDL_GetMouseState( &mx, &my );
	DisplayEngine *engine = m_display.get_engine();
	V2 worldpos = engine->to_world( V2( mx, my ) );
	current_tool()->round_coordinates( &worldpos );
	m_cursor.move( worldpos );

	// set proper face
	set_cursor( current_tool()->current_object() );
}