Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Mansiepansie

Pages: [1]
1
General / Re: Tried making a Exe of my Program/Project
« on: May 15, 2015, 03:54:02 am »
What do you mean, if a empty project compiles an Exe file or?

2
General / Re: Tried making a Exe of my Program/Project
« on: May 15, 2015, 02:26:56 am »
1>c:\users\måns\documents\visual studio 2013\projects\speed pong\speed pong\gamebackground.cpp(1): warning C4627: '#include "GameBackground.h"': skipped when looking for precompiled header use
1>          Add directive to 'stdafx.h' or rebuild precompiled header

What do they mean? :/ what directive

3
General / Tried making a Exe of my Program/Project
« on: May 15, 2015, 02:08:10 am »
The build comes out fine, but when i press the Exe.. a error shows up in line 9 on GameBackGround.cpp

#include "stdafx.h"
#include "GameBackground.h"
#include "SFML/Graphics.hpp"
#include "Game.h"

GameBackground::GameBackground()
{
   Load("images/CourtTest.png");
   assert(IsLoaded());
   GetSprite().setOrigin(0, 0);
}

GameBackground::~GameBackground()
{
}

void GameBackground::Draw(sf::RenderWindow &renderWindow)
{
   VisibleGameObject::Draw(renderWindow);
}

void GameBackground::Update(float elapsedTime)
{
}

Failed to load image, IsLoaded assertion error or something.

Please help!

4
General / Re: How to get orange colour?
« on: May 15, 2015, 02:06:44 am »
Thanks!

5
General / How to get orange colour?
« on: May 15, 2015, 01:39:56 am »
Using _scoreP2.setColor(sf::Color(0, 0, 0));

want a closeby orange colour look :) thanks!

6
General / Re: PONG Game Menu Events
« on: May 14, 2015, 10:29:03 pm »
Omg geez.. thanks man.. i feel so stupid rofl!!

7
General / Re: PONG Game Menu Events
« on: May 14, 2015, 09:18:36 pm »
The Code doesn't show any errors, the problem for me seems to be

   
      case OptionMenu::BACK_TO_MENU:
         _gameState = Game::Paused;
         return;
      default:
         break;

Not displaying what was intended, i want it to go back to the ingame menu wich is the Paused screen


8
General / Re: PONG Game Menu Events
« on: May 14, 2015, 08:44:37 pm »
Im new to programming, usually dont hang around at forums. So tell me if im posting something wrong, i have around 20+ headers, so i might not link everything correct.

9
General / Re: PONG Game Menu Events
« on: May 14, 2015, 08:38:22 pm »
Everything but the
void Game::ShowOptionMenu()

trying to go back to Paused/InGameMenu when i push Back to Ingame Menu

10
General / Re: PONG Game Menu Events
« on: May 14, 2015, 08:36:53 pm »
// Within Game.cpp

void Game::ShowOptionMenu()
{
   OptionMenu menu;
   while (true)
   {
      _mainWindow.clear(sf::Color::Transparent);

      //Drawing filter game-background + scoreboard (left and right of menutext)
      static sf::RectangleShape filter(sf::Vector2f(SCREEN_WIDTH, SCREEN_HEIGHT));
      filter.setFillColor(sf::Color(40, 40, 40, 70));
      _gameBackground.Draw(_mainWindow);
      _gameObjectManager.DrawAll(_mainWindow);
      _mainWindow.draw(filter);
      _scoreBoard.draw(_mainWindow);

      //Showing menu
      unsigned int result = menu.show(_mainWindow);
      _mainWindow.display();

      //Handling menuEvent
      switch (result)
      {
      case OptionMenu::CHANGE_COLOUR:
         _gameState = Game::Playing;
         return;
      case OptionMenu::BACK_TO_MENU:
         _gameState = Game::Paused;
         return;
      default:
         break;
      }
   }
}

// The header

#pragma once
#include "Menu.h"
#include "SFML/Graphics.hpp"

class OptionMenu : public Menu
{
public:
   enum MenuResult { Nothing, CHANGE_COLOUR, BACK_TO_MENU };
   OptionMenu();
   ~OptionMenu();
private:
   unsigned int handleEvents(sf::RenderWindow &window);    //override

};

// The .cpp File

#include "stdafx.h"
#include "OptionMenu.h"
#include "Game.h"
#include "ServiceLocator.h"

OptionMenu::OptionMenu()
{
   sf::Font font;
   font.loadFromFile("images/FuturaLTBold.ttf");

   MenuItem ChangeColour;
   ChangeColour.action = CHANGE_COLOUR;
   ChangeColour.menuText = "Change Player Paddle";
   ChangeColour.isSelected = true;

   MenuItem backToMainMenus;
   backToMainMenus.action = BACK_TO_MENU;
   backToMainMenus.menuText = "Back to Ingame Menu";
   backToMainMenus.isSelected = false;

   _menuItems.push_back(ChangeColour);
   _menuItems.push_back(backToMainMenus);
}

OptionMenu::~OptionMenu()
{
}

unsigned int OptionMenu::handleEvents(sf::RenderWindow &renderWindow)
{
   sf::Event menuEvent;
   while (renderWindow.pollEvent(menuEvent))
   {
      if (menuEvent.type == sf::Event::KeyPressed)
      {
         switch (menuEvent.key.code)
         {
         case sf::Keyboard::Return:
            return selectedMenuItemResult();
         case sf::Keyboard::Down:
            selectNextMenuItem();
            return Nothing;
         case sf::Keyboard::Up:
            selectPreviousMenuItem();
            return Nothing;
         default:
            return Nothing;
         }
      }
      if (menuEvent.type == sf::Event::Closed)
      {
         renderWindow.close();
      }
   }
   return Nothing;
}

// Within the Game.cpp

void Game::GameLoop()
{

   sf::Event currentEvent;
   switch (_gameState)
   {
   case Game::ShowingMainMenu:
      ShowMainMenu();
      break;
   case Game::ShowingOption:
      ShowOptionz();
      break;
   case Game::Paused:
      ShowInGameMenu();
      break;
   case Game::ShowingOptionMenu:
      ShowOptionMenu();
   case Game::ShowingSplash:
      ShowSplashScreen();
      break;
   case Game::ShowingGameBackground:
      ShowGameBackground();
      break;
   case Game::Playing:
      _mainWindow.clear(sf::Color(0, 0, 0));
      _gameBackground.Draw(_mainWindow);
      _scoreBoard.draw(_mainWindow);
      _gameObjectManager.UpdateAll();
      _gameObjectManager.DrawAll(_mainWindow);
      _mainWindow.display();
   
      while (_mainWindow.pollEvent(currentEvent))
      {
         if (currentEvent.type == sf::Event::Closed)
         {
            _gameState = Game::Exiting;
         }
         if (currentEvent.type == sf::Event::KeyPressed)
         {
            if (currentEvent.key.code == sf::Keyboard::Escape)
            {
               ServiceLocator::GetAudio()->PlaySound("audio/menuEnter.wav");
               _gameState = Paused;
            }
         }
      }
      break;
   default:
      break;

   }
}

// Within Game.h

#include "PlayerPaddle.h"
#include "GameObjectManager.h"
#include "scores.h"
#include "GameBackground.h"

class Game
{

public:
   static void Start();

   const static GameObjectManager& GetGameObjectManager();
   static ScoreBoard& GetScoreBoard();
   static GameBackground& GetGameBackground();
   const static int SCREEN_WIDTH = 1024;
   const static int SCREEN_HEIGHT = 768;
private:
   static bool isExiting();
   static void resetGame();
   static void setupGameObjects();

   static void GameLoop();
   static void ShowGameBackground();
   static void ShowSplashScreen();
   static void ShowMainMenu();
   static void ShowInGameMenu();
   static void ShowOptionMenu();
   static void ShowOptionz();


   enum GameState { Uninitialised, ShowingSplash, ShowingGameBackground, Paused, Exiting, ShowingOption, ShowingOptionMenu, ShowingMainMenu, ShowingInGameMenu, Playing };
   static GameState _gameState;

   static sf::RenderWindow _mainWindow;
   static GameObjectManager _gameObjectManager;
   static ScoreBoard _scoreBoard;
   static GameBackground _gameBackground;

   static bool _multiplayer;
};

11
General / PONG Game Menu Events
« on: May 14, 2015, 08:26:38 pm »
Hello, i once again struck an issue.. however i dont understand why it does this.

I have 4 Menu options where everyone works except the one ingame.. it triggers after game is paused, i get trough the menu but when i get into the options menu in the ingame screen nothing works and brings me back to the intro screen instead of doing what i'm trying to tell the program to do, go back to the ingame menu or any menu at all, however it still goes back to the Intro screen.

Please help, thanks.

Sorry for tardiness

12
General / Re: PONG Game sprite layers
« on: May 14, 2015, 06:32:35 pm »
Thanks bro! Solved it straight away :D

13
General / PONG Game sprite layers
« on: May 14, 2015, 06:13:05 pm »
Hello, i've been trying to do a PONG game for the first time and i'm atm doing the ingame Background..

However, im very new to Programming and SFML. I've been trying to implement an image/sprite as the background.

I manage to implement the Image/Sprite, but.. the sprite itself  becomes the top layer blocking all my ingame objects so i can only see the image itself. Is there a way to implement it so that it is the bottom layer in the game?

Im probably retarded, but hey.. im really new to programming so please help :(

Pages: [1]
anything