SOGUI Advice
by Justin Proffitt · in Torque Game Builder · 09/14/2011 (8:36 pm) · 0 replies
Edit: Restarting this post.
I am using sceneobjects for my GUI, and it has been working well, except for in this one instance.
I have a map I want to appear self contained: objects move in and out of it constantly. To make the objects disappear as they went off the map, I created a buffer sprite that simply encloses the map and overlaps any objects moving out of it. It works great, except when I change resolutions or computers. The problem is that it requires perfect pixel rendering, which I thought wouldn't be a problem as long as I used a imagemap sized exactly to the sprites dimensions (8 pixels to a world unit) and it was a nice even number. I believed that pixels would map directly 1 to 1, and scale up fine. However, well, it doesn't. Changing the resolution or changing computers changes the results: some or all of the edges of the map (outlined with a t2dShapeVector) get covered up by the map buffer. Either the sprite seems to be rounding its pixels or the t2dShapeVector is, I would think it would be the latter.
So i was wondering, would anyone happen to have some advice on avoiding this pixel rounding? I would greatly appreciate any tips or suggestions on how I could even do this whole thing differently, any direction will do me better than this.
Edit: I discovered a simple (hacky) work around: lay a separate t2dshapevector on top of the entire thing to make the outline. (I couldn't do this with the original because it becomes opaque during certain operations, and the GUI effects need to still be visible but constrained in the map, therefore it has to be set between the map and buffer layers.)
I am using sceneobjects for my GUI, and it has been working well, except for in this one instance.
I have a map I want to appear self contained: objects move in and out of it constantly. To make the objects disappear as they went off the map, I created a buffer sprite that simply encloses the map and overlaps any objects moving out of it. It works great, except when I change resolutions or computers. The problem is that it requires perfect pixel rendering, which I thought wouldn't be a problem as long as I used a imagemap sized exactly to the sprites dimensions (8 pixels to a world unit) and it was a nice even number. I believed that pixels would map directly 1 to 1, and scale up fine. However, well, it doesn't. Changing the resolution or changing computers changes the results: some or all of the edges of the map (outlined with a t2dShapeVector) get covered up by the map buffer. Either the sprite seems to be rounding its pixels or the t2dShapeVector is, I would think it would be the latter.
So i was wondering, would anyone happen to have some advice on avoiding this pixel rounding? I would greatly appreciate any tips or suggestions on how I could even do this whole thing differently, any direction will do me better than this.
Edit: I discovered a simple (hacky) work around: lay a separate t2dshapevector on top of the entire thing to make the outline. (I couldn't do this with the original because it becomes opaque during certain operations, and the GUI effects need to still be visible but constrained in the map, therefore it has to be set between the map and buffer layers.)
About the author
I am a college student majoring in physics. As it so happens I like programming, a hobby which extends my profession in web design.