• 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

Examples

Paul59

Active member
CX Code Contributor
Joined
Dec 13, 2018
Messages
384
If it would help, I'm happy to work through the mojo2 examples that ship with CX, correcting any errors, removing redundant code and improving comments if necessary. It'll be useful for me as a learning exercise and hopefully benefit others who are new to the project.

Here's my edit of BitmapFont.cxs. The comments could be formatted better IMHO, what do you think?
 

Attachments

  • BitmapFont.cxs
    2.9 KB · Views: 230
Personally, I'd only comment those lines that relate to the feature being illustrated as per this version.

EDIT: Also remove superfluous things, like the cross-hair in the original example.
 

Attachments

  • BitmapFontv2.cxs
    982 bytes · Views: 273
How would you like the edited files submitted? I think I can just about figure out github pull requests if necessary!
 
@MikeHart Can you check I've made a pull request properly for the first example, I'm not very well versed with github?
 
The pull request is visible. May I ask why you removed all the comments that explain things? And who the original author is?
 
The pull request is visible. May I ask why you removed all the comments that explain things? And who the original author is?

I thought it would be better to just comment on the lines that were directly related to the example, in this case the parts concerned with loading and drawing the text. Otherwise every example will have the same comments over and over :D

Most of the mojo 2 examples don't include the author's name etc so I though having them with a simple common header explanation would be best.

I've re-worked 'Bouncy Aliens', it didn't look right when run as every sprite was being scaled by a random amount each frame and it was full of bits of test code that had no relevance. I've headed it up as:

Code:
' Cerberus X - Bouncy Aliens example
'
' Shows how to use a stack, handle suspend and resume events, use pre-processor directives and achieve simple animation.

Otherwise, I'm not sure exactly what it's supposed to be an example of!
 
Otherwise every example will have the same comments over and over
Agreed.

Btw. while
Code:
canvas = New Canvas()

works with the parenthesis,

Code:
canvas = New Canvas

is better imho. It isn't a function/method, its an object.

Otherwise, I'm not sure exactly what it's supposed to be an example of!
One of M.S.'s test scripts I guess.
 
Agreed.

Btw. while
Code:
canvas = New Canvas()

works with the parenthesis,

Code:
canvas = New Canvas

is better imho. It isn't a function/method, its an object.

Well the docs say Canvas is a class with a New constructor just like classes in most other languages, it's just habit I suppose. The same optional parenthesis thing seems to apply all over the place. SetDeviceWindow for example is a function and shown with parentheses in the docs but can be called without! I was trying to be consistent in that regard :D
 
Ahh ok. Command without parameters need the parenthesis in Strict mode, commands with parameters not. The joy of the CX transpiler!
 
Haha, better stick with parens :p

Also, can you change the case of the Bitmap Font example folder and files on Github as it doesn't match the others which are all in lower case.
 
Back
Top Bottom