Ejemplo n.º 1
0
/////////////////////////////////////////////////////////////////
// initialize
//    Initialize this application when it starts. Disable firmware,
// set the video mode and colours, and initialize map and cursor.
//
void initialize() {
   u8 *pmem;

   // Disable firmware to prevent it from restoring video mode or
   // interfering with our drawString functions
   cpct_disableFirmware();

   // Set the video Mode to 1 (320x200, 4 colours)
   cpct_setVideoMode(1); 

   // Use default colours except for palette index 0 (background).
   // Default colours are (Blue, Yellow, Cyan, Red), let's use
   // (Black, Yellow, Cyan, Red). Change only colour 0 and border.
   cpct_setPALColour(0, 0x14);
   cpct_setBorder(0x14);
   
   // Initialize Base Pointer of the map in video memory. This is 
   // the place where the map will start to be drawn (0,0). This
   // location is (MAP_START_X, MAP_START_Y) with respect to CPCT_VMEM_START.
   pmem = cpct_getScreenPtr(CPCT_VMEM_START, MAP_START_X, MAP_START_Y);
   map_setBaseMem(pmem);

   // Set cursor at the top-left corner of the screen
   cursor_setLocation(0, 0);

   // Draw messages with instructions, the map and the cursor
   drawMessages();
   map_draw();
   cursor_draw();
}
Ejemplo n.º 2
0
void update()
{
    // Tact animations texts
    if(!selectedScene->label.empty())
    {
        for(auto mLabel: selectedScene->label)
        {
            mLabel->animationTact();
        }
    }

    // Clear screen
    erase();

    // Draw

    // Scene
    drawScene(selectedScene);

    // Messages
    drawMessages();

    // Debug texts
#ifdef DEBUG
    move(0,0);
    if(selectedSaveSlot != -1)
    printw("x:%i y:%i", saveSlot[selectedSaveSlot]->gMap.getPlayerX(), saveSlot[selectedSaveSlot]->gMap.getPlayerY());
#endif

    refresh();
}
Ejemplo n.º 3
0
void violet::HUD::draw(GameState* gameState, Player* player) {
	float health = player->getHealth() / player->MaxHealth();
	float experience = (float) (player->Xp - player->LastLevelXp)
			/ (player->NextLevelXp - player->LastLevelXp);

	VideoMode screen = m_videoManager->getVideoMode();

	drawMessages();
	drawTime(gameState);

	applyEffects(health, player->LevelPoints);

	int bottomBasePoint = m_videoManager->getVideoMode().Height
			- m_videoManager->RegularText->getIndent() * 2;

	drawHealth(health, bottomBasePoint);
	drawExperience(experience, player->LevelPoints, bottomBasePoint);

	drawInventory(player);

	if (gameState->Lost && !gameState->Paused)
		drawEndGameScreen(gameState, player->Xp);

	if (!gameState->Lost)
		if (Info != "")
			m_videoManager->RegularText->draw(Info.c_str(),
					m_videoManager->getVideoMode().Width / 2,
					m_videoManager->RegularText->getIndent(),
					TextManager::CENTER, TextManager::TOP);

	if (gameState->Paused)
		m_videoManager->RegularText->draw(_("PAUSE"), screen.Width / 2,
				screen.Height / 2, TextManager::CENTER, TextManager::MIDDLE);
}
Ejemplo n.º 4
0
void Entity::draw(sf::RenderWindow* graphics){


	drawStats(graphics);
	drawMessages(graphics);
	graphics->draw(sprite);

}
Ejemplo n.º 5
0
void World::drawGame(){
	if(canGameStart()){
		if(!tempo.endGame()){
			drawMessages();		//draw the GUI
			cam.begin();// elements en la camara
				drawScene();		//draws the scenario
				int a = 0;
				//tempo.launchNewWall(false);		//set launch to false to check if really has to 
				if(tempo.launchNewWall()){
					
					//randomize walls and control that never choses a wall that has been chosen last 5 times
					if(_walls.size() > 0){	//if is loaded at least one posture on the xml
						int index = rand() % _walls.size();
						while (_walls.size() > 1 && isPostureRepeated(index) ){
							index = rand() % _walls.size();
						}

						_evenOdd = !_evenOdd;
						ofVec3f p;
						if (_evenOdd){
							p = ofVec3f(15,-10,50);
						} else{
							p = ofVec3f(-15,-10,50);
						}
						//ofVec3f p = ofVec3f(0,0,50);
						//restore the wall to the start position
						//if (_screenWalls.size() < 1){	//if we want to see only one wall to debug
							_screenWalls.push_back(_walls.at(index));
							_screenWalls.at(_screenWalls.size()-1)->setPosition(p);
							_screenWalls.at(_screenWalls.size()-1)->restoreGrid();
							_screenWalls.at(_screenWalls.size()-1)->enableWall();
						//}
					} else{	//draw a message if there are no walls loaded
						setView(ERROR_VIEW);
					}
				}
				if(isAnyWall()){
					for (int j=0; j < _screenWalls.size(); j++){
						if(checkDistanceOfWallFromPlayer() >= WALL_COLLISION_THRESHOLD && j == 0){
							ofEnableAlphaBlending();
								_screenWalls.at(j)->draw();
							ofDisableAlphaBlending();
						} else{
							_screenWalls.at(j)->draw();
						}
					}
				}
				_player->draw();
				_log.update(tempo.timeElapsed(), _player->amountOfMovement(),ofGetFrameNum());
			cam.end();
		} else{
			//delete remaining walls
			_screenWalls.clear();
			//_walls.clear();
			setView(END_GAME_VIEW);
		}
	}
}
Ejemplo n.º 6
0
void drawInfoPanel()
{
	//graphics->drawString(graphics->screen->w / 2, 5, TXT_CENTERED, GLColor::white, true, "%s", player->velocity.toString());

	graphics->setFont(FONT_NORMAL);
	
	drawBlobHealthShieldInfo();
	
	drawWeaponsAndItems();
	
	drawMessages();
	
	drawOrders();
	
	drawOnScreenTargetter();
}