Screensaver Problem

Blitz3D Forums/Blitz3D Beginners Area/Screensaver Problem

David819(Posted 2003) [#1]
Hi i reciently got a piece of coding to make a screen saver in blitz3d but i cant get it to work and was wandering if you could please help me here is the coding:
;*******************************************************************************
;* *
;* Windows Screensaver *
;* (Tested with Win98, but should also work with any other 32 Bit Windows) *
;* *
;* Code by Kalle (Pascal Gwosdek) (2002) *
;* *
;* Just insert your code instead of the comments below. *
;* When finished, create an executable and change the filename into <Name>.scr *
;* Now, you can handle it as a "real" screensaver... *
;* The preview in the installation screen is not supported. Another bug is *
;* that the Blitz Text window appears at every use, ignore it. *
;* *
;* Have fun :-) *
;* *
;*******************************************************************************

;Declarations

AppTitle "ScreenSaver"
ChangeDir SystemProperty$("appdir") ;This line is important when running as a Screensaver in Windows.
;Disable it while testing in Blitz (because the "appdir" of Blitz is "\bin"...)
If CommandLine$() = "" Or Left$(CommandLine$(),2) = "/C" Or Left$(CommandLine$(),2) = "/c" Then ConfigScreensaver
If CommandLine$() = "/S" Or CommandLine$() = "/s" Then ExecuteScreensaver
End

;---------------------------------------

Function ConfigScreensaver()
;Code for config screen... If you want to, launch an external application (written in Delphi or
;Visual Basic). You can save your data in an additional file.

End
End Function

;---------------------------------------

Function ExecuteScreensaver()
;Graphics mode (fullscreen), double buffering command(s) and loading of images, meshes, sounds...
FlushKeys
FlushMouse
MoveMouse 0,0
Repeat
;Code for running screensaver...

Until MouseX() <> 0 Or MouseY() <> 0 Or GetKey() <> 0 Or GetMouse() <> 0
End
End Function

please can someone tell me where i an serposed to put the codes for it with a very simple example in the coding i gave you so i can see how it is done.
please help me please.


Neo Genesis10(Posted 2003) [#2]
At the moment all you have there is a skeleton program. To make it actually DO something, you'll need to add your code into the individual functions. You may also want additional declarations such as models loading and camera's etc. Of course, what actually gets added to each function and to the declarations depends entirely on what your screensaver does.
;* * 
;Declarations 

AppTitle "ScreenSaver" 
ChangeDir SystemProperty$("appdir") ;This line is important when running as a Screensaver in Windows. 
;Disable it while testing in Blitz (because the "appdir" of Blitz is "\bin"...) 
If CommandLine$() = "" Or Left$(CommandLine$(),2) = "/C" Or Left$(CommandLine$(),2) = "/c" Then ConfigScreensaver 
If CommandLine$() = "/S" Or CommandLine$() = "/s" Then ExecuteScreensaver 
End 

;--------------------------------------- 

Function ConfigScreensaver() 
	;!!PUT YOUR CONFIG CODE HERE!!

	End 
End Function 

;--------------------------------------- 

Function ExecuteScreensaver() 
	;Graphics mode (fullscreen), double buffering command(s) and loading of images, meshes, sounds... 
	FlushKeys 
	FlushMouse 
	MoveMouse 0,0 
	Repeat 
	;!!PUT YOUR CODE HERE!!

	Until MouseX() <> 0 Or MouseY() <> 0 Or GetKey() <> 0 Or GetMouse() <> 0 
	End 
End Function



David819(Posted 2003) [#3]
?!?!?!?!?!?!??????????????????????????????


Gauge(Posted 2003) [#4]
What should the configure screensaver function ahve in it? Your actualy blitz program should be in execute screen saver i get that, but not sure on the other.


Warren(Posted 2003) [#5]
I'm going to guess ... the code to display a configuration dialog so the user can, you know, configure the screen saver.


Neo Genesis10(Posted 2003) [#6]
Goober: Your program is empty. There may be lots of code, but its just the basic structure. To make it do anything whatsoever you need to program it to do so. Tell us the kind of screensaver you're trying to make so we can aid you further.


David819(Posted 2003) [#7]
welll i'm trying to make a screen saver that has an object rotating in it, i know it may seem simple and yea it is but i dont know where to put the code for loading and the code for making it move, so if you can please can you make a very simple working version and give me the source to learn from.
you are the experts please help.


Neo Genesis10(Posted 2003) [#8]
As above with this addition:
Function ExecuteScreensaver()

	; Set graphics mode
	Graphics3D 640, 480
	SetBuffer BackBuffer()

	; Clear the key and mouse buffers
	FlushKeys 
	FlushMouse
	; Position the mouse so we can check if it moves
	MoveMouse 0, 0

	; *----* CODE ADDITION *----*
	cam = CreateCamera()		; Create a camera so we can 'see' the 3D cube
	cube = CreateCube()		; Make a cube
	EntityColor cube, 255, 0, 0	; Make it a red cube
	PositionEntity cube, 0, 0, 2	; Position the cube ahead of the camera
	Repeat 
		TurnEntity cube, 1, 1, 1; Turns the cube around
		Renderworld		; Renders all 3D items through visible cameras
		Flip			; Flips the buffers so we can see the results

	; The line below just checks to see if a key has been hit or the mouse moved.
	Until MouseX() <> 0 Or MouseY() <> 0 Or GetKey() <> 0 Or GetMouse() <> 0 
	End 
End Function
Get to grips with the individual commands and, more importantly, how they fit together to form a program. Once you learn the basic structure of a program, the rest just falls into place.


David819(Posted 2003) [#9]
Thanks:)