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

Pages: [1] 2 3
1
Graphics / Re: Nothing in Graphics module compiles!
« on: January 29, 2015, 04:55:55 am »
A quick look to the error and I would ask :

Did you link the jpeg libs to your project? Because most of them are jpeg related.

2
General / Re: Linking error (I believe). Need help.
« on: January 26, 2015, 11:05:27 pm »
You entered the libraries in the wrong order...

In Codeblocks, the very first library at the top is the last to be link.

3
Java / Re: Update window?
« on: January 24, 2015, 06:22:26 pm »
Simply use the link Hapax gave you:

//Fill the window with red
    window.clear(Color.RED);

 //Display (Redraw the window)
    window.display();
 

4
General / Re: Memory leak
« on: August 22, 2014, 12:15:31 am »
When do you delete RectSprite? Also if you want to create a tile map (Or anything with a grid) use sf::VertexArray instead.

5
Graphics / Re: Angle between 2 points
« on: August 21, 2014, 04:01:23 pm »
I do know what is an arctan. My english is not very good and I probably didn't said what I wanted to say.

I will rephrase:

atan2 is waiting for two value x and y and after compute arctan(y/x), however the y and x value must come from
a rectangle triangle.

Try computing the angle between pointA = (0,3), pointB  = (1/2, sqrt(3)/2) using the formula of electrux gives an angle of 90... but the true angle is 30 degres between them.

On the other hand the scalar product gives the correct angle:

<A,B> = Ax Bx + Ay By = ||A|| ||B|| cos (angle) => angle = acos( (Ax Bx + Ay By) / (||A|| ||B||) )

6
Graphics / Re: Angle between 2 points
« on: August 21, 2014, 02:31:40 pm »
Be careful with trigonometric function, they only works with rectangle-triangles (As one 90 degres angle).

If your triangle is not rectangle then use scalar product.

Also to calculate an angle you need three points, not 2.

7
Graphics / Re: Odd values for a sprite I'm trying to display
« on: July 01, 2014, 10:04:29 pm »
Use reference.

sf::Sprite& GetSprite(){ return sprite; }
 

I am pretty sure it will works.

8
General / Re: Entity Manager
« on: June 11, 2014, 06:13:19 am »
Can I see what you did, I am pretty sure you did not fix it properly.

9
General / Re: Entity Manager
« on: June 11, 2014, 06:07:30 am »
It's more an C++ issue than a SFML one...

But

void addEntity(Entity* e)
 

is waiting for an Entity*, but you do not pass any in here

game.addEntity();
 


10
Graphics / Re: Line spacing error
« on: May 30, 2014, 08:04:26 pm »
Also rather than using
xPos += 12;
, the glyph class provide an advance value for each glyph.

11
Graphics / Re: VertexArray is not drawn
« on: May 30, 2014, 07:39:44 pm »
I tried your code on my PC and everything works fine. Try checking if Tileset is correctly load

if( !m_tileset.loadFromFile("Tileset.png") )
{
return -1; //error
}
 

12
General / Re: understanding noncopyable objects
« on: May 24, 2014, 04:35:08 am »

changeWindow(sf::RenderWindow &window) : mainWindow(&window)
{
    mainWindow -> window;
}
 

I have a basic understanding of passing objects by reference and using pointers but what I really don't understand is, what the heck is that colon and the "->" doing or what it's called?


In short

mainWindow -> window;

//is equivalent to

(*mainWindow).window
 

To explain it in simple words the -> access what is pointed by a pointer. Search pointer on the net for clear detail (Or check official C++ website). Also, the colon is related to constructor and is a common way to initialize attributes. So search "C++ constructor" on the net...





13
Graphics / Re: The shapes are not been position correctly?
« on: May 16, 2014, 05:55:55 am »
So i'm trying to position the rectangle in the middle of the window, however, everytime i increase the y value of the rectangle position, it seems to go down instead. Here is the code:

It's normal, (0,0) is the upper left part of the screen. Increasing y value will make your rectangle to go down.

How can i get the rectangle in the middle?

x = Screen Width / 2 - Rectangle width / 2
y = Screen Height / 2 - Rectangle Height / 2

14
C / Re: can't set sfVector2f in 2.1?
« on: May 07, 2014, 06:16:10 am »
It's been a while since I programmed in C ( I now program in C++11 ).

 If sfVector2f is a struct (which is probably the case), you can use an initializer list

sfVector2f Vector = { floatX, floatY };
 

for the other part:

sfCircleShape_setPosition(shape,(sfVector2f){wmode.width/2.0f - radius, wmode.height/2.0f - radius})
 

I can not tell. Sorry.


15
C / Re: can't set sfVector2f in 2.1?
« on: May 07, 2014, 02:16:44 am »
It's clear what the problem is...

You are trying to create a instance of a class in the C language. Class does not exists in C.

Pages: [1] 2 3