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

Pages: [1] 2
1
General / Add files to SFML
« on: January 26, 2009, 01:20:48 pm »
Quote from: "Laurent"
You should really not do this. Just create your own library.


Yeah, I might do that if things starts to mess up. However this works pretty well right now and I think I'm gonna keep it this way (for now).
________
n02 vaporizer

2
General / Add files to SFML
« on: January 25, 2009, 05:16:22 pm »
A friend helped me out today with this. Now it works perfectly.
I know this is generally a bad idea but at least now I got it to work...
________
iolite reviews

3
General / Add files to SFML
« on: January 25, 2009, 08:41:06 am »
Quote from: "Laurent"
???

Why do you want to do that?


Since I use AClock in every project (and  many other files as well) I thought it would be easier.
And I know this is not the best solution but for now I wanna do this  :)
________
easy vape

4
General / Add files to SFML
« on: January 24, 2009, 07:45:09 pm »
Hi,

This is basically what I want to do:
Code: [Select]

#include <SFML/System.hpp>

int main()
{
    sf::AClock Clock;

    //Do something with clock

    return 0;
}


I want to add AClock.hpp and AClock.cpp to the System.hpp.
I have never done that before and I can't get it to work.
I'm using SFML v1.4 and CodeBlocks with MinGW on Windows XP.

I have tried a bit but I keep getting this error message "undefined reference to `sf::AClock::AClock(bool)'"

Any help is appreciated.
________
Ford Sierra history

5
General / Get coordinates on a rotated object?
« on: September 06, 2008, 11:54:25 am »
Quote from: "quasius"
Most of these problems can be solved with the Pythagorean theorem and simple sin/cos/tan.  This is no exception (If I understand your question correctly, you can actually do this problem without PT explicitly).  You need to make a right triangle using one of the tilted sides of your rotated rectangle as the hypotenuse and then solve that triangle.
In SFML, sprites rotate around the upper-left pixel (also it's position) by default.  So use that as the known point and make with an adjacent side to make a solvable triangle which will also give you the x and y offsets from the known rotation point.  Then you can use the symmetry of the rectangle to solve for any side you care about.
If you still can't get it, post what you've tried.  Maybe an MSPaint drawing of how you're trying to solve this problem.  (You'll learn a lot more by fighting through these problems instead of just c+p'ing code if I were to just post the solution.)
I'm going to visit a religious community in a couple of hours and will be there until Monday afternoon, but I might be able to pop in at some point to answer questions.  If not, hopefully someone else can pick it up and help you figure this out.


I don't have access to my computer for a few days so I'm not able to test what you suggested. I'll post here when I do when I have tried it out.
________
ecig forum

6
General / Re: Get coordinates on a rotated object?
« on: September 04, 2008, 09:35:27 am »
Quote from: "quasius"
Do you know how to use the Pythagorean theorem?  If not, google it and see if that helps.


Yeah, I think I know how to use the Pythagorean theorem, if you mean this:  

A*A + B*B = C*C

However I'm still confused how this would help me, how can I get the coordinates from this?

(I'm sorry if I don't understand but as i said i really suck at math)
________
easy vape

7
General / Re: Get coordinates on a rotated object?
« on: September 03, 2008, 07:17:43 pm »
Quote from: "quasius"
Make a right triangle with the tilted rectangle and use Pythagoras's Theorem.


I'm sorry, I don't really sure how you mean.
________
marijuana hemp

8
General / Get coordinates on a rotated object?
« on: September 03, 2008, 09:00:28 am »
I have an rectangle which can be rotated. I need to know how to get the top-right coordinates of the rectangle after rotation. This seems to be a very simple problem really but I suck at math  :oops:

Thanks!
________
Ford Customline specifications

9
General / SVN-Problems
« on: May 24, 2008, 07:48:54 am »
I tried for the first time to download the latest SVN and as you can guess I've  run into some problems.

I've copied and replaced the include/SFML folder but when I try to run this code it won't work.

Code: [Select]

#include <SFML/Graphics.hpp>


int main(int argc, char *argv[])
{
    sf::RenderWindow    RenderWindow(sf::VideoMode(800,600,32),"Test");
    sf::Event           Event;  
     
    bool                Loop = true;
             
    while(Loop)
    {
        while(RenderWindow.GetEvent(Event))
        {
            if(Event.Type == sf::Event::Closed)
                Loop = false;                        
        }
       
        RenderWindow.Display();
    }
}


When I try to run this code it says:   [Linker error] undefined reference to `sf::RenderWindow::RenderWindow(sf::VideoMode, std::string const&, unsigned long, sf::WindowSettings const&)'


Obviously I'm missing something here but I'm a complete noob at this and  need some help.
________
vapir air one

10
Graphics / How to use sfRect Intersect()?
« on: September 07, 2007, 11:28:01 am »
Quote from: "Laurent"
The two last parameters are right and bottom, not width and height :
Code: [Select]
return sfIntRect(sprite.GetLeft(),sprite.GetTop(),sprite.GetLeft()+sprite.GetWidth(),sprite.GetTop()+sprite.GetHeight());


Thanks a lot! Now it works properly.

Code: [Select]


class Sprite
{
public:
     sfIntRect GetRect()
     {  
         return sfIntRect((sprite.GetLeft(),
                                  sprite.GetTop(),
                                  sprite.GetLeft()+sprite.GetWidth(),
                                  sprite.GetTop()+sprite.GetHeight());
     }
};

class Ball : public Sprite {}
class Paddle : public Sprite {}

void HandleBallToPlayerCollision()
{
     if( paddle->GetRect().Intersects(ball->GetRect()))
     {
          //Do stuff if collided      
     }
}

________
box vaporizer

11
Graphics / How to use sfRect Intersect()?
« on: September 07, 2007, 11:07:29 am »
Quote from: "Laurent"
sprite.GetSubRect will give you coordinates relative to the image, you have to offset it by the position of the sprite.


I'm not really sure how you mean. Is it something like this:
Code: [Select]

sfIntRect GetRect()
{
return sfIntRect(sprite.GetLeft(),sprite.GetTop(),sprite.GetWidth(),sprite.GetHeight());
}
________
vaporizer wiki

12
Graphics / How to use sfRect Intersect()?
« on: September 07, 2007, 10:18:19 am »
This is basically how it's done:

Code: [Select]

class Sprite
{
public:
     sfIntRect GetRect(){ return sprite.GetSubRect(); }
     //.....
private:
     sfSprite sprite;
     //.....
};

class Paddle : public Sprite
{
//.....
}
class Ball : public Sprite
{
//.....
}
________
buy cannabis seeds

13
Graphics / How to use sfRect Intersect()?
« on: September 06, 2007, 11:29:11 pm »
Okey, I'm making a simple Arkanoid-game and having trouble using this sfRect public member function.

Code: [Select]

bool Intersects(const sfRect<T>& Rect, sfRect<T>* OverlappingRect = NULL) const;


I'm trying to use this function to tell when the paddle and the ball has collided however this doesn't seem to work. This is currently how I'm doing it:

Code: [Select]

void HandleBallToPlayerCollision()
{
      if( paddle->GetRect().Intersects(ball->GetRect()))
      {
             // Do stuff here.....          
      }
}


This method doesn't work. The function returns true even if there is no collision.
How should I do to make this work?
________
F-550

14
Graphics / Problem with image loading!
« on: September 05, 2007, 11:41:17 am »
Actually I've managed to solve the problem without altering my previous code.

Code: [Select]

if(paddleLeft->changeSize())
{
     delete paddleLeft;
     paddleLeft = new Paddle(image2,newXPos,newYPos);
}


Thanks for all the replys!
________
Naked

15
Graphics / Problem with image loading!
« on: September 04, 2007, 06:04:42 pm »
Quote from: "ExcessNeo"
Quote from: "Mindiell"
I don't think this is the good solution. What you do is having a 100x100 image and taking only the first 50x50 part...

My first question is :
- Why are you using the same sprite to draw 2 images ?


I was going to have questioned his methods but I thought I'd rather provide a working and very valid solution to his problem, in the style of his code to save arguement.

Although I do agree with you that the simple solution is to create a new Sprite for each image.


Ok, this seems to be a better way of doing it. I guess I'll have to rewrite some code  :evil: .
________
TEEN XXX

Pages: [1] 2
anything