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

Pages: 1 2 [3] 4 5
31
General / A few Questions..
« on: November 06, 2010, 05:47:29 pm »
Quote from: "Father_Sloth"
I have read the Michael Dawson C++ through game programming and also a few websites on c++ functions and none of them answered it.


It's because it's too looking too high, your error is really really basic if you have read my 2 post you will have found your answer.

Quote from: "mooglwy"
You declare your function has "void play(void)" but you called a "void play(sf::RenderWindow)"


Isn't that clear enough ? What do you want more ? We can't program for you. You will have to learn C and C++ by yourself before.

I also strongly advise you read the link i gave you. That's my last post for this problem, you've got all the card you need. Think be yourself.  :wink:

32
General / A few Questions..
« on: November 06, 2010, 03:45:19 pm »
it's a bit rough but he's right. You really need to learn some basics. Like how to declare a function. Especially for this problem, you already ask and i already answered it.

I don't know what to tell you either learn C, you could start here.

33
General discussions / SFML Firefox Plugin like Flash Plugin
« on: November 02, 2010, 02:14:14 pm »
Quote from: "nulloid"
I will need it :)


What kind of thing you can do with that? I mean thing cannot already do.

34
SFML wiki / A Gradient Class
« on: November 01, 2010, 07:06:33 pm »
Hello,

    I have created a class for create and draw gradient. You can find source code and example here.

Here some example of what it can do :


35
General / how to Program object oriented???!!!
« on: November 01, 2010, 05:20:10 pm »
He it's possible, but here you will short code for the most. Here you will find an old project of mine. I not assure you the code is clean but is object oriented.

36
Window / How to intergrate with GTK+ interface?
« on: October 31, 2010, 11:53:33 pm »
When the code will be working, it would be great to add it on the wiki.

37
General / A few Questions..
« on: October 31, 2010, 11:51:34 pm »
You declare your function has "void play(void)" but you called a "void play(sf::RenderWindow)"

38
General / A few Questions..
« on: October 31, 2010, 08:12:20 pm »
You have to think about your main loop, what does it do, in what order what for. The question you is basic question of a program design.

Fisrt, the event loop, that will allow you to know what user had done. You could simplify your program by using Input.

Then there is the update phase. depending on time and user input you will trying to move object and testing collision then removing them according to it.

And finally draw you object.

The best way you have to succeed, is trying failling and trying and failling.. Until you succeed. Even if you don't really know what to do, try... You also should read code from other people, start with the sfml's sample, especially the pong one. You could also read the wiki.

39
Network / download image from html
« on: October 31, 2010, 07:26:53 pm »
Like i said, it's really simple. You just have to read a few to know what is an http request and what is in the answer.

40
General / A few Questions..
« on: October 31, 2010, 07:19:28 pm »
Okay i get your problem. Your logic is wrong, there is some sophisticated and long way but i'll try to explain it to you.  You must have several main loop. First one which draw you window for selecting game or else. Then when use press space for example you jump into another main loop for playing the game.

Something like that
Code: [Select]

int main()
{
    // Create main window
    sf::RenderWindow App(sf::VideoMode(640, 480), "Pong");
   
   sf::Sprite backgroun; //a backgroun
   [..] //some other thing to make it your taste
   
    // 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();
if(user press space)
{
play(App);
}
         
        }
       
      App.Clear();
      App.Draw(sprite);
      App.Display();
     
   }
   return EXIT_SUCCESS;
}

void play()
{
// creating your sprite for the game
sf::Sprite ball;
[…]

while (App.IsOpened())
    {
        // Process events
        sf::Event Event;
        while (App.GetEvent(Event))
        {
            // Close window : exit
            if (Event.Type == sf::Event::Closed)
                App.Close();
if(user win or loose)
{
return;
}
        }
       
      App.Clear();
      App.Draw(ball);
      App.Display();
   }
}


This this the simpliest way of doing that.

For Xcode you have to drag your data on the resources folder of your project. Normally they will be copied on the resources folder of your App, which must be (if i'm not mistaken) the working dir. I remember reading on the change log that ceylo has change it recently. There is one easy way to know where the working dir is, you should create an new file like "fopen("test","w");" then finding this file. I remember one other thing, last time i checked the working dir by launching manually the app and by lauching in xcode in not the same.

41
General / [Solved]Draw FPS each second
« on: October 31, 2010, 06:29:01 pm »
And you also could use static variable. like that

Code: [Select]
int app_properties::draw_fps()
{
static bool init = false;
static sf::Clock clock;

if(init == false)
{
init = true;
clock.reste();
}

getfps=1/(App.GetFrameTime()); //getfps is a float declared in the app_properties class

if(clock.GetEllapsedTime() >= 1.0)
{
clock.reste();
stringstream ss;
ss << getfps;
dfps.SetText("FPS: " + (ss.str()).substr(0,2)); //dfps is a font string declared in the app_properties class
App.Draw(dfps);
}

   return getfps;
}

42
General / A few Questions..
« on: October 31, 2010, 05:02:32 pm »
Quote from: "Father_Sloth"
i can't seem to find out how to spawn objects.


I don't get it, what do you wanna do ?

43
Network / download image from html
« on: October 31, 2010, 10:47:16 am »
How do you think your browser does ?

That's not really hard to do. You send a request to the server for the file (the http protocol is really simple) and you get your data as a char* you just have to split header from body. There you have your image.

44
General / A few Questions..
« on: October 30, 2010, 10:20:51 pm »
If the wall is horizontal or vertical, you just have to change a signe in your deplacement vector. Else you will have tu you dot product

45
General / Xcode Compile Help (Screenshots) [SOLVED]
« on: October 30, 2010, 06:06:39 pm »
Download this file. And copy the content of the folder lib in /Library/Frameworks . You don't have to go inside the framework, and to know how file are stored.

Here is the content of my SMFL.framework

Pages: 1 2 [3] 4 5
anything