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

Pages: [1] 2
1
Graphics / Comparing Coordinates
« on: August 27, 2009, 06:53:45 pm »
You want to stop ur sprite from going out of the screen when moving, is that right? If thats what you want, u could use something like this.

Code: [Select]
if (mySprite.GetPosition().y > myWindow.GetWidth())
    {
          // sprite stops moving
     }

If thats not what you wanted, tell me with what u want to compare the sprite coordinates.

Edit: Tell me where are you from and maybe I can speak ur language.

2
Graphics / Comparing Coordinates
« on: August 27, 2009, 06:29:02 pm »
I dont understand very well what you are asking, but if you want to find the coordinates of ur sprite, you can use the GetPosition function.

3
Graphics / App crashes if more than 1 sprite used
« on: August 27, 2009, 04:26:06 pm »
That code works on me. I get a lot of first chance exceptions but the window still shows. I'm using winxp prof sp3 too, and Visual C++ 2008.

4
Graphics / Buffer overrun when loading image
« on: August 25, 2009, 06:50:00 pm »
Quote
Devil0150 wrote:
Quote
Inside double quotes / and // is the same.

No, it is definitively not the same. Accordingly, your path containing double slashes is invalid.

I meant none of them makes the text a comment. The error message says:

Code: [Select]
A buffer overrun has occurred in Program.exe which has corrupted the program's internal state. Press Break to debug the program or Continue to terminate the program.

For more details please see Help topic 'How to debug Buffer Overrun Issues'.


But I fixed it. It happened because the first time I compiled the code, I got some warnings. And I tried to remove them by removing the -d from the stuff I put in the Linker. The warnings were removed but thats when the buffer error started to show. Now that I put the -d, the buffer overrun error doesnt happen anymore.

5
Graphics / Buffer overrun when loading image
« on: August 25, 2009, 03:45:54 pm »
I know. Any idea about what I asked?

6
Graphics / Buffer overrun when loading image
« on: August 25, 2009, 01:42:16 pm »
Inside double quotes / and // is the same. The text doesnt get green (comment color) even if I use //. And Yes, the Code compiles.

7
Graphics / Buffer overrun when loading image
« on: August 25, 2009, 01:35:28 pm »
Code: [Select]
Piece::Piece()
{
imgPiece.LoadFromFile("C://Documents And Settings//User//My Documents//My Pictures//piece.bmp");
sprPiece.SetImage(imgPiece);
}


I am using visual c++ 2008 and when I start the program I get a buffer overrun on the this line:

Code: [Select]
imgPiece.LoadFromFile("C://Documents And Settings//User//My Documents//My Pictures//piece.bmp");

I even tried \\ instead of //. It still doesnt work.

What did I do wrong?
Did I miss something on the tutorials?

8
Graphics / [solved]Rectangle inside Rectangle
« on: July 30, 2009, 07:02:37 pm »
I fixed it accidentally while posting here. thx.

9
Graphics / [solved]Rectangle inside Rectangle
« on: July 30, 2009, 06:02:20 pm »
Here is my code. I'm trying to make a simple Paint program.

Code: [Select]

sf::RenderWindow Paint(sf::VideoMode(800, 600), "Paint");

sf::String GetString()
{
sf::Input mouseInput;
std::stringstream out;
out << "x: " << Paint.GetInput().GetMouseX() << "\ny: " << Paint.GetInput().GetMouseY();
std::string myString;
myString = out.str();
sf::Unicode::Text myText(myString);
sf::String thisString(myText, sf::Font::GetDefaultFont(), 15);
return thisString;
}


class DrawingSpace
{
public:
sf::Shape Rect1;
DrawingSpace(sf::RenderWindow* Paint)
{
        // the color panel
sf::Shape Panel = sf::Shape::Rectangle(0, 0, 100, 600, sf::Color(100, 100, 100));
Paint->Draw(Panel);
// the white color
Rect1 = sf::Shape::Rectangle(10, 100, 90, 190, sf::Color(0, 0, 0));
Paint->Draw(Rect1);
// the drawing space
sf::Shape space = sf::Shape::Rectangle(100, 0, 800, 600, sf::Color(0, 0, 0));
Paint->Draw(space);
}
};

int main()
{
DrawingSpace* Space = new DrawingSpace(&Paint);
while (Paint.IsOpened())
{
sf::Event myEvent;
while (Paint.GetEvent(myEvent))
{
if (myEvent.Type == sf::Event::MouseMoved)
{
Paint.Clear();
delete Space;
Space = new DrawingSpace(&Paint);
Paint.Draw(GetString());
}

if (myEvent.Type == sf::Event::Closed)
Paint.Close();
}
Paint.Display();
}
return  0;
}

10
Graphics / [solved]Rectangle inside Rectangle
« on: July 29, 2009, 12:52:59 pm »
I couldnt upload at imageshack so I did it here.

This is how it is:
[img=http://www.freeimagehosting.net/uploads/4bc1a8c0d2.jpg]

And this is how it should be:
[img=http://www.freeimagehosting.net/uploads/a38284f572.jpg]

11
Graphics / [solved]Rectangle inside Rectangle
« on: July 29, 2009, 12:21:05 pm »
I dont know how to put an image here but I'll try to explain.
I have two Rectangles
Code: [Select]

    Rect 1                                               Rect2
__________                                       _________________
|         |                                      |                |
|         |                                      |                |
|         |                                      |                |
|_________|                                      |                |
                                                 |                |
                                                 |                |
                                                 |                |
                                                 |                |
                                                 |________________|


And I put Rect1 inside Rect2 but I see only Rect2. Rect1 isnt visible.
This is how it should look:

____________________
|             Rect2 |
|                   |
|                   |
|     _________     |
|    |   Rect1 |    |
|    |         |    |
|    |         |    |
|    |_________|    |
|                   |
|                   |
|___________________|


And this is how it looks
____________________
|             Rect2 |
|                   |
|                   |
|                   |
|                   |
|                   |
|                   |
|                   |
|                   |
|                   |
|___________________|

12
Graphics / [solved]Rectangle inside Rectangle
« on: July 29, 2009, 08:15:28 am »
You mean like this :
Code: [Select]

sf::Shape Rect1;
//...
sf::Shape Rect2 = sf::Shape::Rectangle(0, 0, 100, 600, sf::Color(100, 100, 100));
Window->Draw(Rect2);
Rect1 = sf::Shape::Rectangle(10, 100, 90, 190, sf::Color(255, 255, 255));
Window->Draw(Rect1);


I tried and it didnt work.

13
Graphics / [solved]Rectangle inside Rectangle
« on: July 28, 2009, 10:48:26 pm »
This is the code that makes two rectangles. One inside the other. But I can't see the small rectangle. I tried lowering the Alpha of the big rectangle color and I saw the small rectangle, but not in white color of course. Is there anyway to choose which rectangle is drawn last or something. (I tried changing the changing places of draw statements on the code but didnt work.)

Code: [Select]

sf::Shape Rect1;
...//some code here
{
Rect1 = sf::Shape::Rectangle(10, 100, 90, 190, sf::Color(255, 255, 255));
Window->Draw(Rect1);
sf::Shape Rect2 = sf::Shape::Rectangle(0, 0, 100, 600, sf::Color(100, 100, 100));
Window->Draw(Rect2);
}

14
Window / [solved]Problem with string
« on: July 28, 2009, 06:18:21 pm »
I didnt find anything for mouse Input at the Tutorials and I dont understand it very well at the documentation.
But i fixed it reading this post.

Thanks anyway.

15
Window / [solved]Problem with string
« on: July 28, 2009, 06:10:04 pm »
I made this piece of code to display the mouse position on the screen but it doesn't work.

Code: [Select]
sf::String GetString()
{
sf::Input mouseInput;
std::stringstream out;
out << "x: " << mouseInput.GetMouseX() << "\ny: " << mouseInput.GetMouseY();
std::string myString;
myString = out.str();
sf::Unicode::Text myText(myString);
sf::String thisString(myText, sf::Font::GetDefaultFont(), 15);
return thisString;
}

int main()
{
sf::RenderWindow myWindow(sf::VideoMode(800, 600), "myWindow");
while (myWindow.IsOpened())
{
sf::Event myEvent;
while (myWindow.GetEvent(myEvent))
{
if (myEvent.Type == sf::Event::MouseMoved)
{
myWindow.Clear();
myWindow.Draw(GetString());
}
if (myEvent.Type == sf::Event::Closed)
myWindow.Close();
}
myWindow.Display();
}
return  0;
}


The problem is that the string that the numbers that should display the position, are always 0.

x: 0
y: 0

Whats wrong here?

Pages: [1] 2
anything