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

Pages: [1]
1
System / Re: No mathematical operator overloads?
« on: December 23, 2017, 09:07:54 pm »
Thanks, I now have the latest version

2
System / No mathematical operator overloads?
« on: December 23, 2017, 06:55:25 pm »
I find the necessity to multiply, divide, add and subtract a vector with a scalar number

Code: [Select]
spriteName.setPosition(Vector2f(myX,myY)/2);

When I try the following code, I get compilation error

Quote
binary '/': no operator found which takes a left-hand operand of type 'sf::Vector2f' (or there is no acceptable conversion)   

So I had to manually make my own (free-function) overload...

I checked on GitHub and there is actually an overload

Line 130 of this github page

Code: [Select]
template <typename T>
inline Vector2<T> operator /(const Vector2<T>& left, T right)
{
    return Vector2<T>(left.x / right, left.y / right);
}

But apparently it doesn't work



3
Graphics / Debug output is graphically different from Relese output
« on: December 22, 2017, 09:36:09 pm »
When compiling and running in Debug mode: http://prntscr.com/hr5t3d

When compiling and running in Release mode: http://prntscr.com/hr5tdx

All the libraries are correctly linked as written in the documentation.

What could the issue be?

P.S: If I rebuild the project, they produce the same result. What's happening?

4
Graphics / Re: Sprites not positioning the way I established
« on: December 22, 2017, 03:08:32 pm »
Thank you very much, it looks nice now!

So I was adding 1.5px more than required

Last thing though: when changing this calculation I notice a little misprint of the Pawn http://prntscr.com/hr0e9k

By setting setSmooth(true) on the Texture, the problem seems to be solved: http://prntscr.com/hr0g60

My question is: is there a particular reason for this phenomenon to happen only when I changed just a simple variable from const unsigned int sizeRectangle = 72 to const float sizeRectangle = 70.5f ?


5
Graphics / Re: Sprites not positioning the way I established
« on: December 22, 2017, 02:52:42 pm »
Changing the sizeRectangle from 72 to 70 made things way better!

Screenshot: http://prntscr.com/hr0681

The problem by the way is not 100% solved: the distance between the Pawn and the Left edge of the rectangle is not the same for every Pawn in the same row

As you can see: http://prntscr.com/hr07lw

The distance between the Pawn and the rectangle gets smaller and smaller

6
Graphics / Re: Sprites not positioning the way I established
« on: December 22, 2017, 12:52:34 am »
Hi, thanks for the answer.

Unofortunately that didn't solve the problem. Conversely, the problem accentuates: http://prntscr.com/hqrvyg

I'd like to point out that sizeEdge, sizeMargin and sizeRectangle are all integer values

7
Graphics / Sprites not positioning the way I established
« on: December 21, 2017, 11:46:08 pm »
Hello.

I'm making the Dame, a game similar to chess.

This is the board (screenshot): http://prntscr.com/hqr0hg

I'm trying to position the pawns into the Black cells through this algorythm

Quote
sprites[i++].setPosition(Vector2f(sizeEdge + sizeMargin + ((currentSquare - 1)*sizeRectangle), sizeEdge + sizeMargin + sizeRectangle*r));

currentSquare += 2;      // the next black slot can be found after 2 slots   

sizeEdge and sizeMargin are two areas of the board the pawn needs to move away from.

Here is an image that illustrates this: http://prntscr.com/hqr4ru

The edge is not part of the board and the margin is required to center the pawn into the rectangle.

(currentSquare - 1)*sizeRectangle is a simple calculation to get the number of rectangles the pawn needs to move away from (because they're either white - inaccesible - or occupied by other pawns before)

The result of the algorythm is this: http://prntscr.com/hqr61m

As you can see (ignore the white pawn) the more we move to the right, the more the position of the pawns is uncorrect.

And this also repeats for the rows below.

I can't understand where's the issue here. My mathematical formula looks correct... what is causing this issue?

Thanks in advance!

Pages: [1]
anything