Mir war langweilig und ich dachte mir, tipste mal schnell was in INLINE um dir die Zeit zu vertreiben...
Naja mit Types wärs auch gegangen, aber naja :D
Ist auf alle Fälle ein kleiner Einblick in INLINE. Falls es einer noch nicht kennt ;)
E = CreateEntity()
SetEntityName(E,"E")
SetPosition(E,100,100)
n = CreateEntity()
SetEntityName(n,"N")
SetPosition(n,120,100)
t = CreateEntity()
SetEntityName(t,"T")
SetPosition(t,140,100)
i = CreateEntity()
SetEntityName(i,"I")
SetPosition(i,160,100)
t2 = CreateEntity()
SetEntityName(t2,"T")
SetPosition(t2,180,100)
y = CreateEntity()
SetEntityName(y,"Y")
SetPosition(y,200,100)
WHILE TRUE
INC phi,2
PRINT GetEntityName$(E), GetPositionX(E),GetPositionY(E)+SIN(phi)*20
PRINT GetEntityName$(n), GetPositionX(n),GetPositionY(n)+SIN(phi+60)*20
PRINT GetEntityName$(t), GetPositionX(t),GetPositionY(t)+SIN(phi+120)*20
PRINT GetEntityName$(i), GetPositionX(i),GetPositionY(i)+SIN(phi+180)*20
PRINT GetEntityName$(t2), GetPositionX(t2),GetPositionY(t2)+SIN(phi+240)*20
PRINT GetEntityName$(y), GetPositionX(y),GetPositionY(y)+SIN(phi+300)*20
SHOWSCREEN
WEND
END
FUNCTION foo:
ENDFUNCTION
INLINE
class tentity{
public:
int x;
int y;
DGStr name;
};
DGArray<tentity> entitys;
int _CreateEntity(){
tentity ent;
REDIM(entitys(), LEN( entitys() ) +1);
entitys( LEN( entitys() ) -1) = ent;
return LEN( entitys() ) -1;
}
int _GetPositionX(int handle){
return entitys(handle).x;
}
int _GetPositionY(int handle){
return entitys(handle).y;
}
// Name einfügen
void _SetEntityName(int handle,DGStr name){
entitys(handle).name = name;
}
// Name abfragen
DGStr _GetEntityName(int handle){
return entitys(handle).name;
}
void _SetPosition(int handle,int x, int y){
entitys(handle).x = x;
entitys(handle).y = y;
}
ENDINLINE
FUNCTION CreateEntity:
INLINE
return _CreateEntity();
ENDINLINE
ENDFUNCTION
FUNCTION SetEntityName: handle, name$
INLINE
_SetEntityName( handle, name_Str.c_str() );
ENDINLINE
ENDFUNCTION
FUNCTION GetEntityName$: handle
INLINE
return _GetEntityName(handle);
ENDINLINE
ENDFUNCTION
FUNCTION GetPositionX: handle
INLINE
return _GetPositionX(handle);
ENDINLINE
ENDFUNCTION
FUNCTION GetPositionY: handle
INLINE
return _GetPositionY(handle);
ENDINLINE
ENDFUNCTION
FUNCTION SetPosition: handle, x, y
INLINE
_SetPosition(handle,x,y);
ENDINLINE
ENDFUNCTION