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

Author Topic: [Solved] This Makes No Sense  (Read 1641 times)

0 Members and 1 Guest are viewing this topic.

Wander

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • Email
[Solved] This Makes No Sense
« on: January 09, 2011, 09:24:55 am »
I created a class that creates buttons for the user and I gave it some members to set the justification and the position.
I have about 6 or so buttons created in the format of a menu and a strange thing is happening with them.

I pose you this question: "Does it make any sense that multiple objects with the EXACT same constructor and argument values, the EXACT same members and argument values, with no value changes of any kind, excluding a single boolean when the object is clicked, between creation and drawing come out different?"

Didn't think so. Well, this is the weirdest thing I've seen in a while.

The menu is divided into a few pages. I'll show you two of them because that's all I have programmed.



Uploaded with ImageShack.us
^ These buttons are actually spot on. They are centered and everything... In fullscreen. I can't get them to center in the window, but when it's in fullscreen they are perfect.


By wander_lazoren at 2011-01-09

^ It says Story Mode on the Options menu because I was testing to see if the length of the string had anything to do with it.
These however, are totally screwed up. The information for the two sections of buttons is exactly the same. I had the console display the numbers and the numbers came out were displayed the same.
I don't know if this is a compiler error or if this is SFML acting up or what.

Every single button had these members used with these arguments.
Code: [Select]
StoryMode.SF_Text.SetFont(TwoForJuan);
StoryMode.SetText("Story Mode");
StoryMode.SetPosition(StartWindow.GetWidth()/2 - StoryMode.WidthHeight.x/2, 347);
StoryMode.SetHighlightColor("YELLOW");
StoryMode.SetButtonColor("WHITE", "WHITE");


Starting after the creation here is exactly what happens in the code until the rendering of the options menu.

1. Wait for event of clicking on a button (Main Menu is displayed)
2. Set Button.Clicked to true.
3. Enter new while loop and event loop.
4. Wait for event of clicking on a button (Options Menu is displayed)
5. Set Button.Clicked to true.
6. Enter new while loop and event loop.
7. This stuff repeats until you either close the window or press the exit button.

Notice that no values were changed excluding the boolean to say when you clicked the button.
-Wander

Terrydil

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
[Solved] This Makes No Sense
« Reply #1 on: January 09, 2011, 06:18:05 pm »
Can you show the implementation of StoryMode, or minimal example that reproduces the problem?  My initial guess is that somewhere StoryMode.WidthHeight.x is 0, so when you set position its just getting set to (StartWindow.GetWidth()/2 , 347).  One way to test if there is an error creeping in would be to temporarily hard code the x value the way you do the y and see if it displays where you expect.

Wander

  • Full Member
  • ***
  • Posts: 170
    • View Profile
    • Email
[Solved] This Makes No Sense
« Reply #2 on: January 09, 2011, 08:51:56 pm »
Oh! Thank god! I found the problem. I deduced that the problem was occurring between setting them in the exact same position and rendering. It was indeed. I found out that I was rendering the two pages on two separate views instead of the same views.
Thanks for the help. :D
-Wander