Help! Why does this fail!

Blitz3D Forums/Blitz3D Beginners Area/Help! Why does this fail!

Hansie(Posted 2003) [#1]
all,

look at this code:

Const	vh_scrwidth%		=	1024
Const	vh_scrheight%		=	768
Const	vh_scrdepth%		=	0
Const	vh_scrmode%		=	0 		; 0 : auto - windowed in debug, fullscreen in non-debug) 
									; 1 : fullscreen mode
									; 2 : windowed mode
									; 3 : scaled window mode

	Graphics vh_scrwidth,vh_scrheight,vh_scrdepth,vh_scrmode
	print_debug_info()

While Not KeyHit(1)








Wend


	End


; *****************************
; ONLY FOR DEBUGGING PURPOSES
; *****************************

Function print_debug_info()
	totalDrivers%=CountGfxDrivers() 
	r_dec%=0 : g_dec%=0 : b_dec%=0
	r_hex$=0 : g_hex$=0 : b_hex$=0	
	r_dec=ColorRed() : g_dec=ColorGreen() : b_dec=ColorBlue()
	r_hex=Hex$(r_dec) : g_Hex=Hex$(g_dec) : b_Hex=Hex$(b_dec)

	Cls
	Print "Date                          : " + CurrentDate()
	Print "Time                          : " + CurrentTime()
	Print "PlayField Width               : " + GraphicsWidth()
	Print "PlayField Height              : " + GraphicsHeight()
	Print "PlayField Depth               : " + GraphicsDepth()
	Print "PlayField Memory              : " + GraphicsBuffer()
	Print "PlayField Drawing Color (DEC) : " + r_dec + " " + g_dec + " " + b_dec
	Print "PlayField Drawing Color (HEX) : " + Right$(r_hex,2) + " " + Right$(g_hex,2) + " " + Right$(b_Hex,2)
	Select JoyType() 
	Case 0 
	Print "Joystick                      : None" 
	Case 1 
	Print "Joystick                      : Digital" 
	Case 2 
	Print "Joystick                      : Analog"  
	End Select 
	For t = 1 To totalDrivers 
	Print "Installed GFX driver(s)       : " + GfxDriverName$(t) 
	Next
	Print "Total GFX memory on card      : " + TotalVidMem() + " " + "(Bytes)" + " " + (TotalVidMem() / 1024) + " " + "(Mb)"
	Print "Avail GFX memory              : " + AvailVidMem() + " " + "(Bytes)" + " " + (AvailVidMem() / 1024) + " " + "(Mb)"
	Print "Operating system installed    : " + SystemProperty("OS")
	Print "CPU installed                 : " + SystemProperty("CPU")
End Function


It works PERFECTLY in Blitz3D, but when run in BlitzPlus, all I get is a BLACK screen?

Can someone explain????

I H-A-T-E when that happens!


Floyd(Posted 2003) [#2]
Print is now for console mode only.

Here is a program shell I wrote for little test programs in BlitzPlus.
Graphics 640, 480, 0, 2

Global xPrint = 10 , yPrint = 10
;*********************************************

Write "Hello "
Print "world."


Flip  :  FlushEvents  :  WaitEvent  :  End

;*********************************************
Function Print( s$="" )
	Text xPrint, yPrint, s
	yPrint = yPrint + 15
	xPrint = 10
End Function

Function Write( s$="" )
	Text xPrint, yPrint, s
	xPrint = xPrint + StringWidth( s )
End Function

This is good enough for one screen of output.
Anything larger and you should write a real BlitzPlus program.

Or just dump everything to the Debuglog.


Hansie(Posted 2003) [#3]
thanks Floyd,

but that does still not explain why my code works perfectly in Blitz3D and fails totally in BlitzPlus

Hansie


Zace(Posted 2003) [#4]
What is Scrdepth=0 supposed to do ? I thought that was the number of colours (well bits pwe pixed, thus giving colours)


soja(Posted 2003) [#5]
Zace, if the color depth is set to 0, then Blitz automatically detects it and uses what it thinks is best.

Hansie, are you using a beta of Ed from Mars' IDE? It does not send Print statements to a console. If you run it straight from the BlitzPlus IDE (in debug mode), it works fine, though it pops up a console window for the Print statements.


Floyd(Posted 2003) [#6]
BlitzPlus uses Print for console mode only.

Once you set a graphics mode Print is not available.
This is why my code provides a simulated Print, actually using Text.

Color depth is set to 0 because of windowed mode graphics, i.e. mode=2.
Depth is ignored. The window can't be any color depth other than what the desktop is using.

This means you could use
Graphics 640, 480, 573, 2

with the same result.


soja(Posted 2003) [#7]
Print *is* available; it just opens its own console window.


Floyd(Posted 2003) [#8]
You're right.

I tend to forget things like that.
My programs would be console mode only, or graphics oriented.

The original code at the top of this thread *does* print to a console window.
But that window is not on top, so you can't see it.
You can get to the console window with Alt-Tab.
Or run in Debug mode so you can select from the task bar.


Hansie(Posted 2003) [#9]
Thank you everyone,

And you are all correct

Because I have just recently changed from Blitz3D to BlitzPlus, I *FORGOT* that the "PRINT" command opens up a console window (behind my fullscreen). The solution - in ALL cases when using fullscreen in BlitzPlus is to use TEXT command only :-D