Hello
i'm trying to make a splash screen which will time out in 5 secs
my preliminary code is below -- it does not exit after 5 secs? any help appreciated
' includepath "$\inc\"
' Apr 16 2018
' http://www.oxygenbasic.org/forum/index.php?PHPSESSID=5jj7gcka25lpdnu9lie1jb4h60&topic=1636.msg17838;topicseen#msg17838
$ FileName "Splash.exe"
include "$\inc\RTL64.inc"
' Set the width and height of the display window
% width 300
% height 300
%ID_Timer = 500
$ fontA "Arial",FW_SEMIBOLD
$ title "Rotating Quad2"
% ExplicitMain
' Note that you need to place OpenglSceneFrame.inc , winUtil.inc
' and glWinUtil.inc into the same folder when compiling
include "OpenglSceneFrame.inc"
' Note that we must specify exactly these equates
' all in uppercase , otherwise it can results in compilation errors
#define GL_TRIANGLES 0x0004
#define GL_TRIANGLE_FAN 0x0006
#define GL_QUAD_STRIP 0x0008
#define SWP_NOSIZE 0x0001
#define SWP_NOMOVE 0x0002
#define SWP_SHOWWINDOW 0x0040
#define SW_SHOW 5
#define SM_CYCAPTION 4
sys wMsg, wParam , lparam
'========================
' this center the display window
' on the screen
' but it was not use in this program
sub Center(sys hwnd)
RECT rc
sys x,y
GetWindowRect(hwnd,&rc)
x = (GetSystemMetrics(SM_CXSCREEN) - (rc.right-rc.left))\2
y = (GetSystemMetrics(SM_CYSCREEN) -
(rc.bottom-rc.top+GetSystemMetrics(SM_CYCAPTION)))\2
SetWindowPos (hWnd, 0, x, y, 0, 0, SWP_NOSIZE)
end sub
function WndMessages( hWnd, wMsg, wParam , lparam ) as sys, link WndProcExtra
============================================================================
select wMsg
' case WM_ACTIVATE
' Center(hWnd)
case WM_TIMER
KillTimer hWnd, %ID_Timer
print " timeout" ' it doesn't reach here?
end select
end function
sub initialize(sys hWnd)
'=======================
' 5 Sec timeout for splash screen
SetTimer hWnd, %ID_Timer, 5000, 0
WndMessages( hWnd, wMsg, wParam , lparam )
end sub
'
sub scene(sys hWnd)
'==================
'
static single s1,s2,s3,s4,ang1
' increase this angle for faster rotation between 1 and 10
angi1=7
'
glLoadIdentity
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
' Greenish Beige background color
glClearColor .91,.94,.82,1
' ' display the text label1
glPushMatrix
gltranslatef -.63,.8,-2.5
glScalef( 0.25, 0.25, .01)
glColor3f 0.20, 0.0, 1.0
gPrint "Your Product"
' display the text label2
gltranslatef -5., -1.7,-1.0
' glScalef( 0.15, 0.2, .01)
glColor3f 1.0, 0.0, 0.0
gPrint "Label 2"
'
'
s1=.2 'x y
s2=-1 'z
s3=0.5 'color
s4=s3*.2 'color
'
glrotatef ang1, 0,0,1
'
' original square -- this work
' glbegin GL_QUADS
' glcolor4f 00, s3, s3, 1 : glvertex3f -s1, -s1, s2
' glcolor4f s3, s3, 00, 1 : glvertex3f s1, -s1, s2
' glcolor4f s4, 0, s3, 1 : glvertex3f s1, s1, s2
' glcolor4f s4, 0, s3, 1 : glvertex3f -s1, s1, s2
' glend
' semi triangle -- this work
' glBegin GL_TRIANGLE_FAN
' glcolor4f 00, s3, s3, 1 : glvertex3f -s1, -s1, s2 '1st triangle
' glcolor4f s3, s3, 00, 1 : glvertex3f s1, -s1, s2
' glcolor4f s4, 0, s3, 1 : glvertex3f -.3,-.1, s2
' glcolor4f s4, 0, s3, 1 : glvertex3f s1, s1 , -s2 '2nd
' glcolor4f 00, s3, s3, 1 : glvertex3f s1, -s1, s2 '3rd
' glcolor4f 00, s3, s3, 1 : glvertex3f s1, s1, -s2 '4th
' glEnd
' Triangle -- this work
' ensure that z = -1. thru' out
' glBegin GL_TRIANGLES
' glColor3f 1.0, 0.0, 0.0 : glVertex3f 0.0, .3,-1.
' glColor3f 0.0, 1.0, 0.0 : glVertex3f 0.2, -0.1,-1.
' glColor3f 0.0, 0.0, 1.0 : glVertex3f -0.2,-0.1,-1.
' glEnd
' Triangle -- this work
' this place triangle off center and if we increase the -ve z
' the object gets smaller and will spin at a distance of 0.8 from the center
' glTranslatef .80, 0.0, -2.0
' glBegin GL_TRIANGLES
' glColor3f 1.0, 0.0, 0.0 : glVertex3f 0.0, .30,-1.0
' glColor3f 0.0, 1.0, 0.0 : glVertex3f 0.26,-0.15,-1.0
' glColor3f 0.0, 0.0, 1.0 : glVertex3f-0.26,-0.15,-1.0
' glEnd
' this work
' Half red square rotated off center
' glTranslatef 2.40,0.0,-10.0
' glBegin(GL_QUADS)
' glColor3f 1.0, 0.0, 1.0
' glVertex3f -1.0,-1.0, 0.0
' glColor3f 1.0, 1.0, 1.0
' glVertex3f 1.0,-1.0, 0.0
' glVertex3f 1.0, 1.0, 0.0
' glColor3f 1.0, 1.0, 1.0
' glVertex3f -1.0, 1.0, 0.0
' glEnd
' rotating off center Cube -- this work
' glTranslatef -2.0, -2.0, -12.0
' glBegin GL_QUADS
' glColor3f 0.0, 1.0, 0.0
' glVertex3f 1.0, 1.0,-1.0
' glVertex3f -1.0, 1.0,-1.0
' glVertex3f -1.0, 1.0, 1.0
' glVertex3f 1.0, 1.0, 1.0
' glColor3f 1.0, 0.5, 0.0
' glVertex3f 1.0,-1.0, 1.0
' glVertex3f -1.0,-1.0, 1.0
' glVertex3f -1.0,-1.0,-1.0
' glVertex3f 1.0,-1.0,-1.0
' glColor3f 1.0, 0.0, 0.0
' glVertex3f 1.0, 1.0, 1.0
' glVertex3f -1.0, 1.0, 1.0
' glVertex3f -1.0,-1.0, 1.0
' glVertex3f 1.0,-1.0, 1.0
'glColor3f 1.0, 1.0, 0.0
' glVertex3f 1.0,-1.0,-1.0
' glVertex3f -1.0,-1.0,-1.0
' glVertex3f -1.0, 1.0,-1.0
' glVertex3f 1.0, 1.0,-1.0
'glColor3f 0.0, 0.0, 1.0
' glVertex3f -1.0, 1.0, 1.0
' glVertex3f -1.0, 1.0,-1.0
' glVertex3f -1.0,-1.0,-1.0
' glVertex3f -1.0,-1.0, 1.0
' glColor3f 1.0, 0.0, 1.0
' glVertex3f 1.0, 1.0,-1.0
' glVertex3f 1.0, 1.0, 1.0
' glVertex3f 1.0,-1.0, 1.0
' glVertex3f 1.0,-1.0,-1.0
' glEnd
' DrawDiamond -- this work very well
glTranslatef 1.4,0.0,-20.0
glbegin GL_TRIANGLE_FAN 'top part
glcolor3ub 255, 0, 0 : glvertex3f 0, 0.714, 0
glcolor3ub 0, 255, 0 : glvertex3f 0.5, 0, 0.5
glcolor3ub 0, 0, 255 : glvertex3f 0.5, 0,-0.5
glcolor3ub 0, 255, 0 : glvertex3f -0.5, 0,-0.5
glcolor3ub 0, 0, 255 : glvertex3f -0.5, 0, 0.5
glcolor3ub 0, 255, 0 : glvertex3f 0.5, 0, 0.5
glend
glbegin GL_TRIANGLE_FAN 'bottom part
glcolor3ub 255, 0, 0 : glvertex3f 0,-0.714, 0
glcolor3ub 0, 255, 0 : glvertex3f 0.5, 0, 0.5
glcolor3ub 0, 0, 255 : glvertex3f -0.5, 0, 0.5
glcolor3ub 0, 255, 0 : glvertex3f -0.5, 0,-0.5
glcolor3ub 0, 0, 255 : glvertex3f 0.5, 0,-0.5
glcolor3ub 0, 255, 0 : glvertex3f 0.5, 0, 0.5
glend
'draws a 3D cube object -- drawcube works
' note that by increasing the -ve value of the z in glTranslatef
' you can make the cube smaller
' glTranslatef 1.4,0.0,-7.0
' glBegin GL_QUADS
' glRotatef ang1, 1.0, 1.0, 1.0 ' Rotate the quad on the X axis
' glcolor3ub 255,0,0
' glVertex3f 0.5, 0.5, -0.5 ' Top right of the quad (Top)
' glVertex3f -0.5, 0.5, -0.5 ' Top left of the quad (Top)
' glVertex3f -0.5, 0.5, 0.5 ' Bottom left of the quad (Top)
' glVertex3f 0.5, 0.5, 0.5 ' Bottom right of the quad (Top)
' glcolor3ub 255,255,0
' glVertex3f 0.5, -0.5, 0.5 ' Top right of the quad (Bottom)
' glVertex3f -0.5, -0.5, 0.5 ' Top left of the quad (Bottom)
' glVertex3f -0.5, -0.5, -0.5 ' Bottom left of the quad (Bottom)
' glVertex3f 0.5, -0.5, -0.5 ' Bottom right of the quad (Bottom)
' glcolor3ub 255,0,255
' glVertex3f 0.5, 0.5, 0.5 ' Top right of the quad (Front)
' glVertex3f -0.5, 0.5, 0.5 ' Top left of the quad (Front)
' glVertex3f -0.5, -0.5, 0.5 ' Bottom left of the quad (Front)
' glVertex3f 0.5, -0.5, 0.5 ' Bottom right of the quad (Front)
' glcolor3ub 0,0,255
' glVertex3f 0.5, -0.5, -0.5 ' Top right of the quad (Back)
' glVertex3f -0.5, -0.5, -0.5 ' Top left of the quad (Back)
' glVertex3f -0.5, 0.5, -0.5 ' Bottom left of the quad (Back)
' glVertex3f 0.5, 0.5, -0.5 ' Bottom right of the quad (Back)
' glcolor3ub 0,255,255
' glVertex3f -0.5, 0.5, 0.5 ' Top right of the quad (Left)
' glVertex3f -0.5, 0.5, -0.5 ' Top left of the quad (Left)
' glVertex3f -0.5, -0.5, -0.5 ' Bottom left of the quad (Left)
' glVertex3f -0.5, -0.5, 0.5 ' Bottom right of the quad (Left)
' glcolor3ub 255,128,0
' glVertex3f 0.5, 0.5, -0.5 ' Top right of the quad (Right)
' glVertex3f 0.5, 0.5, 0.5 ' Top left of the quad (Right)
' glVertex3f 0.5, -0.5, 0.5 ' Bottom left of the quad (Right)
' glVertex3f 0.5, -0.5, -0.5 ' Bottom right of the quad (Right)
' glEnd
sleep (2)
' note that by increasing the -ve value of the z in glTranslatef
' you can make the cube smaller
glLoadIdentity
glTranslatef 2.5, -2.90, -15.0 ' Move right 1.5 units and into the screen
glRotatef ang1, 1.0, 1.0, 1.0 ' Rotate the quad on the X axis
glBegin GL_QUADS
glColor3f 0.0, 1.0, 0.0 ' Set the color to green
glVertex3f 1.0, 1.0, -1.0 ' Top right of the quad (Top)
glVertex3f -1.0, 1.0, -1.0 ' Top left of the quad (Top)
glVertex3f -1.0, 1.0, 1.0 ' Bottom left of the quad (Top)
glVertex3f 1.0, 1.0, 1.0 ' Bottom right of the quad (Top)
glColor3f 1.0, 0.5, 0.0 ' Set the color to orange
glVertex3f 1.0, -1.0, 1.0 ' Top right of the quad (Bottom)
glVertex3f -1.0, -1.0, 1.0 ' Top left of the quad (Bottom)
glVertex3f -1.0, -1.0, -1.0 ' Bottom left of the quad (Bottom)
glVertex3f 1.0, -1.0, -1.0 ' Bottom right of the quad (Bottom)
glColor3f 1.0, 0.0, 0.0 ' Set the color to red
glVertex3f 1.0, 1.0, 1.0 ' Top right of the quad (Front)
glVertex3f -1.0, 1.0, 1.0 ' Top left of the quad (Front)
glVertex3f -1.0, -1.0, 1.0 ' Bottom left of the quad (Front)
glVertex3f 1.0, -1.0, 1.0 ' Bottom right of the quad (Front)
glColor3f 1.0, 1.0, 0.0 ' Set the color to yellow
glVertex3f 1.0, -1.0, -1.0 ' Top right of the quad (Back)
glVertex3f -1.0, -1.0, -1.0 ' Top left of the quad (Back)
glVertex3f -1.0, 1.0, -1.0 ' Bottom left of the quad (Back)
glVertex3f 1.0, 1.0, -1.0 ' Bottom right of the quad (Back)
glColor3f 0.0, 0.0, 1.0 ' Set the color to blue
glVertex3f -1.0, 1.0, 1.0 ' Top right of the quad (Left)
glVertex3f -1.0, 1.0, -1.0 ' Top left of the quad (Left)
glVertex3f -1.0, -1.0, -1.0 ' Bottom left of the quad (Left)
glVertex3f -1.0, -1.0, 1.0 ' Bottom right of the quad (Left)
glColor3f 1.0, 0.0, 1.0 ' Set the color to violet
glVertex3f 1.0, 1.0, -1.0 ' Top right of the quad (Right)
glVertex3f 1.0, 1.0, 1.0 ' Top left of the quad (Right)
glVertex3f 1.0, -1.0, 1.0 ' Bottom left of the quad (Right)
glVertex3f 1.0, -1.0, -1.0 ' Bottom right of the quad (Right)
glEnd
sleep (2)
' draw the pyramid using triangles
' note that by increasing the -ve value of the z in glTranslatef
' you can make the diamond smaller
' // Reset the view
glLoadIdentity
glTranslatef -1.5, -1.0, -10.0 ' Move left 1.5 units and into the screen
glRotatef ang1, 0.0, 1.0, 0.0 ' Rotate the triangle on the Y axis
glBegin %GL_TRIANGLES
' Front
glColor3f 1.0, 0.0, 0.0 ' Red
glVertex3f 0.0, 1.0, 0.0 ' Top of triangle (Front)
glColor3f 0.0, 1.0, 0.0 ' Green
glVertex3f -1.0, -1.0, 1.0 ' Left of triangle (Front)
glColor3f 0.0, 0.0, 1.0 ' Blue
glVertex3f 1.0, -1.0, 1.0 ' Right of triangle (Front)
' Right
glColor3f 1.0, 0.0, 0.0 ' Red
glVertex3f 0.0, 1.0, 0.0 ' Top of triangle (Right)
glColor3f 0.0, 0.0, 1.0 ' Blue
glVertex3f 1.0, -1.0, 1.0 ' Left of triangle (Right)
glColor3f 0.0, 1.0, 0.0 ' Green
glVertex3f 1.0, -1.0, -1.0 ' Right of triangle (Right)
' Back
glColor3f 1.0, 0.0, 0.0 ' Red
glVertex3f 0.0, 1.0, 0.0 ' Top of triangle (Back)
glColor3f 0.0, 1.0, 0.0 ' Green
glVertex3f 1.0, -1.0, -1.0 ' Left of triangle (Back)
glColor3f 0.0, 0.0, 1.0 ' Blue
glVertex3f -1.0, -1.0, -1.0 ' Right of triangle (Back)
' Left
glColor3f 1.0, 0.0, 0.0 ' Red
glVertex3f 0.0, 1.0, 0.0 ' Top of triangle (Left)
glColor3f 0.0, 0.0, 1.0 ' Blue
glVertex3f -1.0, -1.0, -1.0 ' Left of triangle (Left)
glColor3f 0.0, 1.0, 0.0 ' Green
glVertex3f -1.0, -1.0, 1.0 ' Right of triangle (Left)
glEnd
'
'UPDATE ROTATION ANGLES
'----------------------
'
ang1+=angi1
if ang1>360 then ang1-=360
'
end sub
sub Release(sys hwnd)
'====================
end sub
' display the window and centralize it using place = 2
MainWindow width,height,%WS_POPUP ,2