In this case is more efficient to save the funcion result in a variable.
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
INC var, 2 // var += 2
DEC var, 2 // var -= 2
INC var // var++
DEC var // var--
var = ASL(var, 2) // var <<= 2
var = ASR(var, 2) // var >>= 2
INLINE
var *= 2;
ENDINLINE
LOCAL mapb[] AS BYTE // works ok
DIM mapb[100]
mapb[0] = 123
QuoteIf I define a variable as a "char" I can't use the function "Readbyte" with it. Readbyte wants "DGNat", I want to use a char thoughI think you can use a integer(%) variable for READBYTE, and then assign the value to a BYTE variable using this: byteval = (num%). Curiously using () works ok .
if self.x > self.y then inc self.x
if .x > .y then inc .x
Quote from: Kitty Hello on 2010-Oct-18This LEN() function could be confuse with the length of a string. I suggest PIXLEN() or PXLEN() as names to inform that the result units are different.
To get the width of that string in pixels, use LEN(text$, bKerning%)
Quote from: Slydog on 2010-Nov-04GLBasic converts constants in special variables that you can't write.
Looking at your code in 'gpc_tempg.cpp', does GLBasic just convert our constants into standard C++ variables?
How do normal C++ constants work? Do they take up memory? Or just used as a direct text replacement on compile time, using no extra memory?
If using constants takes memory, then what advantages do they have?
GLOBALs would work the same but without these problems.
CONSTANT SCR_WIDTH = 640
CONSTANT TSIDE = 32 // tile side
CONSTANT SCR_COLS = SCR_WIDTH / TSIDE
void __glb_init_globals(){
SCR_WIDTH= 640;
SCR_COLS= SCR_WIDTH / TSIDE; // TSIDE is 0!!
TSIDE = 32;
}
CONSTANT SCR_COLS = SCR_WIDTH / 32