Пример #1
0
void setWindowMouseMoveEnabled(bool b) {
	poWindow *window = applicationCurrentWindow();
	window->setMouseMoveEnabled(b);
}
Пример #2
0
bool getWindowMouseMoveEnabled() {
	poWindow *window = applicationCurrentWindow();
	return window->isMouseMoveEnabled();
}
Пример #3
0
poPoint getWindowMousePosition() {
	poWindow *window = applicationCurrentWindow();
	return window->getMousePosition();
}
Пример #4
0
poPoint getWindowInvMousePosition() {
	poWindow *window = applicationCurrentWindow();
	poPoint response = window->getMousePosition();
	response.y = window->getBounds().height - response.y;
	return response;
}
Пример #5
0
float getWindowLastFrameTime() {
	poWindow *window = applicationCurrentWindow();
	return window->getLastFrameTime();
}
Пример #6
0
float getWindowLastFrameDuration() {
	poWindow *window = applicationCurrentWindow();
	return window->getLastFrameElapsed();
}
Пример #7
0
int getWindowFrameCount() {
	poWindow *window = applicationCurrentWindow();
	return window->getFramecount();
}
Пример #8
0
float getWindowWidth() {
	poWindow *window = applicationCurrentWindow();
	return window->getWidth();
}
Пример #9
0
poPoint getWindowCenter() {
	poWindow *window = applicationCurrentWindow();
	return window->getCenterPoint();
}
Пример #10
0
float getWindowFramerate() {
	poWindow *window = applicationCurrentWindow();
	return window->getFramerate();
}
Пример #11
0
poRect getWindowBounds() {
	poWindow *window = applicationCurrentWindow();
	return window->getBounds();
}
Пример #12
0
float getWindowAspect() {
	poWindow *window = applicationCurrentWindow();
	return window->getWidth() / (float)window->getHeight();
}
Пример #13
0
poPoint getWindowDimensions() {
	poWindow *window = applicationCurrentWindow();
	return window->getDimensions();
}
Пример #14
0
float getWindowHeight() {
	poWindow *window = applicationCurrentWindow();
	return window->getHeight();
}
Пример #15
0
void ExampleApp::eventHandler(poEvent *event) {
	// handle key events
	if(event->type == PO_KEY_DOWN_EVENT) {
		// return key
		if(event->keyCode == PO_RETURN_KEY) {
			// toggle fullscreen the window
			poWindow *window = applicationCurrentWindow();
			applicationMakeWindowFullscreen(window, !window->isFullscreen());
		}
	}
	
	// re-center the image
	else if(event->type == PO_WINDOW_RESIZED_EVENT) {
		getChild(0)->position = getWindowCenter();
	}
	
	// turn on image border
	else if(event->type == PO_MOUSE_ENTER_EVENT) {
		poShape2D *shape = static_cast<poShape2D*>(event->source);
		shape->strokeColor = poColor::orange;
		shape->generateStroke(20);
	}
	
	// turn off image border
	else if(event->type == PO_MOUSE_LEAVE_EVENT) {
		poShape2D *shape = static_cast<poShape2D*>(event->source);
		shape->generateStroke(0);
	}
	
	// start masking the image
	else if(event->type == PO_MOUSE_DOWN_INSIDE_EVENT) {
		mask = new poOvalShape(100,100,50);
		mask->position = event->local_position;
		event->source->addModifier(new poGeometryMask(mask));
	}
	
	// stop masking the image
	else if(event->type == PO_MOUSE_UP_EVERYWHERE_EVENT) {
		event->source->removeModifier(0, true);
		mask = NULL;
	}
	
	// we're dragging the mask around!
	else if(event->type == PO_MOUSE_DRAG_EVENT) {
		mask->position = event->local_position;
	}
	
	// display the mouse coordinates
	else if(event->type == PO_MOUSE_MOVE_EVENT) {
		getChildAs<poTextBox>(1)->text((text_fmt % event->position.x % event->position.y).str())->layout();
	}

	// toggle image rotation
	else if(event->type == PO_MOUSE_DOWN_OUTSIDE_EVENT) {
		bool running = event->source->rotation_tween.isRunning();
		if(running)	event->source->rotation_tween.stop();
		else		event->source->rotation_tween.set(event->source->rotation + 360).start();
			
	}
	
}