Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - bigsofty

#2476
GLBasic - en / INLINE calls
2007-Nov-24
Yay! Great stuff, your some guy Gernot! :D

There goes my weekend..! time to play... ;)
#2477
Quote from: GernotFrischUhm... Select, right mouse button: "Copy", maybe?
You can see the line numbers in the editor's status bar at the bottom.
If you have an error, simply double click on it to get there.
Scroll the compiler window to the top, locate the mouse to the top-left of the compiler window, hold down the left mouse button, pull down, this will highlight the compiler text and scroll the window to the bottom.

Right click on the highlighted text and select 'copy'.

Open your notepad and select 'paste'.
#2478
Sounds excellent Neurox, ty , its reassuring to see that another GLBasic Head is using the F200 as well.

To be honest, the touch screen is enough of a dramatic feature to shift the balance for me, emulation wise, its must be great for the old 16bit machines that used a mouse... the extras are just a bonus! :)

I'm sold! :D
#2479
OK, Santa's coming, the wifies asking what Id like, the GPX F200 looks like a fun toy... anyone got one and would like to share their experiences before we buy?
#2480
Just an idea for the future, how about binding OpenGL(or ES) API directly into the GLBasic command set, allowing low level programming of openGL using GLBasic variables without in-line? This would be a powerful addition and allow the user to take language as far as he wishes graphically without imposing on Gernots time.
#2481
Quote from: bigsoftySomething like this...?

Code (glbasic) Select
IF KEY(30)
 MOD(currentframe,5) // 0-4= running man for example
 currentframe=currentframe+1
ELSE
 currentframe=10 // 10=idle man stopped
ENDIF

DRAWSPRITE currentframe, -20, 255
Ha!, just noticed...

These two lines...

Code (glbasic) Select
MOD(currentframe,5) // 0-4= running man for example
 currentframe=currentframe+1
should be reversed... to avoid currentframe overflowing

Code (glbasic) Select
currentframe=currentframe+1
 MOD(currentframe,5) // 0-4= running man for example
doh!
#2482
2 uv's... handy! ;)
#2483
Hehe, your not bothering anyone bud! Just ask away... oh and dont worry about asking about any specific code or command.

Now, the best way I learned is not to try and force a unfamiliar command into your new game. The best way is to stop, read the docs and then write a very small test program that allows you understand the syntax and the command.

For example dim...

Consider this program...


Code (glbasic) Select
GLOBAL myvar
myvar=3
PRINT "result="+myvar, 10, 10
SHOWSCREEN
KEYWAIT
This is pretty obvious, create a var, put a value in it and print it. Here's the same program using arrays...

Code (glbasic) Select
DIM myvar[1]
myvar[1]=3
PRINT "result="+myvar[0], 10, 10
SHOWSCREEN
KEYWAIT
This is kinda silly but it does illustrate how arrays and vars are just the same, a place to store values. In this case I've create a list of the length of 1, to store a single value.

*Note* Oh why put '[1]' in the declaration but use
  • in the reference? The [1] is the length of the list (or array), the actual list starts 0, so
  • is the first item in the list.

Now what if I wanted to store 4 values, I could use 4 variable but this is where arrays start to make sense...


Code (glbasic) Select
DIM myvar[4]
myvar[0]=3
myvar[1]=5
myvar[2]=6
myvar[3]=7
PRINT "result array 0="+myvar[0], 10, 10
PRINT "result array 1="+myvar[1], 10, 20
PRINT "result array 2="+myvar[2], 10, 30
PRINT "result array 3="+myvar[3], 10, 40
SHOWSCREEN
KEYWAIT
Now a 2 dimentional array, the list is replaced by a grid of variables, each one capable of holding a value. As its a grid each variable needs a unique 'X' and 'Y' co-ordinate to locate the individual items.

Code (glbasic) Select
DIM myvar[2][2] // 2 by 2 grid = 2*2 = 4 total variables
myvar[0][0]= 3 // 0,0 top left of 2 by 2 grid
myvar[1][0]= 5 // 1,0 top right of 2 by 2 grid
myvar[0][1]= 6 // 0,1 bottom left of 2 by 2 grid
myvar[1][1]= 7 // 1,1 bottom right of 2 by 2 grid
PRINT "result of array 0,0=" + myvar[0][0], 10, 10
PRINT "result of array 1,0=" + myvar[1][0], 10, 20
PRINT "result of array 0,1=" + myvar[0][0], 10, 30
PRINT "result of array 1,1=" + myvar[1][1], 10, 40
SHOWSCREEN
KEYWAIT
Now why use a 2 by 2 array (Grid), why not 'DIM mayvar[4]', well logically some data structures 'fit' into the idea of 2 dimentional array better than others...

3 by 3, Tic,Tac,Toa games
12 by 12, Chess
16 by 16, Battleships
A platform game tile grid, say 100 by 100 for example
RTS game... etc...

All individual tiles are easily refrenced and examined with two numbers, the X and Y co-ordinates of the array.
#2484
Something like this...?

Code (glbasic) Select
IF KEY(30)
 MOD(currentframe,5) // 0-4= running man for example
 currentframe=currentframe+1
ELSE
 currentframe=10 // 10=idle man stopped
ENDIF

DRAWSPRITE currentframe, -20, 255
#2485
One thing Planetm, there is a header pack that Gernot posted that has all the standard C functions, nicely integrated into the GLBasic directory structure, get this is you want to do anything with C easily ;)
#2486
GLBasic - en / INLINE calls
2007-Nov-18
Ah bummer, no problem Gernot, I hope its not a bad problem...
#2487
Both integrating (Inline) and interfacing (using the headers) the commands would be possible with GLBasic, its a pretty specialised piece of kit though and hard to test without the board...
#2488
GLBasic - en / INLINE calls
2007-Nov-17
Any luck Gernot? ;)
#2489
I'm not commenting on coding style, this is just a question of syntax.

For the record, I don't use GOTO either, but Shaf's original code is so old, he may have no option if he wishes to avoid a major rewrite.
#2490
You dont need to turn N into an array or put it into a loop, the SELECT statement will select your correct value for c1 and ignore the other lines, hence its a lot quicker... so...

Code (glbasic) Select
SELECT c1
  CASE 0 GOTO 100
  CASE 1 GOTO 100
  CASE 2 GOTO 200
  CASE 3 GOTO 200
  CASE 4 GOTO 500
ENDSELECT
Not used in this example but the SELECT statement has extra commands for handling certain situations...

Code (glbasic) Select
CASE 6 TO 99 GOTO 200 // if C1 was between 6 and 99or

Code (glbasic) Select
CASE >100 GOTO 100 // if C1 was greater then 100or

Code (glbasic) Select
DEFAULT GOTO 300 // If C1 has a value that SELECT does not handle (eg... -10), same ELSE in an IF