• Dear Cerberus X User!

    As we prepare to transition the forum ownership from Mike to Phil (TripleHead GmbH), we need your explicit consent to transfer your user data in accordance with our amended Terms and Rules in order to be compliant with data protection laws.

    Important: If you accept the amended Terms and Rules, you agree to the transfer of your user data to the future forum owner!

    Please read the new Terms and Rules below, check the box to agree, and click "Accept" to continue enjoying your Cerberus X Forum experience. The deadline for consent is April 5, 2024.

    Do not accept the amended Terms and Rules if you do not wish your personal data to be transferred to the future forum owner!

    Accepting ensures:

    - Continued access to your account with a short break for the actual transfer.

    - Retention of your data under the same terms.

    Without consent:

    - You don't have further access to your forum user account.

    - Your account and personal data will be deleted after April 5, 2024.

    - Public posts remain, but usernames indicating real identity will be anonymized. If you disagree with a fictitious name you have the option to contact us so we can find a name that is acceptable to you.

    We hope to keep you in our community and see you on the forum soon!

    All the best

    Your Cerberus X Team

Class list

Ferret3D

New member
Joined
Aug 13, 2017
Messages
88
I need a list of mi puzzle piece class.
How do i create a list of a class?
 
Use:
Code:
Local list:= New List<MyObject> ' Short hand way
Local list:List<MyObject> = New List<MyObject> ' Long way

Here is an example. Use the C++Tool target to compile.
Code:
Strict

Class MyObject
    Field str:String
 
    Method New(str:String = "")
        Self.str = str
    End Method
 
    Method Item:String()
        Return Self.str
    End Method
 
End Class


Function Main:Int()
    'Local list:= New List<MyObject> ' Short hand way
     Local list:List<MyObject> = New List<MyObject> ' Long way
 
    ' Add some items to the list
    For Local i:Int = 1 To 10
        list.AddLast(New MyObject("Item: " + i))
    Next
 
    ' Retrieve the items
    For Local i:MyObject = Eachin list
        Print i.Item()
    Next
 
    Return 0
End Function
 
Last edited:
why the c++ tool to compile? What is it exactly for?
 
The C++ Tool (formally stdcpp) is for creating simple command line tools. It's pretty much useless for anything other than testing out simple code.
 
Last edited:
Lol, Trans and MakeDocs are compiled with it. So it isn't really useless.
That's all it's about good for. If you want a little more oomph; then the os module needs to be expanded for better system function access. The number of times I wish that Mark had implemented getting stdout and stderror when using the Execute function, or a high resolution timer.
 
Last edited:
What am I missing here? Shouldn't that run fine in HTML5 or whatever you want?
 
What am I missing here? Shouldn't that run fine in HTML5 or whatever you want?

All of CX targets (besides the C++ tool one) depend on the App class (which you have to extend from) and so need at least an OnRender method to display something.
 
What am I missing here? Shouldn't that run fine in HTML5 or whatever you want?
It should still compile and run fine in the GLFW/HTML game. The only difference will be the size of the compiled code, don't forget that you would be pulling in additional libraries that are not needed and add additional compile time for what is basically a simple example.

All of CX targets (besides the C++ tool one) depend on the App class (which you have to extend from) and so need at least an OnRender method to display something.
Only if you include any of the Mojo frameworks.
 
Use:
Code:
Local list:= New List<MyObject> ' Short hand way
Local list:List<MyObject> = New List<MyObject> ' Long way

Here is an example. Use the C++Tool target to compile.
Code:
Strict

Class MyObject
    Field str:String
 
    Method New(str:String = "")
        Self.str = str
    End Method
 
    Method Item:String()
        Return Self.str
    End Method
 
End Class


Function Main:Int()
    'Local list:= New List<MyObject> ' Short hand way
     Local list:List<MyObject> = New List<MyObject> ' Long way
 
    ' Add some items to the list
    For Local i:Int = 1 To 10
        list.AddLast(New MyObject("Item: " + i))
    Next
 
    ' Retrieve the items
    For Local i:MyObject = Eachin list
        Print i.Item()
    Next
 
    Return 0
End Function

Thank you!
 
Back
Top Bottom