And here's the result. (attached as PNG)
[attachment=5807:Capture.PNG]
How on earth is this happening? The "Options" and "Exit" buttons clearly have larger Y-coordinates than "Start Game"!
I have tested and tested and tested all my matrix creation functions, (the same thing happens with D3DXMATRIX).
Font is my own implementation, I will post it up if required.
Having the origin (0,0) be in the lower left rather than the upper left of the screen is quite common. It's all in how your projection matrix is created.
I wrote the code that created the projection matrix, and I know 3D math. Trust me, this is not the problem. If you look at the order in which the buttons are inserted into the list, this could still not explain the order in which they are appearing onscreen.
I think the problem could be in the replacement of the worldViewProj matrix in the effect/vertex shader constants, but I don't know about how this works.
I assume you've run under a debugger and confirmed that (1) the numbers in the list are correct and (2) the numbers produced by your matrix math are correct?
Have you stripped the code down to a minimal example that reproduces the problem? Alternatively, can you reproduce this kind of error in any other situations?
[edit] And maybe at the risk of probing a bit too hard - since the code you posted is definitely not the code you're running (it shouldn't even compile with z instead of y), are you absolutely sure that there are no other differences between what you're actually running and what is posted?
Explicitly define the = operator for your Button structure.
A sneaky suspicious tells me that will solve all of your problems and remove your invalid-access waiting to happen.
L. Spiro
I restore Nintendo 64 video-game OST’s into HD! https://www.youtube.com/channel/UCCtX_wedtZ5BoyQBXEhnVZw/playlists?view=1&sort=lad&flow=grid