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.


Topics - melissa_goddard

Pages: [1]
1
General / Undefined reference to '__dyn_tls_init_callback'
« on: February 08, 2012, 12:55:26 pm »
Hi

I have been running this program for a while now and have had adjust the compiler and debug settings so that I could transport it from uni to home and still make it work, which it wasn't doing before.

It worked for a little while and now it is not liking it and not sure why?

This is what I have:

Settings>Compiler and debugger settings>Search directories>Compiler

G:\Year 3\Undergrad Project\Dissertation_Version1.2\SFML\SFML-1.6
G:\Year 3\Undergrad Project\Dissertation_Version1.2\SFML\SFML-1.6\include
G:\Year 3\Undergrad Project\Dissertation_Version1.2\SFML\MinGW\include
G:\Year 3\Undergrad Project\Dissertation_Version1.2\SFML\MinGW\lib
G:\Year 3\Undergrad Project\Dissertation_Version1.2\SFML\SFML-1.6\include\SFML


and in linker (Settings>Compiler and debugger settings>Search directories>Linker)

G:\Year 3\Undergrad Project\Dissertation_Version1.2\SFML\SFML-1.6\lib
G:\Year 3\Undergrad Project\Dissertation_Version1.2\SFML\MinGW\lib

(SFML-1.6 is the folder which was downloaded from the sfml website and extracted)

Any ideas? I look forward to your replies

2
General / Exporting an SFML Project in Code::Blocks
« on: February 02, 2012, 08:24:26 pm »
Hi all

For my dissertation, I need the program I have created (using Code::Blocks with SFML) to work on computers at Uni, which currently don't have SFML installed. Is there a way of taking everything I have in the project directory and make it like an application that can be run without needing the SFML part?

If it helps I am have created three files within the project on top of the SFML files etc.

Kind Regards

Melissa

3
System / Clock::GetElapsedTime() error in my code
« on: January 07, 2012, 10:35:20 pm »
Hi

I apologise for my ignorance with using SFML, I have been using it for 2 weeks as I want to learn a new piece of software with my dissertation.

My aim is to create a timer which monitors the time that has elapsed since its last reset. The user will need to click an enemy to increase their score before the timer has reached five seconds. If the timer reaches five seconds then set the enemy position to another random place on the screen.

I am using an enum to determine what the game state is currently in, whether it is in 'Playing', 'Exiting' or 'Uninitialised' which determines what is happening in the game as the entire game works around one main function 'gameLoop'.

My problem is if I use cout to display the elapsed time it displays the time like 0.000843478 and doesn't appear to increase, it appears to be a random sequence of numbers that never reaches 0.001.

Any ideas? This is my gameLoop function:

Code: [Select]

void GameClass::gameLoop()
{
sf::Event currentEvent; //Creates an instance of sf Event called currentEvent which will monitor the gameState whilst the program is running
gameWindow.GetEvent(currentEvent); //Assigns the currentEvent to gameWindow

switch(gameState) //Monitors the changes within gameState and applies the appropriate implementation depending on the cases below
{
case GameClass::Playing: //Alter the game environment so that all sprites are drawn to stage ready for the user to play
{
sf::Clock enemyClock;
            bool enemyHit = false;
while((enemyClock.GetElapsedTime()<5.f)&&(enemyHit == false))
{
   gameWindow.Clear(sf::Color(0,0,0)); //Clears all images off screen and reverts it to a black screen
                enemy.drawCharacter(gameWindow);
                player.drawCharacter(gameWindow);
                gameWindow.Display();
                cout<<"Time: "<<enemyClock.GetElapsedTime()<<endl;
                if(currentEvent.Type == sf::Event::Closed)
                {
                    gameState = GameClass::Exiting; //If the 'X' button is closed on the gameWindow then the gameState changes to Exiting
                }

                switch(currentEvent.Type)
                {
                    case sf::Event::MouseButtonPressed:
                        switch (currentEvent.MouseButton.Button)
                        {
                            case sf::Mouse::Left:
                                {
                                    player.setIsFiringStatus(true);
                                    player.fireWeapon();
                                    //Debug to test if enemy is being hit
                                    int enemyX = enemy.enemySprite.GetPosition().x;
                                    int enemyY = enemy.enemySprite.GetPosition().y;
                                    int playerX = player.userCursor.GetPosition().x;
                                    int playerY = player.userCursor.GetPosition().y;

                                        if(((((enemyX - playerX)>0)&&(enemyX - playerX)<30)&&((enemyY - playerY)>0)&&(enemyY - playerY)<30)||((((playerX - enemyX)>0)&&(playerX - enemyX)<30)&&(((playerY - enemyY)>0)&&(playerY - enemyY)<30)))
                                        {
                                            enemyHit = true;
                                            cout<<"Enemy hit"<<endl;
                                            break;
                                            //enemy.setEnemyPosition();
                                        }

                                    player.setIsFiringStatus(false);
                                    break;
                                }
                            default:
                                break;
                        }
                        break;
                    case sf::Event::MouseButtonReleased:
                        //cout<<"Mouse button released"<<endl;
                        break;
                    case sf::Event::MouseMoved:
                    {
                        //Need to update the position of the mouse/cursor sprite
                        player.userCursor.SetPosition((currentEvent.MouseMove.X), (currentEvent.MouseMove.Y));
                        break;
                    }
                    default:
                        break;
                }

                    break;
                }
                if(enemyHit)
                {
                    player.addToUserScore(100);
                    cout<<"Score: "<<player.getUserScore()<<endl;
                    enemy.setEnemyPosition();
                    //enemyClock.Reset();
                }
                /*if(enemyClock.GetElapsedTime()>5.f)
                {
                    enemy.setEnemyPosition();

                }*/


}
default: //Prevents warnings
break;
}
}

Pages: [1]
anything