|
Post by randomguy on Mar 23, 2023 18:30:51 GMT -5
So I am trying to build the game "Pong" but when using StaticText or Graphic Text in my graphic box, the text seems to be removed on my game loop even though my game loop doesn't alter anything other than moving the ball and paddles. What might be causing this? Thanks.
|
|
|
Post by Chris Iverson on Mar 23, 2023 19:01:28 GMT -5
The graphicbox doesn't work too well with other controls on top of it. If something in the graphicbox itself gets redrawn, I think it redraws the whole box, and doesn't redraw any controls on top of it afterwards. They're still there, but covered up.
You might see them come back if you cover up the window with another one, or minimize and restore it.
You might also be able to use an API call to tell Windows to redraw the hidden controls, but it all boils down to issues with other controls on top of it.
|
|
|
Post by Brandon Parker on Mar 23, 2023 19:04:38 GMT -5
First, there is no real reason to use a StaticText on top of a GraphicBox control, but if you really want to do so, you should set the StaticText parent to be the GraphicBox using Windows API after opening your window and then set it back to the normal window before closing.
Also, if you are writing text or other graphics that need to stick for any duration, you should look into the Flush command and Segment/DelSegment commands.
If you can post runnable code, we can help out with it a lot more.
{:0)
Brandon Parker
|
|
|
Post by randomguy on Mar 24, 2023 16:25:07 GMT -5
First, there is no real reason to use a StaticText on top of a GraphicBox control, but if you really want to do so, you should set the StaticText parent to be the GraphicBox using Windows API after opening your window and then set it back to the normal window before closing. Also, if you are writing text or other graphics that need to stick for any duration, you should look into the Flush command and Segment/DelSegment commands. If you can post runnable code, we can help out with it a lot more. {:0) Brandon Parker How else would I do it if I don't put the text on the graphicbox?
|
|
|
Post by Rod on Mar 25, 2023 2:27:04 GMT -5
You can write text directly to the graphicbox with the Place x y and then \text command. This does not work for sprites. You can have sprite based letters. You can layer a second graphicbox over the sprite graphicbox and write text to it. That works best when the backgrounds are the same colour. You can write text transparently using API. If needed. So there is a lot to explore.
You would get better help if you posted some code showing exactly what you want to do. What text,where on what sort of graphicbox, over what sort of image and background?
|
|