Page 1 of 3

Posted: Sun Jun 19, 2005 7:57 am
by KarLKoX
This is a young project but allready have some feature pb doesn't have like :

- long integer (64-bit) data types (signed and unsigned), all operations done inline but for division and modulo (v1c)
- variable-arguments, as in C: "sub foo(byval bar as integer, ...)" (v1c)
- typedefs with forward referencing support, as in C (but the syntax is "TYPE Name AS SymbolType") (v1c)
- bitfields, same syntax as in C: "foo : 4 as integer", "bar : 1 as integer", etc (v1c)
- Support a lot of third party project natively (fmod, sdl, opengl, openal, gtk 2 ...)
- #define support !
- overloading,
- more type support (short, long integer, signed/unsigned ..)

I think i ll keep an eye on it from time to time.
Thanx for the info :)

Posted: Thu Jun 23, 2005 3:34 pm
by GeoTrail
Looks interesting.
Thanks for the link :)

Posted: Thu Jun 23, 2005 3:46 pm
by GeoTrail
Looks kinda compilcated actually.
All this code just for a simple Hello Window:

Code: Select all

''
''
''
''
defint a-z
option explicit
option private

'$include once:'win\kernel32.bi'
'$include once:'win\user32.bi'
'$include once:'win\gdi32.bi'



declare function        WinMain     ( byval hInstance as long, _
                                      byval hPrevInstance as long, _
                                      szCmdLine as string, _
                                      byval iCmdShow as integer ) as integer
                                  
                                  
    ''
    '' Entry point    
    ''
	end WinMain( GetModuleHandle( null ), null, Command$, SW_NORMAL )
    
    
    


'' ::::::::
'' name: WndProc
'' desc: Processes windows messages
''
'' ::::::::
defint a-z
function WndProc ( byval hWnd as long, _
                   byval message as long, _
                   byval wParam as long, _
                   byval lParam as long ) as integer
    dim rct as RECT
    dim pnt as PAINTSTRUCT
    dim hDC as long
    
    WndProc = 0
    
    ''
    '' Process message
    ''
    select case ( message )
       
        ''
        ''
        ''        
        case WM_CREATE            
            exit function
        
        ''
        '' Windows is being repainted
        ''
        case WM_PAINT
          
            hDC = BeginPaint( hWnd, pnt )
            GetClientRect hWnd, rct
            
            DrawText hDC,"Hello Windows from FreeBasic!", -1, _
                     rct, DT_SINGLELINE or DT_CENTER or DT_VCENTER
            
            EndPaint hWnd, pnt
            
            exit function            
        
		''
		''
		''
		case WM_KEYDOWN
			if( lobyte( wParam ) = 27 ) then
				PostMessage hWnd, WM_CLOSE, 0, 0
			end if

        ''
        '' Window was closed
        ''
        case WM_DESTROY
            PostQuitMessage 0            
            exit function
    end select
    
    ''
    '' Message doesn't concern us, send it to the default handler
    '' and get result
    ''
    WndProc = DefWindowProc( hWnd, message, wParam, lParam )    
    
end function




'' ::::::::
'' name: WinMain
'' desc: A win2 gui program entry point
''
'' ::::::::
defint a-z
function WinMain ( byval hInstance as long, _
                   byval hPrevInstance as long, _
                   szCmdLine as string, _
                   byval iCmdShow as integer ) as integer    
     
     dim wMsg as MSG
     dim wcls as WNDCLASS     
     dim szAppName as string
     dim hWnd as unsigned long

     
     WinMain = 0
     
     ''
     '' Setup window class
     ''
     szAppName = "HelloWin"
     
     with wcls
     	.style         = CS_HREDRAW or CS_VREDRAW
     	.lpfnWndProc   = @WndProc
     	.cbClsExtra    = 0
     	.cbWndExtra    = 0
     	.hInstance     = hInstance
     	.hIcon         = LoadIcon( null, IDI_APPLICATION )
     	.hCursor       = LoadCursor( null, IDC_ARROW )
     	.hbrBackground = GetStockObject( WHITE_BRUSH )
     	.lpszMenuName  = null
     	.lpszClassName = strptr( szAppName )
     end with
     
     
     ''
     '' Register the window class     
     ''     
     if ( RegisterClass( wcls ) = false ) then
        MessageBox null, "This program requires Windows NT!", szAppName, MB_ICONERROR               
        exit function
    end if
    
    

    ''
    '' Create the window and show it
    ''
    hWnd = CreateWindowEx( 0, _
    			 szAppName, _
                         "The Hello Program", _
                          WS_OVERLAPPEDWINDOW, _
                          CW_USEDEFAULT, _
                          CW_USEDEFAULT, _
                          CW_USEDEFAULT, _
                          CW_USEDEFAULT, _
                          null, _
                          null, _
                          hInstance, _
                          null )
                          

    ShowWindow   hWnd, iCmdShow
    UpdateWindow hWnd
     

    ''
    '' Process windows messages
    ''
    while ( GetMessage( wMsg, null, 0, 0 ) <> false )    
        TranslateMessage wMsg
        DispatchMessage  wMsg
    wend
    
    
    ''
    '' Program has ended
    ''
    WinMain = wMsg.wParam

end function
Might as well use C++ then hehehe

Posted: Fri Jun 24, 2005 11:34 am
by traumatic
GeoTrail wrote:Looks kinda compilcated actually.
Why?

The code you showed is using API only (no additional libraries)
and would look almost the same in PureBasic.

Posted: Fri Jun 24, 2005 11:39 am
by Polo

Code: Select all

function WndProc ( byval hWnd as long, _ 
                   byval message as long, _ 
                   byval wParam as long, _ 
                   byval lParam as long ) as integer 
And they call that basic :lol:

Posted: Fri Jun 24, 2005 11:44 am
by GeoTrail
Polo wrote:

Code: Select all

function WndProc ( byval hWnd as long, _ 
                   byval message as long, _ 
                   byval wParam as long, _ 
                   byval lParam as long ) as integer 
And they call that basic :lol:
Exactly ;)

Posted: Fri Jun 24, 2005 11:58 am
by thefool
eh as traumatic said: it would probaly look the same in pure. nothing wrong with that! they just havent developed the gui lib yet!

that code isnt really complicated. even though im not as good as traumatic in winapi i agree with him. a winapi gui code cant be much easier than that.

Posted: Fri Jun 24, 2005 12:02 pm
by kns
Comments removed....The following is 'Hello World' using Allegro.

Code: Select all


#include "allegro.bi"

	allegro_init
	install_keyboard

	if (set_gfx_mode(GFX_SAFE, 320, 200, 0, 0) <> 0) then
		set_gfx_mode(GFX_TEXT, 0, 0, 0, 0)
		allegro_message "Unable to set any graphic mode" + chr(13) + allegro_error + chr(13)
		end 1
	end if

	set_palette(@desktop_palette)
	clear_to_color(screen, makecol(255, 255, 255))
	acquire_screen
	text_mode -1

	textout_centre screen, font, "Hello, world!", SCREEN_W\2, SCREEN_H\2, makecol(0,0,0)

	release_screen
	readkey
	end 0
You'll also find examples in the SDL and GFX directory.

Posted: Fri Jun 24, 2005 12:26 pm
by Polo
Why do there is a need of external libraries to do an hello word ?
This is exactly why I don't like PB's linux version :?

Posted: Fri Jun 24, 2005 12:56 pm
by thefool
you dont need external libs.

Posted: Fri Jun 24, 2005 1:16 pm
by Dare2
It's good.

And it has some fans among PureBasic users - no names, no flames :)

rufio72, you associated with the project?

Posted: Fri Jun 24, 2005 1:28 pm
by Dare2
Ah ok.

Success to you with your web project. Just out of curiosity (and if you don't mind sharing this detail) which sourceforge project is it?

Posted: Fri Jun 24, 2005 1:39 pm
by traumatic
Not that I care about Freebasic but...
Polo wrote:Why do there is a need of external libraries to do an hello word ?
What do you think OpenWindow() is/does?
This is exactly why I don't like PB's linux version :?
:?:

Posted: Fri Jun 24, 2005 1:43 pm
by Polo
I was talking about some stuffs that hurt me :
The following is 'Hello World' using Allegro.
You'll also find examples in the SDL
I don't like the linux version of Purebasic because you have to install third parties libraries in order to use it and in order to use programs made with it, which I can't stand :wink:

Posted: Fri Jun 24, 2005 1:48 pm
by freak
Linux IS a collection of 3rd party libraries. There are no "buildin libraries" as such
(well, libc and some other basic stuff could be considered that maybe, but certainly not the GUI stuff)

so PB just does what everybody else does ;)