Esempio n. 1
0
void VideoRenderer::draw(){
	if(shaderActive)
		shader.begin();
	if(tint.a<255){
		ofEnableAlphaBlending();

		if(minmaxBlend){
			glBlendEquationEXT(GL_MAX);

			//glBlendFuncSeparateEXT( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_DST_ALPHA );
			//glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
			//glBlendEquationSeparateEXT(GL_MAX,GL_ADD);
		}else{
			glBlendEquationEXT(GL_MIN);


			//glBlendFuncSeparateEXT( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_DST_ALPHA );
			//glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
			//glBlendEquationSeparateEXT(GL_MIN,GL_ADD);
		}
		ofSetColor(tint);
		/// drawing the video render
		drawNextFrame();
		glBlendEquationEXT(GL_FUNC_ADD);
		ofDisableAlphaBlending();
	}else{
		ofSetColor(tint);
		drawNextFrame();
	}
	if(shaderActive)
		shader.end();

}
Esempio n. 2
0
void mainLoop()
{
	bool running = true;
	bool printedCoords = false;
	char *quitReason = (char*)NULL;
	screen_dimensions_t *dims = &(gameState.dimensions);
	MSG message;

	while (running)
	{
		while (PeekMessage(&message, NULL, 0, 0, PM_REMOVE))
		{
			TranslateMessage(&message);
			DispatchMessage(&message);
		}

		drawNextFrame();
		if (!printedCoords)
		{
			printedCoords = true;
			printf("Game window is located at (%d, %d) and its size is (%d, %d).\n",
				dims->leftX, dims->topY, dims->width, dims->height);
		}
		running = checkShouldContinueRunning(&quitReason);
		Sleep(SLEEP_TIME);
	}

	if (quitReason != (char*)NULL)
	{
		timestamp();
		printf("%s\n", quitReason);
	}
}
Esempio n. 3
0
void StateTransitionBlocks::draw(GraphicsDevice* renderer)
{
	if(!m_next)
		drawPreviousFrame(renderer);
	else
		drawNextFrame(renderer);

	for(std::size_t i = 0; i < shapes.size(); ++i)
	{
		renderer->draw(shapes[i]);
	}
}
Esempio n. 4
0
void RivenVideo::disable() {
	if (needsUpdate()) {
		drawNextFrame();
	}

	if (_video) {
		Common::Rect targetRect = Common::Rect(_video->getWidth(), _video->getHeight());
		targetRect.translate(_x, _y);

		_vm->_gfx->copySystemRectToScreen(targetRect);
	}

	_enabled = false;
}
Esempio n. 5
0
bool VideoManager::updateMovies() {
	bool updateScreen = false;

	for (VideoList::iterator it = _videos.begin(); it != _videos.end(); ) {
		// Check of the video has reached the end
		if ((*it)->endOfVideo()) {
			if ((*it)->isLooping()) {
				// Seek back if looping
				(*it)->seek((*it)->getStart());
			} else {
				// Done; close and continue on
				(*it)->close();
				it = _videos.erase(it);
				continue;
			}
		}

		Video::VideoDecoder *video = (*it)->_video;

		// Ignore paused videos
		if (video->isPaused()) {
			it++;
			continue;
		}

		// Check if we need to draw a frame
		if (video->needsUpdate()) {
			if (drawNextFrame(*it)) {
				updateScreen = true;
			}
		}

		// Remember to increase the iterator
		it++;
	}

	// Return true if we need to update the screen
	return updateScreen;
}
Esempio n. 6
0
void VideoManager::drawVideoFrame(const VideoEntryPtr &video, const Audio::Timestamp &time) {
	assert(video);
	video->seek(time);
	drawNextFrame(video);
	video->stop();
}