Posts: 788
Threads: 53
Joined: Nov 2002
Why use poke when you have real pointers? FB already has real pointers, C style.
I don't think v1ctor will ever release a FB for dos. But since it's open source anyone can do that. It's just a matter of coding a runtime lib for dos. Shouldn't be anymore to it i think.
oship me and i will give you lots of guurrls and beeea
Posts: 788
Threads: 53
Joined: Nov 2002
Linked list example with pointers
Code: defint a-z
'$include: 'user32.bi'
const MAXNODES = 10
const NULL = 0
type TNODE
id as short
prv as TNODE ptr
nxt as TNODE ptr
end type
type TLIST
head as TNODE ptr
tail as TNODE ptr
end type
dim list as TLIST
dim nodeTB(0 to MAXNODES-1) as TNODE
dim p as TNODE ptr
'' init list
list.head = varptr( nodeTB(0) )
list.tail = varptr( nodeTB(MAXNODES-1) )
p = NULL
for i = 0 to (MAXNODES-1)-1
nodeTB(i).id = i
nodeTB(i).prv = p
nodeTB(i).nxt = varptr( nodeTB(i+1) )
p = varptr( nodeTB(i) )
next i
nodeTB(MAXNODES-1).id = MAXNODES-1
nodeTB(MAXNODES-1).prv = p
nodeTB(MAXNODES-1).nxt = NULL
'' test it
dim res as string
p = list.head
do while( p <> NULL )
res = res + str$( p->id )
p = p->nxt
loop
MessageBox 0, res, "Result", MB_ICONASTERISK
oship me and i will give you lots of guurrls and beeea
Posts: 3,279
Threads: 170
Joined: Nov 2003
With Windows XP now being the dominant OS and having mediocre-at-best support for DOS, I think the smart thing to do would be to abandon the old DOS-based QB and take up something like this instead. If its syntactic compatability is 100% on-par with QB, then there's no need to suffer with DOS anymore. If it were 5 years ago, I'd say great, do a DOS version as well, but as Microsoft is seeking to suffocate all DOS users, it's wiser to adapt to the changing times. I was hoping to have OBDS out by this time of the year, but oh well. :-?
I'd knock on wood, but my desk is particle board.
Posts: 1,688
Threads: 119
Joined: Jun 2003
Like Adosorken said: If you can't beat'em, join'em. All i want is it to be 100% compatible with qb syntax. If that's done i'll be very happy.
Jumping Jahoolipers!
Posts: 788
Threads: 53
Joined: Nov 2002
Another freebasic example, this time a simple opengl application. For anyone who might be interested. http://freebasic.bad-logic.com/downloads/gltest.zip
Code: ''
'' gltest.bas - Freebasic opengl example, uses glut for simplicity
''
''
defint a-z
option explicit
'$include: 'gl.bi'
'$include: 'glu.bi'
'$include: 'glut.bi'
declare sub doMain ( )
''
'' Entry point
''
doMain
'' ::::::::::::
'' name: doRender
'' desc: Is called by glut to render scene. cdecl is used becuase glut
'' callbacks expect the cdecl calling convention
''
'' ::::::::::::
defint a-z
sub doRender cdecl
static rtri as single
static rqud as single
glClear GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT
glPushMatrix
glLoadIdentity
glTranslatef -1.5, 0.0, -6.0
glRotatef rtri, 0.0, 1.0, 0.0
glBegin GL_TRIANGLES
glColor3f 1.0, 0.0, 0.0
glVertex3f 0.0, 1.0, 0.0
glColor3f 0.0, 1.0, 0.0
glVertex3f -1.0,-1.0, 1.0
glColor3f 0.0, 0.0, 1.0
glVertex3f 1.0,-1.0, 1.0
glColor3f 1.0, 0.0, 0.0
glVertex3f 0.0, 1.0, 0.0
glColor3f 0.0, 0.0, 1.0
glVertex3f 1.0,-1.0, 1.0
glColor3f 0.0, 1.0, 0.0
glVertex3f 1.0,-1.0,-1.0
glColor3f 1.0, 0.0, 0.0
glVertex3f 0.0, 1.0, 0.0
glColor3f 0.0, 1.0, 0.0
glVertex3f 1.0,-1.0,-1.0
glColor3f 0.0, 0.0, 1.0
glVertex3f -1.0,-1.0,-1.0
glColor3f 1.0, 0.0, 0.0
glVertex3f 0.0, 1.0, 0.0
glColor3f 0.0, 0.0, 1.0
glVertex3f -1.0,-1.0,-1.0
glColor3f 0.0, 1.0, 0.0
glVertex3f -1.0,-1.0, 1.0
glEnd
glColor3f 0.5, 0.5, 1.0
glLoadIdentity
glTranslatef -1.5, 0.0, -6.0
glTranslatef 3.0,0.0,0.0
glRotatef rqud, 1.0, 0.0, 0.0
glBegin GL_QUADS
glVertex3f -1.0, 1.0, 0.0
glVertex3f 1.0, 1.0, 0.0
glVertex3f 1.0,-1.0, 0.0
glVertex3f -1.0,-1.0, 0.0
glEnd
glPopMatrix
glutSwapBuffers
rtri = rtri + 2.0
rqud = rqud + 1.5
end sub
'' ::::::::::::
'' name: doInput
'' desc: Handles input. cdecl is used becuase glut callbacks expect the
'' cdecl calling convention
''
'' ::::::::::::
defint a-z
sub doInput cdecl ( byval kbcode as unsigned byte, _
byval mousex as integer, _
byval mousey as integer )
if ( kbcode = 27 ) then
end 0
end if
end sub
'' ::::::::::::
'' name: doInitGL
'' desc: Inits OpenGL
''
'' ::::::::::::
defint a-z
sub doInitGL
''
'' Rendering stuff
''
glShadeModel GL_SMOOTH
glClearColor 0.0, 0.0, 0.0, 0.5
glClearDepth 1.0
glEnable GL_DEPTH_TEST
glDepthFunc GL_LEQUAL
glEnable GL_COLOR_MATERIAL
glHint GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST
end sub
'' ::::::::::::
'' name: doReshapeGL
'' desc: Reshapes GL window. cdecl is used becuase glut callbacks expect
' the cdecl calling convention
''
'' ::::::::::::
defint a-z
sub doReshapeGL cdecl ( byval w as integer, _
byval h as integer )
glViewport 0, 0, w, h
glMatrixMode GL_PROJECTION
glLoadIdentity
if ( h = 0 ) then
gluPerspective 80, w, 1.0, 5000.0
else
gluPerspective 80, w / h , 1.0, 5000.0
end if
glMatrixMode GL_MODELVIEW
glLoadIdentity
end sub
'' ::::::::::::
'' name: doMain
'' desc: Main routine
''
'' ::::::::::::
defint a-z
sub doMain
''
'' Setup glut
''
glutInit 1, sadd( " " )
glutInitWindowPosition 0, 0
glutInitWindowSize 640, 480
glutInitDisplayMode GLUT_RGBA or GLUT_DOUBLE or GLUT_DEPTH
glutCreateWindow "Freebasic <3 OpenGL"
doInitGL
glutDisplayFunc procptr( doRender )
glutIdleFunc procptr( doRender )
glutReshapeFunc procptr( doReshapeGL )
glutKeyboardFunc procptr( doInput )
glutMainLoop
end sub
oship me and i will give you lots of guurrls and beeea
Posts: 1,752
Threads: 21
Joined: Jun 2002
Posts: 602
Threads: 27
Joined: Oct 2004
and here an example with sdl and gl, in order to get rid of this crappy glut lib
http://ratatoskr.bad-logic.com/temp/sdltest.rar
my code is crappy, it's 7:58 over here and i did that shit at 4:00am so... don't blame me. i already translated sdl.h, sdl_keyboard.h sdl_mouse.h and sdl_video.h, i guess based on that we could do some sort of wrapper to emulate the old qb commands like screen line etc. i will continuing porting as v1c gets beyond that 2000 symbols barrier.
btw, the code is so ugly to
a) show that fb can not only handle clean code
b) better notice bugs that only show up when the code is badly written hehe....
quote="NecrosIhsan"]
[/quote]
Posts: 658
Threads: 71
Joined: Sep 2003
That's really nice.
To those who need sdl.dll:
for win32: http://www.libsdl.org/release/SDL-1.2.7-win32.zip
url]http://fbide.sourceforge.net/[/url]
Posts: 1,688
Threads: 119
Joined: Jun 2003
...that's done with freebasic? Wow... that's so awesome... it's actually fast... and is that a high resolution i see?
Jumping Jahoolipers!
Posts: 788
Threads: 53
Joined: Nov 2002
Yepp, it's done with freebasic. It uses opengl of course. But that's the thing, you can link any win32 lib that you use in C to freebasic. It's as functional as any other real compiler, not just a toy. Notice how the opengl and win gui example uses callbacks. Never seen that in basic before
Can you tell it's not qb code? I can't, except for cdecl and codeptr
oship me and i will give you lots of guurrls and beeea
|