no doubt it is how i've set these up but, they're working one second i add something and they just stop - gets frustrating when you don't want to stop every 20secs for simple errors that shouldn't be there.
ShaderDemo.src.dba
Rem Project: PVS Demonstration
Rem Created: 19/06/2003 10:31:35
Rem Author : Raven
Rem ***** Main Source File *****
`----------------------------------------------
`// Globals & Constants
`----------------------------------------------
#constant TRUE 0x001
#constant FALSE 0x000
`#include "..\..\SDK\Common\Include\Windows.inc.dba"
`#include "ShaderDemo.inc.dba"
global Version as string : Version = "v1.00.r0.beta.0018"
`// private switchs
global pr_MainApp as boolean : pr_MainApp = FALSE
`----------------------------------------------
`// Create Menu System
`----------------------------------------------
create menu "DarkBASIC Pro Project"
`// File Menu
add main menu "File"
add menu item 0,"Change Display Mode F2" : set enabled 0,0,0 :`// something wrong with this //
add menu item 0,"Quit ESC" : #constant IDM_QUIT 1
`// Help Menu
add main menu "Help"
add menu item 1,"DarkBASIC Pro Website" : #constant IDM_DBPWEB 3
add menu item 1,"FMTau Labs Website" : #constant IDM_FMTWEB 4
add menu item 1,"About... F1" : #constant IDM_ABOUT 5
disable escapekey :`// deactivate so it can be used by the menu system
`----------------------------------------------
`// Create Vertex Shader System
`----------------------------------------------
do
if MainApp()=TRUE then goto Quit
loop
function MainApp()
`{
local result as boolean
result = MenuFunction( get menu item() )
if escapekey()=TRUE or result=TRUE then exitfunction TRUE
if pr_MainAppNULL then goto Public
`if CheckDisplayMode()=FALSE
` if MessageBox("Error","Unable to Initilise Shaders. Click Ok to Quit.",MB_OK||MB_ICONWARNING)=ID_OK
` exitfunction TRUE
` endif
`endif
pr_MainApp = TRUE
OneTimeInit()
RestoreScene()
Render()
Public:
Render()
endfunction FALSE
`} boolean
`==============================================================
`// SubRoutines
`==============================================================
`----------------------------------------------
`// Name: Quit
`// Desc: Program exit point, any required releases that
`// are global should be put here.
`----------------------------------------------
Quit:
ReleaseApplication()
delete menu :`// DO NOT DELETE //
end
`==============================================================
`// Functions
`==============================================================
`----------------------------------------------
`// Name: MenuFunction ( )
`// Desc: Place any menu functions within this function,
`// it just keeps everything nice and clean
`----------------------------------------------
function MenuFunction( menuitem as dword )
`{
`// File Menu
if menuitem = ID_QUIT then exitfunction TRUE
`// Help Menu
if menuitem = ID_DBPWEB then execute file "explorer.exe"," http://www.darkbasicpro.com",""
if menuitem = ID_FMTWEB then execute file "explorer.exe"," http://members.lycos.co.uk/timesaga/forum",""
if keystate(59)=TRUE or menuitem=ID_ABOUT
NULLRETURN = MessageBox( "About...","Copyright© 2002 Raven Lettan"+" "+Version, MB_OK )
endif
endfunction FALSE
`} boolean
`----------------------------------------------
`// Name: OneTimeInit( )
`// Desc:
`----------------------------------------------
function OneTimeInit( )
`{
`// objects
global m_pSphere as dword
m_pSphere = (g_pGlob.Object=g_pGlob.Object+1)
`// images
global m_imgEarth as image_t
m_pEarth.name = "media\earth.jpg"
m_pEarth.instance = (g_pGlob.Image=g_pGlob.Image+1)
endfunction
`} void
`----------------------------------------------
`// Name: RestoreScene( )
`// Desc:
`----------------------------------------------
function RestoreScene( )
`{
`// images
load image m_pEarth.name,m_pEarth.instance
`// objects
make object sphere m_pSphere,10.0,32,16
texture object m_pSphere,m_pEarth.instance
endfunction
`} void
`----------------------------------------------
`// Name: Render( )
`// Desc:
`----------------------------------------------
function Render( )
`{
y#=y#+(4.0/screen fps())
yrotate object m_pSphere,wrapvalue(y#)
endfunction
`} void
`----------------------------------------------
`// Name: ReleaseApplication( )
`// Desc:
`----------------------------------------------
function ReleaseApplication( )
`{
local i as dword
`// if g_pVertexBufferNULL then Release(g_pVertexBuffer) // example
`// release objects
for i=g_pGlob.object to 1 step -1
if object exist(i)
delete object i
endif
next i
`// release images
for i=g_pGlob.image to 1 step -1
if image exist(i)
delete image i
endif
next i
endfunction
`} void
ShaderDemo.inc.dba
Rem *** Include File: ShaderDemo.inc.dba ***
Rem Created: 23/06/2003 22:21:05
Rem Included in Project: C:\Program Files\Dark Basic Software\Dark Basic Professional\Projects\SpecularBumpMap\ShaderDemo.dbpro
`----------------------------------------------
`// type structures
`----------------------------------------------
type globstruct_t
object as dword
image as dword
vshader as dword
pshader as dword
endtype
global g_pGlob as globstruct_t
type image_t
name as string
instance as dword
endtype
`----------------------------------------------
`// Name: Release( )
`// Desc:
`----------------------------------------------
function Release( pointer as dword )
`{
if pointerNULL and *pointerNULL
delete memory pointer
endif
endfunction TRUE
`} boolean
you will also need
RobK's Menu Plugin and my
MessageBox plugin
the functions have been doing some strange things recently, but this latest problem just makes them almost unworkable for my coding style.
the globals don't want to register in any other function ... i'm sure someone can figure this out
I pride myself that i don't kill... http://members.lycos.co.uk/timesaga/gir.gif[/img]
well not without a good reason