Most people wont be able to compile or run this yet, but I thought I'd give you all a (non) trivial example of the extended types...
TYPE tCosTable
value
ENDTYPE
TYPE tColour
value%
ENDTYPE
TYPE TPlasma
cosTable[] AS tCosTable
colourTable[] AS tColour
screenWidth%;screenHeight%
wave%
stp%
FUNCTION Initialise_Plasma%:
LOCAL loop%
LOCAL cTable AS tCosTable
LOCAL cColour AS tColour
DIM self.cosTable[0]
DIM self.colourTable[0]
GETSCREENSIZE self.screenWidth%,self.screenHeight%
// Create COS table
FOR loop%=0 TO self.screenWidth%*2
cTable.value=SIN(360.0*loop%/320.0)*32+32
DIMPUSH self.cosTable[],cTable
NEXT
FOR loop%=0 TO 255
cColour.value%=RGB(0,0,loop%)
DIMPUSH self.colourTable[],cColour
NEXT
self.wave%=0
self.stp%=14
ENDFUNCTION
FUNCTION Update_Plasma%:
LOCAL x%,y%
LOCAL pos1,pos2
INC self.wave%,3
IF self.wave%>320
self.wave%=0
ENDIF
FOR y%=0 TO self.screenHeight%-1 STEP self.stp%
pos1 = self.cosTable[y%+self.wave%].value
FOR x% = 0 TO self.screenWidth%-1 STEP self.stp%
pos2 = (self.cosTable[x%+self.wave%].value + self.cosTable[x%+y%].value + pos1)
STARTPOLY -1
POLYVECTOR x%+self.stp%,y%,0,0,self.colourTable[self.cosTable[pos2].value].value
POLYVECTOR x%,y%,0,0,self.colourTable[self.cosTable[pos2].value].value
POLYVECTOR x%,y%+self.stp%,0,0,self.colourTable[self.cosTable[pos2].value].value
POLYVECTOR x%+self.stp%,y%+self.stp%,0,0,self.colourTable[self.cosTable[pos2].value].value
ENDPOLY
NEXT
NEXT
ENDFUNCTION
ENDTYPE
LOCAL plasma AS TPlasma
plasma.Initialise_Plasma()
WHILE KEY(1)=0
plasma.Update_Plasma()
SHOWSCREEN
WEND
I LIKE .................. :enc:
Great example!
This looks lovely!
Will there be inheritance also? I.e. types that can extend other types?