Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Different outputs for GetPosition  (Read 2824 times)

0 Members and 1 Guest are viewing this topic.

zarcel

  • Newbie
  • *
  • Posts: 6
    • View Profile
Different outputs for GetPosition
« on: March 26, 2011, 02:19:50 pm »
Hi!
I'm newbie at gamedev and I have choosen pong to be my first game. I made simple display of Get.Position for 2 spirites (rectangles) and one shape created using helper class(circle).

I place all things in center  of x and in different y's as you can imagine. My problem is that GetPosition for rect's gives me 375 and its correct, while circle gives me 10. What should i do ?

Ofc I mean x variable all the time.

And since I don't wanna start another topic. My performance really dropped down since I put that debug info into game loop. I did it using cout. any ideas to fix it ?

Svenstaro

  • Full Member
  • ***
  • Posts: 222
    • View Profile
Different outputs for GetPosition
« Reply #1 on: March 26, 2011, 03:11:08 pm »
I suppose your origins are different. The origin of the sphere probably is the center while the origin of the rects is top left. Use SetOrigin if you do not like them.

As for performance, take out debug statements when you are not using them.

zarcel

  • Newbie
  • *
  • Posts: 6
    • View Profile
Different outputs for GetPosition
« Reply #2 on: March 26, 2011, 03:24:41 pm »
Yeah, you are right, I just figured it out by myself, but anyway thx for anwser. As for debug statements I will probably have to delete them.

devlin

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Different outputs for GetPosition
« Reply #3 on: March 26, 2011, 06:57:07 pm »
or wrap them in:

#if !defined(_DEBUG).

Or make a function that does nothing when in Release mode - but debuggy-stuff when in Debug. :)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Different outputs for GetPosition
« Reply #4 on: March 26, 2011, 07:57:12 pm »
Quote from: "devlin"
#if !defined(_DEBUG).
Or maybe better #ifdef NDEBUG. I am not sure if _DEBUG is standardized.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

JAssange

  • Full Member
  • ***
  • Posts: 104
    • View Profile
Different outputs for GetPosition
« Reply #5 on: March 26, 2011, 09:25:06 pm »
Quote from: "Nexus"
Quote from: "devlin"
#if !defined(_DEBUG).
Or maybe better #ifdef NDEBUG. I am not sure if _DEBUG is standardized.

I believe VC++ uses _DEBUG and Xcode uses debug. Anyway, #ifndef is easier then bothering with defined.

devlin

  • Full Member
  • ***
  • Posts: 128
    • View Profile
Different outputs for GetPosition
« Reply #6 on: March 27, 2011, 08:56:39 am »
Quote from: "JAssange"
. Anyway, #ifndef is easier then bothering with defined.

Unless of course you want to combine it with anything else.

Code: [Select]
if !defined(_DEBUG) && !defined(_BETA)

as an example.