How to restart the program?
Blitz3D Forums/Blitz3D Programming/How to restart the program?
| ||
Hello, is there any way to... like close the window then re-open it from the beginning? Sort of like restarting it? If not, is there any way to clear all of the test from the screen? Thanks! |
| ||
Ah, child you have so much to learn. The easy answer to clear the screen is the command Cls. Put it in, it will clear the text off the screen. If you are using the print command, clearing the screen will not make the next print command start at the top. To do that, use the command Locate 0,0. I will give you an example of what I am talking about.Print "Hello" Print "The program will clear in 2 seconds" Delay 2000 Cls Print "As you can see, it cleared but the" Print "text is on the third line." Delay 2000 Print "" Print "I am now going to clear it again" Delay 2000 Cls Locate 0,0 Print "As you can see, the text is back in the first place." Waitkey() End That should work, I just wrote it in here, so if you have any questions, just ask. |
| ||
If you want to simply clear the screen to be able to write text or 2d things (plot, lines, rects, ovals), you can use : ClsColor(R%,G%,B%) Cls() If you want to delete all entities (camera, listener, pivots, meshes), all brushes, all textures, you can use : Clearworld() If you want to reinitialize the properties of the graphics window, you can use : EndGraphics() Goto Line (where "Line" is a label before Graphics3d(PWidth,PHeight,Colors,Mode)) |
| ||
Thank you... I was looking around the forums, and the few I happened upon said that this was impossible. Thank you. |
| ||
Wait... the Cls command causes my program to "Not Respond" |
| ||
Turn debug mode on, and/or create a graphics context with the Graphics() function. |
| ||
ok now i get the error "Invalid Blitz2d Buffer handle |
| ||
post the exact code, and you are using blitz 3d right? also go into help>about blitz and give me the versions numbers |
| ||
My first impression was this new user was referring to loss of graphics and so on, but it seems you are very new to programming itself considering your question about the buffer. My suggestion is to start with the commands, and especially, already working examples that you can compile with no problems. I say this not because I'm an arrogant troll, but because I started programing at thirty instead of three, and starting with working examples, and studying each command, sometimes understanding only two or three a day, was the only way to go for an absolute beginner like me. |
| ||
I'm not sure if this will work, but if it does, it's the closest that one can get to restarting the program:;Consider your compiled blitz program as "MyProgram.exe." ExecFile "MyProgram.exe" ;Execute its own executable. End ;End this instance of 'MyProgram' right now. If you want the program to know it's being run from a restart, add some sort of command line parameter: ExecFile "MyProgram.exe -restart" EndThe command line string can be caught with CommandLine() and then you can interpret it any way you want. If by any chance the restarted instance of the program does not have focus, you can force-focus it by making use of the SetFocus function of User32 (from this userlib DECLS). api_SetFocus( SystemProperty( "AppHWND" ) ) ;Restore focus to my blitz program. |
| ||
@AngelOnFira wtf? I could have sworn I posted this under Blitz2d |
| ||
any idea how to "move" this? |