Graphic problem

BlitzPlus Forums/BlitzPlus Beginners Area/Graphic problem

Normsthename(Posted 2008) [#1]
I am new to Blitz Plus after upgrading from Blitz Basic.
I am having a problem running simple programs.
When I run the following program I just get a Black window (Blitzcc)
No graphics are drawn.
The only way I can get it to draw the graphics is to click the Blitz Debugger TAB, and then the BLitzcc Tab.
The graphics then draw correctly.

This is a sample Program supplied with Blitz Plus that exhibits the problem :-

; Line example
Graphics 800,600,16
; Wait for ESC to hit
While Not KeyHit(1)
; Set a random color
Color Rnd(255),Rnd(255),Rnd(255)
; Draw a random line
Line Rnd(800),Rnd(600),Rnd(800),Rnd(600)
Wend

Any ideas what I am doing wrong.

TIA

Andy


Rafery(Posted 2008) [#2]
; Line example 
Graphics 800,600,16 
; Wait for ESC to hit 
While Not KeyHit(1) 
cls ; <-- you forgot this
; Set a random color 
Color Rnd(255),Rnd(255),Rnd(255) 
; Draw a random line 
Line Rnd(800),Rnd(600),Rnd(800),Rnd(600) 
Flip ; <-- and this
Wend



Sauer(Posted 2008) [#3]
It is also good to get into the habit of setting the buffer to backbuffer before you begin your program... just add the line "Setbuffer Backbuffer()" before you're main loop.


Normsthename(Posted 2008) [#4]
I have finally found the 'Bug'
The program I am writing uses a Window Canvas.
When the program was starting up, if the mouse pointer did not touch the canvas screen area, it would not initialise the graphics.
I was really pulling my hair out over this (What I have left!)
I fixed it by setting an initial mouse position on the Canvas screen using the mousemove command.
I know all you experienced programmers will be rolling your eyes, but it might help another Newbie!

Andy