Array und Inline

Previous topic - Next topic

Heiko

Unten ein St?ck code welches mir Kopfschmerzen bereitet.

ich fange mal an:
Code (glbasic) Select
Inline
// Font struct !
struct sFI_FontProperty {
int Width,Height,FirstChar,Kerning;
int Image,FrameWidth,FrameHeight,FrameCount;
int* Chars;

sFI_FontProperty() { Chars = new int[256]; }
~sFI_FontProperty() { delete Chars; }
};
endinline


Code (glbasic) Select
TYPE FI_FontPropertyType
Width%
Height%
FirstChar%
Kerning%
Image%
FrameWidth%
FrameHeight%
FrameCount%
Chars[256]
ENDTYPE
GLOBAL FI_FontProperty AS FI_FontPropertyType


Code (glbasic) Select
FUNCTION xGetFontProperty: font
LOCAL res
LOCAL temp
INLINE
sFI_FontProperty typ;
    res = wrap_xGetFontProperty(font,&typ);
    FI_FontProperty.Width = typ.Width;
    FI_FontProperty.Height = typ.Height;
    FI_FontProperty.FirstChar = typ.FirstChar;
    FI_FontProperty.Kerning = typ.Kerning;
    FI_FontProperty.Image = typ.Image;
    FI_FontProperty.FrameWidth = typ.FrameWidth;
    FI_FontProperty.FrameHeight = typ.FrameHeight;
    FI_FontProperty.FrameCount = typ.FrameCount;
   
ENDINLINE

FOR i = 0 TO 255
INLINE
temp = typ.Chars[i];
ENDINLINE
FI_FontProperty.Chars[i] = temp
NEXT

RETURN res
ENDFUNCTION


Das temp unten kann man sicher auch weglassen, dabei muss glaub ich aber dann aus eckigen, runde klammern gemacht werden bei dem Chars[] array.

Nunja, es kommt dieser Fehler, den ich nicht verstehe.

Code (glbasic) Select
C:\Users\Nutzer\AppData\Local\Temp\glbasic\gpc_temp2.cpp: In function `DGInt __GLBASIC__::xGetFontProperty(DGInt)':
C:\Users\Nutzer\AppData\Local\Temp\glbasic\gpc_temp2.cpp:1479: error: invalid types `int*[DGInt]' for array subscript


Ich m?chte das Array FI_FontProperty.Chars[] mit den Werten von typ.Chars[] f?llen.
Sollte eigentlich nicht sooo schwer sein, oder?

Vielleicht wei? ja jemand hier einen Rat.


Kitty Hello

temp = typ.Chars;

das "i" ist hier ein double.
Mach FOR i% = ....