Example #1
0
std::pair<int,int> BEE::get_mouse_position() {
	if (!get_current_room()->get_is_views_enabled()) {
		return get_mouse_global_position();
	}

	int mx, my;
	std::tie(mx, my) = get_mouse_global_position();
	ViewData* v = get_current_room()->get_current_view();

	if ((v == NULL)&&(get_current_room()->get_views().size() > 0)) {
		v = get_current_room()->get_views().begin()->second;
	}

	if (v != NULL) {
		mx -= v->port_x;
		my -= v->port_y;
	}

	return std::make_pair(mx, my);
}
Example #2
0
/*
* BEE::get_mouse_position() - Return the mouse coordinates relative to the viewport
*/
std::pair<int,int> BEE::get_mouse_position() const {
	int mx, my;
	std::tie(mx, my) = get_mouse_global_position(); // Fetch the global coordinates into (mx, my)

	if (!get_current_room()->get_is_views_enabled()) { // If views are disabled, simply return the coordinates relative to the window
		return std::make_pair(mx, my); // Return the pair on success
	}

	ViewData* v = get_current_room()->get_current_view(); // Get the current view
	if ((v == nullptr)&&(get_current_room()->get_views().size() > 0)) { // If this function is called outside of view drawing then simply use the first view
		v = get_current_room()->get_views().begin()->second;
	}

	if (v != nullptr) { // If the view exists then adjust the coordinates
		mx -= v->port_x;
		my -= v->port_y;
	}

	return std::make_pair(mx, my); // Return the pair on success
}
Example #3
0
/*
* BEE::get_mouse_global_y() - Return the mouse y-coordinate relative to the window
*/
int BEE::get_mouse_global_y() const {
	return get_mouse_global_position().second;
}
Example #4
0
/*
* BEE::get_mouse_global_x() - Return the mouse x-coordinate relative to the window
*/
int BEE::get_mouse_global_x() const {
	return get_mouse_global_position().first;
}