by GernotFrisch:
// If this is not a seperate file, you must end the main() function first
FUNCTION _foo:
ENDFUNCTION
// Global variable for storing the bank pointers
INLINE
DGArray<unsigned char*> gMemBanks;
class MemBank_cleaner
{
public:
~MemBank_cleaner()
{
for(int i=0; i<(int)LEN(gMemBanks); ++i)
FREEBANK(i);
}
} gMemBankClean;
ENDINLINE
FUNCTION CREATEBANK: index, memsz
INLINE
if(LEN(gMemBanks) <= index)
REDIM(gMemBanks, index+1);
gMemBanks(index) = new unsigned char[(int)memsz];
ENDINLINE
ENDFUNCTION
FUNCTION POKEBYTE: ibank, position, value
INLINE
gMemBanks(ibank)[(int)position] = (unsigned char)value;
ENDINLINE
ENDFUNCTION
FUNCTION PEEKBYTE: ibank, position
INLINE
return (DGInt)gMemBanks(ibank)[(int)position];
ENDINLINE
ENDFUNCTION
FUNCTION FREEBANK: ibank
INLINE
if(gMemBanks(ibank))
{
delete[] gMemBanks(ibank);
gMemBanks(ibank) = 0L;
}
ENDINLINE
ENDFUNCTION
Wäre ein ResizeBank auch noch möglich?
Sowas wäre ja auch was fürs nächste große Update, als Integration.
is irgendwie nicht wirklich Basiclike, deshalb wirds auch nur ein Inline bleiben ;)
schade, naja, aber besser als nix.
da wäre aber tatsächlich mal so ein userlibs ordner als standard oder so der übersicht halber net schlecht.
kannste ja machen ;)
wie das denn, ich mein so einen automatischen ordner, wo die includes abgelegt werden und die dll´s.
okay die muss man dann auch hinterher ins spieleverzeichnis kopieren, aber sonst....
ich denke mal so ein standard userlibs ordner müsste doch von gernot erstellt werden, oder?
also wo automatisch drauf zugegriffen wird, bei bedarf.
ich hab dazu mal ne frage.
peekbyte und peeklong.
peekbyte% logisch, liest ein byte.
was aber liest peeklong% ?
nur nen integer?
aber in welchem bereich.
bräuchte das in bestimmten bereichen.
readbyte liest ein byte
readword 2 bytes 0-65535 oder so...
was aber liest diesen bereich? -2147483648 +2147483647
shortieee ?
oder liest das beides das peeklong?
ich mein, wenns kein höherer speicherverbrauch ist, welcher zu berücksichtigen wäre, ists ja wurscht.
bitte um ne kurze erklärung.
byte = 1 unit
word or short = 2 units
long = 4 units
When you want a word you peekbyte two bytes after eachothers and put them together, one you multiply with 256.
With long you do the same but get 4 bytes, each time multiply with 256 more (0x100, 0x10000, 0x1000000) to move it to the right position.
Hope this is what you asked about, I don't know much german but have a little spare time :-)
i need READanycommand -2147483648 - +2147483647
That is a long wich is 4 bytes and you want it signed. Since this is the default in GLBasic you don't need any databank, just use a normal array.
so ists just a READLONG.
yes i see thats the wrong section for asking that.......i´m confused cause its to late today....