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.


Topics - AndyH

Pages: [1] 2 3 ... 5
1
Off Topic / Retro Remake Regulars sign in
« on: 2009-Aug-10 »
Just wondering how many Retro Remake forum regulars are here now?  I've seen one or two new names here in GLB land that I recognise ;)

Sign in..

Andy H (Ovine)

2
The ability to assign a default value to a type works for functions when it is in the main (first) GBAS file, but if you declare in an additional file you get an error.

Try this code:
Code: (glbasic) [Select]
TYPE TEST
t = RGB(255,255,255)
ENDTYPE

First in the main file, it will compile, then add a second file to your GLB project and move it in there.  I get this error (on V7 RC2):

Code: (glbasic) [Select]
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.029 SN:4cca05d9 - 3D, NET
"second file.gbas"(7) error : command not inside function or sub

3
Bug Reports / INLINE compile failure in V7 RC1
« on: 2009-Aug-07 »
This code gives an error in V7 (works in earlier versions):

Code: (glbasic) [Select]
FUNCTION QSIN: x

    WHILE x>360.0;  DEC x, 360.0; WEND
    WHILE x<0;      INC x, 360.0; WEND
    IF x>180.0 THEN x = 180.0-x

    x = x/57.296
    x = 1.2732 * x -0.4053 * x * ABS(x)

x = 0.225*(x*ABS(x)-x)+x
RETURN x
ENDFUNCTION


FUNCTION QCOS: x
RETURN QSIN(x+90)
ENDFUNCTION


INLINE
float qInvSqrt(float x){
   float xhalf = 0.5f * x;
   int i = *(int*)&x; // store floating-point bits in integer
   i = 0x5f3759d5 - (i >> 1); // initial guess for Newton's method
   x = *(float*)&i; // convert new bits into float
   x = x*(1.5f - xhalf*x*x); // One round of Newton's method
   return x;
}
ENDINLINE


FUNCTION QSQR: y
INLINE
return 1.0f / qInvSqrt(y);
ENDINLINE
ENDFUNCTION


_______________________________________
*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.7.023 SN:4cca05d9 - 3D, NET
Wordcount:14 commands
compiling:
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp: In function `float __GLBASIC__::qInvSqrt(float)':
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:135: error: a function-definition is not allowed here before '{' token
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:154: error: a function-definition is not allowed here before '{' token
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:158: error: a function-definition is not allowed here before '{' token
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp: At global scope:
C:\DOCUME~1\AndyH\LOCALS~1\Temp\glbasic\gpc_temp0.cpp:170: error: expected `}' at end of input
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 1.6 sec. Time: 21:25
Build: 0 succeeded.
*** 1 FAILED ***

4
Bug Reports / Debug bug with build 6.184
« on: 2009-Mar-08 »
My game won't run when in Debug mode since I updated GLB to the build 6.184.  In release mode it works - just not in debug mode.

In Debug mode it will just exit without an error.  I've tracked it down to this line ...

IF SPLITSTR( strLine$, st$[], ",") = 7

which has the following in strLine$:

20,FIRE BUTTON INCREASES SPEED,FEUER-KNOPF BESCHLEUNIGT,APPUYEZ LE BOUTON FEU POUR AUGMENTER LA RAPIDITE,JOYSTICKKNAPPEN ÖKAR HASTIGHETEN,jmnoj` ncm) sbekhwhb`er qjnpnqr|,SKYTE KNAPPEN GJØR DET RASKERE

st$[] contains 7 elements (0 to 6) from the previous loop (this is in a loop that has run so far for 19 iterations each with different data in the strLine$ variable).


It was working in the previous build in Debug and Release mode.

5
GLBasic - en / Strict and AutoCase
« on: 2009-Feb-19 »
Hi Gernot

Could I request two teeny additional features for GLB in the editor and compiler to be added to the wish list?

First one is could you add a strict option in GLB to fail compilation with an error instead of a warning when a variable has not been declared.  Make this an option that is off by default so not to cause any compatibility problems with older code and those that don't want it.  See reasons why below.

Second one is could you add an option to the editor to not change the case of what you type when it detects a reserved word.  And add a button to reformat the current code window (force case, spacing, indenting etc) so you can tidy up your code when you need to.  I know some people will like it, so again as an option, but for me it tends to get in the way.  The colour coding is not a problem (and is helpful) but the change to UPPERCASE changes your program.



The reason for the two above requests are that often, while in a procedure for example, I declare a local variable that starts with a reserved word, such as MAX for example, often GLB will jump in and change that part to upper case.  For example if I have a variable called "maxt" it I press del key to remove the 't' then max becomes MAX.  If I leave it as-is, and now have a new variable called MAXt, a different variable to maxt.  See code below.

Example:
FUNCTION test1:
   LOCAL maxt
   maxt=0
   MAXt=1
   
   PRINT maxt + " " + MAXt,0,0
   SHOWSCREEN
   KEYWAIT
ENDFUNCTION

in the compilation log (but only when in debug mode):
"test.gbas"(4) warning : implicitly created GLOBAL  : MAXt


The output from the above is "0 1" because we've now got two different variables.  If you have debug mode off you don't even see the warnings.

Would it be possible to add these features?  The strict option would stop any errors being introduced and if we could turn off auto formatting we could avoid the annoying renaming (by change to uppercase) of variables when we don't want them to.  It's a pain to avoid every reserved word as part of a variable name or to retyping in lowercase.

6
Bug Reports / collect2: cannot find `ld'
« on: 2008-Jul-03 »
Hi Gernot,

Any idea what's causing this error (I have the latest patch).

There's no indication if it's in my source and as it happens on linking could it be something in GLB?

*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2008.179 - 3D, NET
Wordcount:3328 commands

compiling:

linking:
collect2: cannot find `ld'
*** FATAL ERROR - Please post this output in the forum
_______________________________________
*** Finished ***
Elapsed: 19.4 sec. Time: 19:36
Build: 0 succeeded.
*** 1 FAILED ***


7
Here's the image:




and here's some code:

Code: (glbasic) [Select]
SETSCREEN 640,480,0
LIMITFPS 60

BLACKSCREEN

LOADSPRITE "achannel.png",0

WHILE TRUE
LOCAL x,y,a,b

IF KEY(2) THEN ALPHAMODE -1
IF KEY(3) THEN ALPHAMODE 1

DRAWRECT 105,105,100,10, RGB(0,0,255)

MOUSESTATE x,y,a,b
DRAWSPRITE 0, x,y

DRAWSPRITE 0,100,100

SHOWSCREEN

WEND
By default, the alpha channel on the red circle is ignored.  If shows a solid circle.  Hold 1 on the keyboard to apply the alphamode of -1 and the alpha channel works.  Is this correct or should alphamode 0 also work?

8
GLBasic - en / Glow effects
« on: 2008-Mar-27 »
Hi all

Is there any way to make glow effects in GLB?

What I'd normally do is use an alpha channel and additive blending.  I don't think GLB can currently load graphics with alpha channels?

I've tried alphamode 0.1 -> 1.0 with a variety of graphics but I'm not able to find anything that works for me.

I also found this (scroll down to Gernot's post) which looks interesting over at RR, but I can't seem to get it to work.

Any suggestions (and code examples)?

9
GLBasic - en / Try ... Catch ... Throw
« on: 2008-Mar-25 »
Would it be possible for GLB to support TRY ... CATCH blocks and THROW functionality for handling unexpected and expected errors?

This is not generally something you see in traditional BASIC's but you do get in most modern langauges (including VB) because it can help you to manage runtime errors quite easily.

10
Bug Reports / Mac OS-X Compilation error
« on: 2008-Mar-22 »
Hi

Getting this error when compiling to Mac...

*** Configuration: OS-X_UNI ***
precompiling:
GPC - GLBasic Precompiler V.2008.073 - 3D, NET
Wordcount:2097 commands

compile+link:
/cygdrive/c/Program Files/GLBasic/Compiler/platform/Mac/Bin/../libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: table of contents for archive: /cygdrive/C/Program Files/GLBasic/Compiler/platform/Mac/OSX/Lib/libGLBasicUni.a is out of date; rerun ranlib(1) (can't load from it)
collect2: ld returned 1 exit status
*** FATAL ERROR - Please post this output in the forum



All other platforms seem to be OK.

11
I have a project with many source files.

I referred to two variables x and y which did not exist, I should have referred to something different.  GLB's compiler correctly warned me that these will be globals however it reported the wrong file and line number which made tracking down where I'd made the mistake frustratingly hard.

Here's the message it gave me:

*** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.2008.073 - 3D, NET
"Languages.gbas"(31) warning : implicitly created GLOBAL  : x
"Languages.gbas"(31) warning : implicitly created GLOBAL  : y

Languages.gbas is another file, and line 31 is the last line of that file.  Can this be corrected?

12
GLBasic - en / GP2X buttons?
« on: 2008-Mar-13 »
Hi - could anyone with a Gp2X help confirm what some of the buttons are:

Buttonlayout for GP2X:
Button4 = TAT
Button9 = FL
Button10= FR


TAT?

FL/FR are those the left and right shoulder buttons?

13
Code Snippets / Input testing across platforms
« on: 2008-Mar-13 »
Thought I'd post this in case it is of any use to someone.  A snippet of code from my game where I handle mouse, joystick and keyboard inputs.  Tested on PC and PocketPC so far, the plan would be to refine it more as I get to test it on Mac / Linux and GP2X devices.  For the PocketPC side, it omits the tests that really slows the PPC down (I was loosing up to 10 frames per second testing for joystick or keys that do not exist on the PPC).

Code: (glbasic) [Select]
TYPE tInput
x;y // x and y values
fire // firebutton
lx;ly // last x and y pressed flags (for key+joy) 0 =not pressed, 1=just pressed, 2=held down state
lfire // fire last pressed flag
mx;my // mouse pos
ma;mb // mouse buttons
ENDTYPE

// all these globals are stored in a game type but I've extracted them to separate globals here for simplicity
GLOBAL inp as tInput
GLOBAL devices$
devices$ = PLATFORMINFO$("DEVICE")
GLOBAL numjoy
numjoy = GETNUMJOYSTICKS()



GetAllInputs( inp )

// now can test values in inp.x, inp.y for example,  inp.mx and inp.my for mouse
// lx, ly, lfire contain 1 if direction x / y / firebutton just pressed, or 2 if currently held


FUNCTION GetAllInputs: inp AS tInput
LOCAL vx, xx,yy, ff, i, kf

xx=0
yy=0
ff=0
kf=0
IF devices$<>"POCKETPC"
IF numjoy>0
xx=GETJOYX(0)
yy=GETJOYY(0)
FOR i=0 TO 3
IF GETJOYBUTTON(0,i) THEN ff=1
NEXT
ENDIF

IF KEY(29) OR KEY(57) THEN kf=1
ENDIF
IF KEY(28) THEN kf=1

// if XX val returned not moved, check for keys instead
IF xx>=-0.1 AND xx<=0.1
xx=0
IF KEY(203) THEN xx=-0.5
IF KEY(205) THEN xx=0.5
IF kf=1
xx=xx*2
ff=1
ENDIF
ENDIF
// if YY val returned not moved, check for keys instead
IF yy>=-0.1 AND yy<=0.1
yy=0
IF KEY(200) THEN yy=-0.5
IF KEY(208) THEN yy=0.5
IF kf=1
yy=yy*2
ff=1
ENDIF
ENDIF
inp.x=xx
inp.y=yy
inp.fire=ff
IF inp.x <> 0
IF inp.lx < 2 THEN INC inp.lx,1
ELSE
inp.lx=0
ENDIF
IF inp.y <> 0
IF inp.ly < 2 THEN INC inp.ly,1
ELSE
inp.ly=0
ENDIF
IF inp.fire <> 0
IF inp.lfire < 2 THEN INC inp.lfire,1
ELSE
inp.lfire=0
ENDIF
MOUSESTATE inp.mx, inp.my, inp.ma, inp.mb

ENDFUNCTION

14
Bug Reports / Editor settings not saved?
« on: 2008-Mar-12 »
If I move the Jumps/Files/Web/Debug to the left side of the editor it does not remember the position next time I open GL Basic.  Can this be saved please :)

15
If you do not have the Jumps tab showing on the sidebar, then any functions you create will not get the syntax highlighting until you select the Jumps tab and then click back in to the text editor.

Just an annoyance, but gets more so when you have more than one source code file in the Files tab in the sidebar, you have to go between them all for all of them to be recognised.

Could the Jumps tab be updated when you are working in the text editor when the Jumps tab is not visible?

Pages: [1] 2 3 ... 5