PDA

View Full Version : how to build an *.exe file with thinbasic?



Lionheart008
04-09-2008, 03:07
dear friends of thinbasic:-)
I am quite new here and have a little question how I can build with a written code example with the thineditor an *.exe file... what do I need it here for? - I have no idea or doesn't found it in the manual help... I would like to build a win32 gui and little app with menu structures and open/save files...

things like that


' Specifies program will use functions from console module
USES "Console"

' Creates global variable to hold user name
GLOBAL UserName AS STRING

' Asks user for the name
Console_Print("What is your name?: ")

' Stores it to variable
UserName = Console_ReadLine

' If length of username is 0 then no name is specified, else program will say hello
IF Len(UserName) = 0 THEN
Console_PrintLine("No user name specified...")
ELSE
Console_PrintLine("Hello " + UserName + "!")
END IF

' Waits for any key from user before program ends
Console_WaitKey


but how can I compile it? I know it's just an existing example:-)))

bye, best regards from raining germany, franko

marcuslee
04-09-2008, 04:07
thinBundle is the module used to create exe files. You can get to it from the Tools menu. Click Bundle.

Mark

ErosOlmi
04-09-2008, 07:20
Ciao Lionheart008,welcome here.

As marcuslee correctly replied, to create an exe with thinBasic, open the script you want to create an exe into thinAir (thinBasic editor)
Than from menu "Tools" choose "Bundle". A dialog will open showing all the available options:
http://www.thinbasic.com/public/products/thinBasic/help/html/thinbundle_how_to_use_it.htm
When all the options are set, press "Bundle" button. IN few seconds an executable (usually with the same name of your script file plus .exe extension) will be created in the same directory of your source script (if you just leave all the options as defaulted)

Always remember: thinBasic does not create real machine code but (as we call them) "bundled exe". It means thinBasic creates a sort of "box" where it puts inside all the files (thinBasic engine and all modules needed to execute your script) needed to create a stand-alone mini thinBasic system. You can also add into this "box" additional files (or even entire directories) other than the ones needed to execute your script when the exe will be executed.

Ciao
Eros

PS: this forum implements a syntax highlighter system called GeShiI that will let you to post syntax highlighed source code.
I just changed your post above in order to set your source code example inside a code /code tags. It looks much better ;)

Lionheart008
04-09-2008, 13:42
hi mark, hi eros... :-)

thank you for help I have managed it to run my first script:-)))

I have built my first gui (with thinAir) following an existing example, I need the third button to make it (ok button, not ok button, cancel button)...

see also "thinAir" column, I have posted my questions here;-)

see you, I like thinBasic and the thinAir and Bundle modules...

ciao und servus, Lionheart

ps: I am looking for a quadview with open gl render for example a torus or a cube :-D

Michael Hartlef
04-09-2008, 13:49
Look into the samples scripts for TBGL, DEMO12 has what you need.

Lionheart008
04-09-2008, 16:04
dear michael:-)

right you are, I haven't found it as soon as I wished... It's too much for me to have a look for all files ;-) I am a newbie with thinBasic, but I like it! :-)) demo 12 is a good basis for my ideas...

I would like to build a quad view with a rendered preview view, a grid floor (checker) and so on... but I will work step by step to understand it all, it's not so easy for a not programming guy (must laugh) ! :-D

best regards, ciao, Lionheart

Petr Schreiber
04-09-2008, 17:57
Hi Lionheart,

good thing is too keep the code modular enough.
One procedure for setting up quad view, other for rendering the scene itself.

Here comes commented code, hope it helps.


'
' The most basic skeleton for TBGL, showing Quad View approach
' Petr Schreiber, started on 09-04-2008
'

Uses "TBGL"

' -- Create and show window
Dim hWnd As Dword = TBGL_CreateWindowEx("TBGL script - press ESC to quit", 640, 480, 32, %TBGL_WS_WINDOWED or %TBGL_WS_CLOSEBOX)
TBGL_ShowWindow

' -- Use light
TBGL_UseLighting %TRUE
TBGL_UseLightSource %GL_LIGHT0, %TRUE

tbgl_SetLightParameter %GL_LIGHT0, %TBGL_LIGHT_POSITION, 15, 10, 15, 1

DIM FrameRate AS DOUBLE

' -- Resets status of all keys
TBGL_ResetKeyState()

' -- Main loop
While TBGL_IsWindow(hWnd)
FrameRate = TBGL_GetFrameRate

Render_QuadView()

' -- ESCAPE key to exit application
If TBGL_GetWindowKeyState(hWnd, %VK_ESCAPE) Then Exit While

Wend

TBGL_DestroyWindow

SUB Render_QuadView()

' -- Prepares screen for 3D drawing
TBGL_RenderMatrix3D
TBGL_ClearFrame

' -- Setup first view, the top-left part of window
' -- As you can see, parameters are relative, so
' -- not dependant on window resolution
TBGL_Viewport (0, 0, 0.5, 0.5, %TBGL_PARAM_RELATIVE)
' -- Cancel all transformations
TBGL_ResetMatrix
' -- Setup camera to look on scene from 5,5,5 to origin of coordinates
TBGL_Camera 5, 5, 5, 0, 0, 0
' -- Render scene contents
Render_SceneGeometry()

' -- Setup second view, the top-right part of window
TBGL_Viewport (0.5, 0, 0.5, 0.5, %TBGL_PARAM_RELATIVE)
' -- Cancel all transformations
TBGL_ResetMatrix
' -- Setup camera to look on scene from -5,5,5 to origin of coordinates
TBGL_Camera -5, 5, 5, 0, 0, 0
' -- Render scene contents
Render_SceneGeometry()

' -- Setup third view, the bottom-left
TBGL_Viewport (0, 0.5, 0.5, 0.5, %TBGL_PARAM_RELATIVE)
' -- Cancel all transformations
TBGL_ResetMatrix
' -- Setup camera to look on scene from 5, 0, 0 to origin of coordinates
TBGL_Camera 5, 0, 0, 0, 0, 0
' -- Render scene contents
Render_SceneGeometry()

' -- Setup last view, the bottom-right
TBGL_Viewport (0.5, 0.5, 0.5, 0.5, %TBGL_PARAM_RELATIVE)
' -- Cancel all transformations
TBGL_ResetMatrix
' -- Setup camera to look on scene from 0, 0, 5 to origin of coordinates
TBGL_Camera 0, 0, 5, 0, 0, 0
' -- Render scene contents
Render_SceneGeometry()

' -- Now to render the lines separating the viewport we will use 2D mode
' -- We can set our own coordinate system, again independent on resolution
TBGL_RenderMatrix2D(0, 0, 1, 1)
' -- We want to switch viewport to cover whole screen
TBGL_Viewport (0, 0, 1, 1, %TBGL_PARAM_RELATIVE)

' -- Lets render lines
' -- We will disable light, we dont need super shading of 1 pixel thin line :)

TBGL_UseLighting %FALSE

' -- GL_LINES style means, that we will define each line using
' -- two x,y,z coordinates
TBGL_BeginPoly %GL_LINES
' -- Horizontal, from left to right, in half of screen
TBGL_Vertex 0, 0.5
TBGL_Vertex 1, 0.5

' -- Vertical, from top to down, in half of screen
TBGL_Vertex 0.5, 0
TBGL_Vertex 0.5, 1

TBGL_ENDPOLY

' -- Lets enable light back
TBGL_UseLighting %TRUE

' -- Puts all geometry on screen
TBGL_DrawFrame

end sub

SUB Render_SceneGeometry()

' -- Put here rendering code
TBGL_Box 1, 2, 3

END SUB



Petr