weird loopy jamming my app

BlitzPlus Forums/BlitzPlus Beginners Area/weird loopy jamming my app

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

the 'no good idea' refers to the 'End' you put in the middle of your source.

You should end at the end, and not in the middle of your application. In some cases you can't just end.. you need to set the buffer to the desktopbuffer, and you might want to free some images, banks etc. before ending, otherwise you might get memory-leaks.

So, the only thing you should end is the main-repeatloop.. which can be done using a variable, like exit, or quit.. (which can be seen in my framework)

Framework is just the first piece of code you see here from me. It's just the thing you can fill-in with own stuff..

so again: *this* is a framework:
window=CreateWindow("bla",0,0,640,480)

;
;
; create more stuff here..
;
;

Repeat
	Delay 2
	WaitEvent()
	If EventID()=$803 quit=True
	
	;
	;
	; event-checks of the rest of the app
	;
	;
	
Until quit

;
; clean-up things like images, banks etc. *HERE*
;

SetBuffer DesktopBuffer()
End




Waitevent waits for events... that's all. When checking for events, you don't check "waitevent", you check EventSource(), EventData(), EventID(), EventX(), EventY()

When you have a single Waitevent in your loop then that's is enough for your whole application basically (few exceptions, but you're not even remotely up to that yet :)

So, 1 Waitevent, and for the rest those Events.., anywhere..