News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

PlayBASIC - Community Roadmap Discussion

Started by kevin, September 13, 2020, 12:01:03 AM

Previous topic - Next topic

kevin





PlayBASIC - Community Roadmap Discussion (13th Sep, 2020)


    This thread is for the community to help build a workable realistic list of additions the community would like to see come to PlayBASIC.




PlayBASIC BLOG Episoded #15 - Roadmap




 PlayBASIC BLOG Episode #15 -  Road Map - From Here To Nowhere  (13th Sep 2020) (login required)





Retail Upgrade History (Blogs)


    For older upgrade work in progress see,

   See  PlayBASIC V1.64P

   See  PlayBASIC V1.64O

    See  PlayBASIC V1.64N2 & V1.64N3

    See  PlayBASIC V1.64N

    See  PlayBASIC V1.64M

    See  PlayBASIC V1.64L Learning Edition History (Building learning Edition Thread)





Thread Mission Statement:


      Thread Objectives:  Survey the PB community for potential feature additions (including implementations) that would benefit their PlayBASIC development.




User Feedback Links






Note:


      Feel free to list whatever you want, but all I ask is that at least attempt to think through how your ideas will be implemented / appear in PB.   Refraining from one line list of random ideas.    





stevmjon

hey kev

long video. i don't know enough about new features to list them. i've only used basic. you seemed to have idea's about what you would like to implement.
i would say to focus on what you said about getting v1.65 stable to add pb2dll. this way people can write dll libraries to get their programs sped up in the areas they want to focus on.

is there any tasks we could help you with, since you are limited with time? like a repeatative task that takes time...

focus on what you enjoy doing, as you are the one programming pb. you need to like coding what you think is necessary to implement.
no point angry coding and mashing keys, needing a punching bag set up next to your computer desk, lol.

   stevmjon

It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin


Hey Steve,

Quotelong video.

    sorry about about that, it was way longer tho.   :)   


Quotei don't know enough about new features to list them. i've only used basic. you seemed to have idea's about what you would like to implement.

   hmm... perhaps features was the wrong what to parse it..   

   language & command sets tweaks..  you know things that might just be small extensions to something that's been overlooked  is as good place to start as any.   

   I'm definitely no language guru..  way out of the loop today !


Quote
i would say to focus on what you said about getting v1.65 stable to add pb2dll. this way people can write dll libraries to get their programs sped up in the areas they want to focus on. 

Quoteis there any tasks we could help you with, since you are limited with time? like a repeatative task that takes time...

    Not that I can think of atm,  but there's bound to be something. 


Quotefocus on what you enjoy doing, as you are the one programming pb. you need to like coding what you think is necessary to implement.
no point angry coding and mashing keys, needing a punching bag set up next to your computer desk, lol.

   
   unfortunately most projects tend to be mostly coal mining with the odd golden moment in between.    that's why  my office has my drum pad next to the throne..  :) 



kevin

#3
   Since everybody is shy..   Here's a couple of Pixel/Colour functions that could be useful in certain types of programs.  


  (Function Names / behaviors are MOCKUP)



  SampleImage(ThisImage, ScaleX#,ScaleY#)

    The function would read a pixel from the supplied image by scaling the X/Y cords by scale values.   So 0.5 would be half way across or down the image.   So you don't need to know the size of the image your sampling.  


PlayBASIC Code: [Select]
      img=loadnewimage("SOME-IMAGE.bmp",2)

drawimage img,0,0,false

setcursory getimageheight(img)

print hex$(SampleImagePoint(img,0 ,0))
print hex$(SampleImagePoint(img,0.5 ,0))
print hex$(SampleImagePoint(img,1 ,0))

print hex$(SampleImagePoint(img,0 ,0.5))
print hex$(SampleImagePoint(img,0.5 ,0.5))
print hex$(SampleImagePoint(img,1 ,0.5))

print hex$(SampleImagePoint(img,0 ,1))
print hex$(SampleImagePoint(img,0.5 ,1))
print hex$(SampleImagePoint(img,1 ,1))


sync
waitkey


Function SampleImagePoint(ThisIMage,ScaleX#,Scaley#)
oldimage=getsurface()
rendertoimage ThisImage

w=GetImageWidth(ThisImage)-1
h=GetImageHeight(ThisImage)-1

x=mod(Scalex#*W,W)
y=mod(Scaley#*H,H)

ThisRgb =Point(X,Y)
rendertoimage oldimage
EndFunction ThisRGB







kevin

 Was thinking about some type of array styled logic statement to choose which variable is read. 

PlayBASIC Code: [Select]
 a=10
b=20
c=30
d=40

for lp=0 to 3
print SelectVariable(lp,A,B,C,D)
next





  This would output,   10 - 20 - 30 - 40

  literals would also work, pulling data from arrays would be beyond it tho. 

 






kevin

#5

   FolderExist & FileExist need to support compile time evaluation.  

   For example if folder exist could eval at compile time,  then the code could check which version of a library to include.   Handy for when working on a library, which is then ignored when deployed.

   Here's an example of what I mean..  So in the case of the Math64 library the code could detect if it's being built on my system, or the DLL is stored locally within the folder and use that.



PlayBASIC Code: [Select]
      constant DLL_WORKPATH$="Some Long Path where the DLL is behind built\PB_Math64\Release\"

#if folderexist(DLL_WORKPATH$)
constant DLL_PATH$ = DLL_WORKPATH$
#else
constant DLL_PATH$ = ""
#endif


linkdll DLL_PATH$+"PB_Math64.dll"


// Read / Write Strings to 64Bit variable Space

PB64_LexCode(SourceCode$) alias "_PB64_LexCode@4" as integer
PB64_Compile(SourceCode$) alias "_PB64_Compile@4" as integer
PB64_Execute(ProgramPTR) alias "_PB64_ExecutePRG@4"
PB64_GetVariablePtr(ProgramPTR, VariableName$) alias "_PB64_GetVariablePtr@8" as integer
PB64_GetVariableAsFLT(ProgramPTR,VariableName$) alias "_PB64_GetVariableAsFLT@8" as float
PB64_SetVariablePTR(ProgramPTR,VariableName$,SrcPtr) alias "_PB64_SetVariablePTR@12"
PB64_SetVariableFLT(ProgramPTR,VariableName$,ThisValue#) alias "_PB64_SetVariableFLT@12"
PB64_SetVariableINT(ProgramPTR,VariableName$,ThisValue) alias "_PB64_SetVariableINT@12"

etc etc

endlinkdll







      Beyond that you could have the compile abort if a DLL (or any FILE) can't be located at compile time.



PlayBASIC Code: [Select]
             #if Fileexist(DLL_PATH$+"PB_Math64.dll")=false

#Abort "Missing DLL"
#endif


linkdll DLL_PATH$+"PB_Math64.dll"






kevin

    Quantity functions

     It'd be handy if the quantity functions hand optional mode params.   Allows the user return not just the upper limit of a medias indexes,  but the number of resources that are currently allocated within this structure.



 
PlayBASIC Code: [Select]
      for lp =0 to 9
Bank=Newbank(1000)
next

print GetBankQuant()
print GetBankQuant(1) ; return the used banks
Sync
waitkey



Function GetBankQuant(Mode=0)
Size = getBankQuantity()
if Mode=0
exitfunction Size
else
local lp
for lp=1 to Size
Usedbanks += GetBankStatus(lp)
next

endif

ENdFunction UsedBanks



kevin

#7
     There's this old issue with using the TYPE Name and Object together to return the HANDLE of the object (the resource index inside PB this data lives within) ,  but that same syntax is also used to retrieve POINTERS to structures within an array.  

    Meaning there's not really a way to get the pointer to Type Variable without a LIST attached to the Type.   Not list, not pointer, but it could return the pointer of the first cell in the structure when no list is present, which would be the normal type variable.


PlayBASIC Code: [Select]
   Type VM_RETRIEVED_FUNCTION_INFO
Parm1
parm2
EndType

Dim Test1 as VM_RETRIEVED_FUNCTION_INFO

Dim Test2(0) as VM_RETRIEVED_FUNCTION_INFO

p=getlistptr(Test1.VM_RETRIEVED_FUNCTION_INFO)
print p

p=Test2(0).VM_RETRIEVED_FUNCTION_INFO
print p

sync
waitkey







stevmjon

can you make a video about what you are explaining. i sorta get it but am not sure what the actual issue is focused on.
not sure what KIST is also.

could you explain how variables, arrays(), and types are created and stored in memory (more a visual explanation so we can see what is happening).
i have always been interested at how memory works, and how the data is stored and access to this data.

i did have an idea about types. is there any reason you can't create a type and have it set up in memory, side by side, similar to an array?
instead of creating each type cell as you need to use it...

the difference between the array polygon(9,2) which creates the entire array in memory. you can treat it like the second element 0=x , 1=y , 2=z, and a type that mimics this.
the type, lets say [ type poly: x,y,z end type ]. and then dim polygon(9) as poly. so now we can use the type the same way as the polygon(9,2).
eg. array polygon(0,0) is equivalent to type polygon(0).x
eg. array polygon(0,1) is equivalent to type polygon(0).y
eg. array polygon(0,2) is equivalent to type polygon(0).z

since the type is just variables, and the type array size 0-9, then why can't the type be set up in memory like the standard array is... they are using the same data, and are the same size. and the type here knows that only numeric values are being used.

point me in the right direction, you know i am the type of person that can handle it... haha, get it? i made a funny.

  stevmjon
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin


Quotecan you make a video about what you are explaining.

  careful what you wish for :)

Quotei sorta get it but am not sure what the actual issue is focused on.
not sure what KIST is also.

  What's KIST ?

kevin

#10
  
Quotecould you explain how variables, arrays(), and types are created and stored in memory (more a visual explanation so we can see what is happening).
i have always been interested at how memory works, and how the data is stored and access to this data.
 


 Let's say we only have INTEGER Variables, then we can emulate the variable table as a block of memory.  Each variable is converted from it's source code name into an internal INDEX,  the index is basically a position within a Variable Table array.

so in PB code,  it'd like this.

  VARIABLE ONLY EXAMPLE

PlayBASIC Code: [Select]
    constant VariableINdex_A  = 1
constant VariableINdex_B = 2
constant VariableINdex_C = 3
constant VariableINdex_D = 4

//etc etc for all variable names

constant VariableINdex_HIGHESTVARIABLEINDEX = 1000

Dim VariableHeap( VariableINdex_HIGHESTVARIABLEINDEX )


; Add a VARIABLE A add D together with the result strored in variable C
; C = A + D
VariableHeap(VariableINdex_C) = VariableHeap( VariableINdex_A ) + VariableHeap(VariableINdex_D)







 VARIABLES & 1D ARRAYS  (INTEGER ONLY)

PlayBASIC Code: [Select]
   //   ARRAYS are stored basically BANKS...
//
// ArrayNAMES are given a VARIABLEINDEX, so the name is converted to
// a position with the global variable heap. To access we query the
// variable heap for the BANK, then look for the required INDEX (offset)
// with the BANK.


constant VariableINdex_A = 1
constant VariableINdex_B = 2
constant VariableINdex_C = 3
constant VariableINdex_D = 4
constant VariableINdex_TABLE = 5

// etc etc for all variable & Array names


constant VariableINdex_HIGHESTVARIABLEINDEX = 1000

Dim VariableHeap( VariableINdex_HIGHESTVARIABLEINDEX )



; A = 45
VariableHeap(VariableINdex_A) = 45

; D = 1000
VariableHeap(VariableINdex_D) = 1000


; Add VARIABLE A and D together and strore result in C
; C = A + D
VariableHeap(VariableINdex_C) = VariableHeap( VariableINdex_A ) + VariableHeap(VariableINdex_D)

; PRINT "C="+str$(C)
print "C="+str$(VariableHeap(VariableINdex_C))




; TAB DOWN THE DISPLAY
Print "" : Print ""

; ---------------------------------------------------
; ---------------------------------------------------
; ARRAY MOCK UP
; ---------------------------------------------------
; ---------------------------------------------------


; DIM TABLE(100)
ARRAY_DIM_1D_INTEGER(VariableINdex_TABLE, 100)


; TABLE(10) = 1234567
ARRAY_WRITE_1D_INTEGER(VariableINdex_TABLE, 10, 1234567)

; Print TABLE(10)
print ARRAY_READ_1D_INTEGER(VariableINdex_TABLE, 10)


Sync
waitkey



Function ARRAY_DIM_1D_INTEGER(ARRAY_NAME_INDEX, SIZE)

if Size>0
Handle= VariableHeap(ARRAY_NAME_INDEX)
if Handle<>0
// This array needs to be deleted frist


endif


// Create Bank big enough to hold
Handle = NewBank( Size * 4 ) // 4 bytes to store one INTEGER

VariableHeap(ARRAY_NAME_INDEX) = HANDLE
endif
ENDFUNCTION


Function ARRAY_WRITE_1D_INTEGER(ARRAY_NAME_INDEX, INDEX, VALUE)

Handle= VariableHeap(ARRAY_NAME_INDEX)
// Check if the ARRAY was DIMMED / Does it exist ?
if HANDLE<>0

// Check if the index is at least positive ?
if Index>=0

// Check if we're writing to within this BANK fo memory
if (Index*4)<GetbankSize(HANDLE)
POkebankInt HANDLE, INDEX * 4 , VALUE

else
// THROW ERROR, illegal INDEX - Too BIG
endif

else
// THROW ERROR, illegal INDEX - Negative
endif

else
// THROW ERROR - ARRAY DOESN'T"T EXIST
endif

EndFunction


Function ARRAY_READ_1D_INTEGER(ARRAY_NAME_INDEX, INDEX)

Handle= VariableHeap(ARRAY_NAME_INDEX)
// Check if the ARRAY was DIMMED / Does it exist ?
if HANDLE<>0

// Check if the index is at least positive ?
if Index>=0

// Check if we're writing to within this BANK fo memory
if (Index*4)<GetbankSize(HANDLE)
Value=PeekBankInt(HANDLE, INDEX * 4)

else
// THROW ERROR, illegal INDEX - Too BIG
endif
else
// THROW ERROR, illegal INDEX - Negative

endif

else
// THROW ERROR - ARRAY DOESN'T"T EXIST
endif

EndFunction VALUE







 VARIABLES & 1D ARRAYS  & TYPED ARRAYS (INTEGER ONLY)



PlayBASIC Code: [Select]
; PROJECT : 2021-06-08 - Variable - Array and Type Simulation
; AUTHOR : Kev Picone - Http://playbasic.com
; CREATED : 8/06/2021
; EDITED : 9/06/2021
; ---------------------------------------------------------------------
explicit on

// TYPES are lists of the user defined VARIABLES stuck together
// so each FIELD of a TYPE compiles down to an OFFSET (INDEX)
// from the START this type in memory.

// EXAMPLE
Type MyCharacter
Xpos
Ypos
Size
Sprite
Score
EndType


// The MyCharacter TYPE Is parsed by the compiler and
// turned into basically a list of constants where each
// field is X number of bytes from the first byte in the structure.
// Integer fields within the type 4 bytes in size, so those field
// would create the following constants.

constant TYPE_MyCharacter_XPOS =0
constant TYPE_MyCharacter_YPOS =4
constant TYPE_MyCharacter_SIZE =8
constant TYPE_MyCharacter_SPRITE =12
constant TYPE_MyCharacter_SCORE =16

constant TYPE_MyCharacter_SIZEOF =20 ; 20 bytes for this structure


// ARRAYS are stored basically BANKS...
//
// ArrayNAMES are given a VARIABLEINDEX, so the name is coverted to
// a position with the global variable heap. To access we query the
// variable heap for the BANK, then look for the required INDEX (offset)
// with the BANK.



constant VariableINdex_A = 1 // A variable
constant VariableINdex_B = 2 // B variable
constant VariableINdex_C = 3 // C variable
constant VariableINdex_D = 4 // D variable
constant VariableINdex_TABLE = 5 // Dim Table(xxx)
constant VariableINdex_BADGUYS = 6 // Dim BadGuys(xxx) as MyCharacter

constant VariableINdex_HIGHESTVARIABLEINDEX = 1000

Dim VariableHeap( VariableINdex_HIGHESTVARIABLEINDEX )


print "VARIABLES -------------------------"


; A = 45
VariableHeap(VariableINdex_A) = 45

; D = 1000
VariableHeap(VariableINdex_D) = 1000


; Add VARIABLE A and D together and store result in C
; C = A + D
VariableHeap(VariableINdex_C) = VariableHeap( VariableINdex_A ) + VariableHeap(VariableINdex_D)

; PRINT "C="+str$(C)
print "C="+str$(VariableHeap(VariableINdex_C))



; ---------------------------------------------------
; ---------------------------------------------------
; ARRAY MOCK UP
; ---------------------------------------------------
; ---------------------------------------------------


Print "" : Print ""
print "ARRAYS -------------------------"

; DIM TABLE(100)
ARRAY_DIM_1D_INTEGER(VariableINdex_TABLE, 100)


; TABLE(10) = 1234567
ARRAY_WRITE_1D_INTEGER(VariableINdex_TABLE, 10, 1234567)

; Print TABLE(10)
print ARRAY_READ_1D_INTEGER(VariableINdex_TABLE, 10)




; ---------------------------------------------------
; ---------------------------------------------------
; ARRAY MOCK UP
; ---------------------------------------------------
; ---------------------------------------------------
print ""
print ""
print "TYPED ARRAY -------------------------"

; DIM BadGuys(20) as MyCharacter
TYPEARRAY_DIM_1D(VariableINdex_BADGUYS, 20)

; BadGuys(5) = New MyCharacter

; Alloc a new TYPE and Write the handle into this Type array
local ThisHANDLE = ALLOC_NEW_TYPE(TYPE_MyCharacter_SIZEOF)
TYPEARRAY_WRITEHANDLE_1D(VariableINdex_BADGUYS, 5, ThisHANDLE)


; BadGuys(5). Xpos = 500
; BadGuys(5). Ypos = 600
TYPEARRAY_WRITE_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,5, TYPE_MyCharacter_XPOS , 500)
TYPEARRAY_WRITE_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,5, TYPE_MyCharacter_YPOS , 600)


; PRINT Badguys(5).xpos
; PRINT Badguys(5).ypos

print TYPEARRAY_READ_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,5, TYPE_MyCharacter_XPOS)
print TYPEARRAY_READ_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,5, TYPE_MyCharacter_YPOS)



Sync
waitkey



// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// ------------------------->> ARRAY FUNCTIONS <<-----------------------
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------




Login required to view complete source code




    So to make an analogy

      ->  VARIABLE  are like the ground
      ->  ARRAYS are like tree trucks
      ->  TYPES are like the branches from the TREE


stevmjon

KIST was on your post#7... it seems to not be there now. this has happened to me a few times now. i read a post, then when i look at it on another day, it has changed.
this happened on some code you posted elsewhere not too long ago. it was missing some code, then when i checked it again all the code was there. i wrote this in a reply. not sure if i am getting a 'crossed wire' so to speak.
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin

 I didn't know what  KIST was either, thought it was from the video...  then noticed the typo in the previous post..  It was meant to be LIST.





kevin

#13
  PlayBASIC Live - Overview of how Variables Arrays and Types - Steve's Question (2021-06-09)

 




 Variable / Array & Typed Array simulation example:

PlayBASIC Code: [Select]
; PROJECT : 2021-06-08 - Variable - Array and Type Simulation
; AUTHOR : Kev Picone - Http://playbasic.com
; CREATED : 8/06/2021
; EDITED : 9/06/2021
; ---------------------------------------------------------------------
explicit on

// TYPES are lists of the user defined VARIABLES stuck together
// so each FIELD of a TYPE compiles down to an OFFSET (INDEX)
// from the START this type in memory.

// EXAMPLE
Type MyCharacter
Xpos
Ypos
Size
Sprite
Score
EndType


// The MyCharacter TYPE Is parsed by the compiler and
// turned into basically a list of constants where each
// field is X number of bytes from the first byte in the structure.
// Integer fields within the type 4 bytes in size, so those field
// would create the following constants.

constant TYPE_MyCharacter_XPOS =0
constant TYPE_MyCharacter_YPOS =4
constant TYPE_MyCharacter_SIZE =8
constant TYPE_MyCharacter_SPRITE =12
constant TYPE_MyCharacter_SCORE =16

constant TYPE_MyCharacter_SIZEOF =20 ; 20 bytes for this structure


// ARRAYS are stored basically BANKS...
//
// ArrayNAMES are given a VARIABLEINDEX, so the name is coverted to
// a position with the global variable heap. To access we query the
// variable heap for the BANK, then look for the required INDEX (offset)
// with the BANK.



constant VariableINdex_A = 1 // A variable
constant VariableINdex_B = 2 // B variable
constant VariableINdex_C = 3 // C variable
constant VariableINdex_D = 4 // D variable
constant VariableINdex_TABLE = 5 // Dim Table(xxx)
constant VariableINdex_BADGUYS = 6 // Dim BadGuys(xxx) as MyCharacter

constant VariableINdex_HIGHESTVARIABLEINDEX = 1000

Dim VariableHeap( VariableINdex_HIGHESTVARIABLEINDEX )


print "VARIABLES -------------------------"


; A = 45
VariableHeap(VariableINdex_A) = 45

; D = 1000
VariableHeap(VariableINdex_D) = 1000


; Add VARIABLE A and D together and store result in C
; C = A + D
VariableHeap(VariableINdex_C) = VariableHeap( VariableINdex_A ) + VariableHeap(VariableINdex_D)

; PRINT "C="+str$(C)
print "C="+str$(VariableHeap(VariableINdex_C))



; ---------------------------------------------------
; ---------------------------------------------------
; ARRAY MOCK UP
; ---------------------------------------------------
; ---------------------------------------------------


Print "" : Print ""
print "ARRAYS -------------------------"

; DIM TABLE(100)
ARRAY_DIM_1D_INTEGER(VariableINdex_TABLE, 100)


; TABLE(10) = 1234567
ARRAY_WRITE_1D_INTEGER(VariableINdex_TABLE, 10, 1234567)

; Print TABLE(10)
print ARRAY_READ_1D_INTEGER(VariableINdex_TABLE, 10)




; ---------------------------------------------------
; ---------------------------------------------------
; ARRAY MOCK UP
; ---------------------------------------------------
; ---------------------------------------------------
print ""
print ""
print "TYPED ARRAY -------------------------"

; DIM BadGuys(20) as MyCharacter
TYPEARRAY_DIM_1D(VariableINdex_BADGUYS, 20)

; BadGuys(5) = New MyCharacter

; Alloc a new TYPE and Write the handle into this Type array
local ThisHANDLE = ALLOC_NEW_TYPE(TYPE_MyCharacter_SIZEOF)
TYPEARRAY_WRITEHANDLE_1D(VariableINdex_BADGUYS, 5, ThisHANDLE)


; BadGuys(5). Xpos = 500
; BadGuys(5). Ypos = 600
TYPEARRAY_WRITE_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,5, TYPE_MyCharacter_XPOS , 500)
TYPEARRAY_WRITE_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,5, TYPE_MyCharacter_YPOS , 600)


; PRINT Badguys(5).xpos
; PRINT Badguys(5).ypos

print TYPEARRAY_READ_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,5, TYPE_MyCharacter_XPOS)
print TYPEARRAY_READ_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,5, TYPE_MyCharacter_YPOS)


local lp

for lp =0 to 10

// Badguys(lp) = new MyCharacter
ThisHANDLE = ALLOC_NEW_TYPE(TYPE_MyCharacter_SIZEOF)
TYPEARRAY_WRITEHANDLE_1D(VariableINdex_BADGUYS, lp, ThisHANDLE)


// BadGuys(lp).xpos = rnd(800)
// BadGuys(lp).ypos = rnd(600)
TYPEARRAY_WRITE_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,lp, TYPE_MyCharacter_XPOS , rnd(800))
TYPEARRAY_WRITE_1D_TYPE_FIELD_INTEGER(VariableINdex_BADGUYS,lp, TYPE_MyCharacter_YPOS , rnd(600))

next

local x,y
for lp =0 to 10
Login required to view complete source code



  Example #2
PlayBASIC Code: [Select]
      type MyArray
Array(20)
EndType

type MyGameObject
Status
XPos,Ypos
Child as MyArray
Child2(20)
EndType


Dim a as MyGameObject
A= new MyGameObject

A.Child.Array(20) = 100

ptr = a.Child.MyArray
pokeint ptr + (21*4), 5555


sync
waitkey








  Example #3
PlayBASIC Code: [Select]
      type Vector3
X#,y#,z#
EndType




DIm Vertex(1000) as vector3 ArrayOfStructures

For lp =0 to 999
vertex(lp).x = 1221
vertex(lp).y = 1221
vertex(lp).z = 1221
next

//
VertexBank = NewBank( SizeOf(Vector3) * 1000) )

dim me as vector3 pointer
For lp =0 to 999
me = getBankPtr(Vertexbank) + ( lp * Sizeof(vector3))

me.x = 1221
me.y = 1221
me.z = 1221

next



dim me as vector3 pointer
Me = GetBankPtr(Vertexbank)
For lp =0 to 999
me(lp).x = 1221
me(lp).y = 1221
me(lp).z = 1221
next


dim me as vector3 pointer
Me = GetBankPtr(Vertexbank)
For lp =0 to 999
me.x = 1221
me.y = 1221
me.z = 1221
me = int(me) + Sizeof(Vector3)
next







 
Related Articles:


      - How Memory Works - Variable - Array - Type Array Visualizer Demo