Пример #1
0
			EM_BOOL fullscreenchange_callback(int eventType, const EmscriptenFullscreenChangeEvent *e, void *userData)
			{
				//printf("%s, isFullscreen: %d, fullscreenEnabled: %d, fs element nodeName: \"%s\", fs element id: \"%s\". New size: %dx%d pixels. Screen size: %dx%d pixels.",
      //Cast::toString<int>(eventType).c_str(), e->isFullscreen, e->fullscreenEnabled, e->nodeName, e->id, e->elementWidth, e->elementHeight, e->screenWidth, e->screenHeight);

				EmscriptenFullscreenChangeEvent state;
				emscripten_get_fullscreen_status(&state);

				GameContainer* container = ARK2D::getContainer();
				int newWidth = 100;
				int newHeight = 100;
				if (state.isFullscreen) {  
					newWidth = state.screenWidth;
					newHeight = state.screenHeight;
				} else {
					newWidth = container->getWidth();
					newHeight = container->getHeight();
				}
 
				container->setSize(newWidth, newHeight);
				container->getPlatformSpecific()->setFullscreenInternal(e->isFullscreen);
				//container->resizeBehaviour(newWidth, newHeight); 
				//container->resizeWindowToFitViewport(); 

				return 0;
			}	
Пример #2
0
Boss::Boss(): GameObject()  {
	m_game = DefaultGame::getGame();

	m_spitTimer = 0;

	m_image = m_game->sheet->getSubImage(m_game->sheet_desc->getItemByName("boss1.png")); //new Image("data/game/boss1.png");
	m_imageRight = m_image->getFlippedCopy(true, false);

	m_animation = new Animation();
	m_animation->setFrameTime(500);
	m_animation->addImage(m_game->sheet->getSubImage(m_game->sheet_desc->getItemByName("boss2.png"))); //new Image("data/game/boss2.png"));
	m_animation->addImage(m_game->sheet->getSubImage(m_game->sheet_desc->getItemByName("boss3.png"))); //new Image("data/game/boss3.png"));

	m_animationRight = new Animation();
	m_animationRight->setFrameTime(500);
	m_animationRight->addImage(m_animation->getFrame(0)->getFlippedCopy(true, false));
	m_animationRight->addImage(m_animation->getFrame(1)->getFlippedCopy(true, false));

	//m_animation->addImage(m_game->sheet->getSubImage(m_game->desc->getItemByName("couldron1.png"))->getScaledCopy(4, 4));
	//m_animation->addImage(m_game->sheet->getSubImage(m_game->desc->getItemByName("couldron2.png"))->getScaledCopy(4, 4));

	m_timer = 0;

	m_bounds->setWidth(100);
	m_bounds->setHeight(100);
	//m_bounds->setWidth(m_animation->getCurrentFrame()->getWidth());
	//m_bounds->setHeight(m_animation->getCurrentFrame()->getHeight());

	GameContainer* container = ARK2D::getContainer();
	m_bounds->setLocationByCenter(float(container->getWidth()/2), float(container->getHeight()/2));

	m_velocity->set(0, 0);
	m_velocityMaximum->set(2000, 25);

	m_acceleration->set(400, 5);
}