The X

BlitzPlus Forums/BlitzPlus Programming/The X

Petron(Posted 2006) [#1]
I've been programming for a long time, but I just got new software. How do you make the program have an X in the corner, like the other programes that windows makes


CS_TBL(Posted 2006) [#2]
Just create a window:
MyWindow=CreateWindow("title",0,0,640,480)

or a Graphics-mode:
Graphics 640,480,32,2

but uhm ... ^_^ tried any example from the manual yet?


Kuron(Posted 2006) [#3]
or a Graphics-mode:
Graphics 640,480,32,2

but uhm ... ^_^ tried any example from the manual yet?
Perhaps you should? In graphics mode you do not get ANY gadgets on the window: no close, no minimize, no maximize.


CS_TBL(Posted 2006) [#4]
Ah, oops, yes, well, hihi .. paaard'n me ^_^ somehow I had this idea of a graphics window with a closebutton in the corner. must 've been confused with a console window orso..

Well, go with CreateWindow then..


Kuron(Posted 2006) [#5]
somehow I had this idea of a graphics window with a closebutton in the corner.
Only in B2D/B3D ;c)


Petron(Posted 2006) [#6]
thanks


Grey Alien(Posted 2006) [#7]
It IS possible in graphics mode, it's how I did it for Easter Bonus etc. You have to make windows API calls and use BlitzClose.dll to detect the close happening. I'm sure that it's easier with create window though.

Have a look at this:

http://www.blitzbasic.com/Community/posts.php?topic=58413#649712


Kuron(Posted 2006) [#8]
It IS possible in graphics mode
No its not, you are digging into the api and a third-party dll to handle what B+ natively does ;c)

Unless you are making a game fullscreen, you will always want to use the GUI & event-driven commands in B+ as you are writing the game/app for an event-driven OS. If you don't, you will run into tons of timing issues and other incompatibilities as your program tries to hog the CPU and interferes with the normal operation of the OS.

If you are doing full-screen in B+, you will want to use the event-driven commands so your game will properly integrate with Windows and not hog the CPU and give you unnecessary timing issues to deai with.


Grey Alien(Posted 2006) [#9]
or stick Delay(1) in the main loop ...


Kuron(Posted 2006) [#10]
or stick Delay(1) in the main loop ...
That would be a half-assed approach as you are pausing your program/game whether it needs to or not. Using events properly, it will only pause if it needs to.

DOS isn't coming back, you might as well get used to programming for Windows. ;c)


Grey Alien(Posted 2006) [#11]
I've been a professional Windows developer for 10 years (since windows 95), it's bought me my house, car and many other things. That's my day job in fact. However, yes Delay(1) is not ideal but if you want to make your game using Graphics, and call Flip and use all the normal game-based keyboard/mouse input stuff you can use Delay(1) in the main loop to give windows back some time. I never liked this too, as I felt it meant your game lost 1ms per frame of calculation/drawing time.


Kuron(Posted 2006) [#12]
I've been a professional Windows developer for 10 years (since windows 95),
Then you should know better ;c)


Grey Alien(Posted 2006) [#13]
Thing is, I've had to hack, bludgeon and cajole Windows into doing what I want for years due to loads of dumb things it does.


Kuron(Posted 2006) [#14]
Thing is, I've had to hack, bludgeon and cajole Windows
Oddly enough, I find I have to do that more with MS made programming languages than non-MS made programming languages.