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

Pages: [1]
1
Graphics / Insert images after App.Display();
« on: January 02, 2012, 02:57:29 pm »
Thank's Pyrius :D

2
Graphics / Insert images after App.Display();
« on: January 02, 2012, 11:45:54 am »
I want to make sure that when I press a button an object appears on the screen, but I do not want the object to be present when I app: display ()

Is there a way?

3
Graphics / Insert images after App.Display();
« on: January 02, 2012, 11:10:18 am »
Code: [Select]
App.Clear();

App.Draw(sfondo);

App.Draw(nav1);

App.Draw(nav2);

App.Display();

App.Draw(miss);


It is possible?

4
Graphics / Insert images after App.Display();
« on: January 01, 2012, 11:33:27 pm »
I don't know how to do :cry:

Code: [Select]
#include <SFML/Audio.hpp>
#include <SFML/Graphics.hpp>
using namespace sf;
#include <iostream>
using namespace std;

 int main()
 {


     Image Image4,Image3,Image2,Image;
     // Create the main window
     RenderWindow App(VideoMode(800, 600), "Pofro Game");

     if (!Image.LoadFromFile("1.jpeg"))
         return EXIT_FAILURE;
     Sprite nav1(Image);

    nav1.SetPosition(30,20);

     if (!Image2.LoadFromFile("3.jpeg"))
         return EXIT_FAILURE;
     Sprite sfondo(Image2);


     if (!Image3.LoadFromFile("2.jpeg"))
         return EXIT_FAILURE;
     Sprite nav2(Image3);

     nav2.SetPosition(730,20);

     if (!Image4.LoadFromFile("4.jpeg"))
         return EXIT_FAILURE;
     Sprite miss(Image4);


     Font Arial;
     if (!Arial.LoadFromFile("verdana.ttf"))
         return EXIT_FAILURE;
     String Text("Hello SFML", Arial, 50);

     Music Music;
     if (!Music.OpenFromFile("nice_music.ogg"))
         return EXIT_FAILURE;

         Music.SetLoop(true);

     Music.Play();

    while (App.IsOpened())
     {

         Event Eventi;
         while (App.GetEvent(Eventi))
         {

             if (Eventi.Type == Event::Closed)
                 App.Close();

             if ((Eventi.Type == Event::KeyPressed) && (Eventi.Key.Code == Key::Escape))
             App.Close();

             if ((Eventi.Type == Event::KeyPressed) && (Eventi.Key.Code == Key::Space))
             App.Draw(miss);
                            }



float tempo = App.GetFrameTime();

        // Move the sprite
        if ((App.GetInput().IsKeyDown(Key::Left)) && (nav1.GetPosition().x>=2)) nav1.Move(-200 * tempo, 0);
        if ((App.GetInput().IsKeyDown(Key::Right)) && (nav1.GetPosition().x<=745)) nav1.Move( 200 * tempo, 0);
        if ((App.GetInput().IsKeyDown(Key::Up)) && (nav1.GetPosition().y>=2))   nav1.Move(0, -200 * tempo);
        if ((App.GetInput().IsKeyDown(Key::Down)) && (nav1.GetPosition().y<=556)) nav1.Move(0,  200 * tempo);


         App.Clear();

         App.Draw(sfondo);

         App.Draw(nav1);

         App.Draw(nav2);

         App.Display();
     }

     return EXIT_SUCCESS;
 }


doesn't work :cry:

Pages: [1]