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 - Raiid

Pages: [1]
1
Graphics / With an Image, open new Form
« on: February 07, 2011, 11:48:45 pm »
Hello,

i am a noob in SFML :(

My Game starts with the menu.cpp. In this Menu.cpp are 2 Images. The Background and a Img "Start game". My Problem is, i didnt understand how i click this image.

This is My Code:

Code: [Select]
#include <SFML/System.hpp>
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <SFML/Audio.hpp>
#include <iostream>
#include <cmath>

int main()
{
// Create Window
    sf::RenderWindow App(sf::VideoMode(800, 600, 32), "Race of Life");

    // Create a sprite for the background
    sf::Image HintergrundImage;
    if (!HintergrundImage.LoadFromFile("can.jpg"))
        return EXIT_FAILURE;
    sf::Sprite Hintergrund(HintergrundImage);


    sf::Image StartImage;
    if (!StartImage.LoadFromFile("start.png"))
        return EXIT_FAILURE;
    sf::Sprite Start(StartImage);
sf::Image


//Load Musik
sf::SoundBuffer  buffer;
buffer.LoadFromFile( "IM.ogg" );

sf::Sound  sound( buffer );
sound.Play();

   // Start game loop
    while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
        }
        float ElapsedTime = App.GetFrameTime();
App.Draw(Hintergrund);
App.Draw(Start);
       App.Display();
sf::Sleep(0.0015f);

}
return 0;
}



When the "Start Game" image clicked, they must open me the race.cpp. but How?

Anybody help me pls:(

Pages: [1]