Difference between revisions of "PawnProgrammingNotes"
Jump to navigation
Jump to search
(New root page for the Pawn Programming Notes) |
|||
Line 15: | Line 15: | ||
* A few Pawn Language "gotchas"/reminders | * A few Pawn Language "gotchas"/reminders | ||
+ | ** Statements do NOT have to be terminated with ";" (but I usually do it anyway out of habit) | ||
+ | ** Declare variables with "new" (not "var", etc.) | ||
+ | ** You can use the built in words "true" and "false" to represent a boolean value and test for it with "if (x) { }" which will execute the code in braces if x is true | ||
+ | ** Arrays can be up to three dimensions and indexes start at 0 | ||
+ | ** Use "==" (not "=") to check for equivalence in an "if" statement | ||
+ | ** Use "!=" instead of "<>" for "not equal to" | ||
+ | ** You can enter numbers in hex by prefixing with 0x e.g. "0xFFFF0000" is used as an ARGB value for the color red | ||
+ | ** "if" statements with more than one condition require an extra set of () around the whole expression e.g. "if ((x==1)||(x==2)) {}" | ||
+ | ** function definitions are not prefixed with "f" or "func" or "function" e.g. "abs(x) {if (x>=0) {return x} else {return -1*x}}" is a valid function definition | ||
+ | ** you can begin a comment on a line by itself or at the end of a line with "//". Use "/* .... */" for block comments ... block comments CANNOT be nested | ||
* A few Visual Studio Code "gotchas"/reminders | * A few Visual Studio Code "gotchas"/reminders | ||
* Remembering that the WOWCUBE is "eight processors all running the same code" | * Remembering that the WOWCUBE is "eight processors all running the same code" | ||
* ON_Tick() vs ON_Render() | * ON_Tick() vs ON_Render() | ||
− | * You have to render everything on a screen at once! | + | * [[Rendering Text and Graphics#AllAtOnce|You have to render everything on a screen at once!]] |
* Physical cubelets and "virtual" mapping to them | * Physical cubelets and "virtual" mapping to them | ||
* Dealing with differing orientation of the screens | * Dealing with differing orientation of the screens |
Revision as of 05:37, 6 May 2023
This "sub wiki" is being written (initially, at least) by me, ratcliffe. I have been doing software development for 30+ years in VB.NET, C#, C++ and Objective C. This is my first experience with Pawn and of course with programming the WOWCUBE. Feel free to drop me a DM in the WOWCUBE Discord if I've gotten anything wrong, or you can suggest a better way to do something, or want me to try to cover a specific topic. I'm going to be making notes here as I build a basic RPG for the WOWCUBE.
This is just a scaffolding for the moment, I will be fleshing out the listed items over the next few days.
I also need to work to keep some terminology straight so I may change these terms a bit soon
- cubelet or module
- one of the eight physical small cubes, each with three screens, in the WOWCUBE
- screen
- one of the three screens on a cubelet
- messaging
- the technique supported in the API to send a small packet of information to one or more other cubelets
Here are the current topics in place or coming soon!
- A few Pawn Language "gotchas"/reminders
- Statements do NOT have to be terminated with ";" (but I usually do it anyway out of habit)
- Declare variables with "new" (not "var", etc.)
- You can use the built in words "true" and "false" to represent a boolean value and test for it with "if (x) { }" which will execute the code in braces if x is true
- Arrays can be up to three dimensions and indexes start at 0
- Use "==" (not "=") to check for equivalence in an "if" statement
- Use "!=" instead of "<>" for "not equal to"
- You can enter numbers in hex by prefixing with 0x e.g. "0xFFFF0000" is used as an ARGB value for the color red
- "if" statements with more than one condition require an extra set of () around the whole expression e.g. "if ((x==1)||(x==2)) {}"
- function definitions are not prefixed with "f" or "func" or "function" e.g. "abs(x) {if (x>=0) {return x} else {return -1*x}}" is a valid function definition
- you can begin a comment on a line by itself or at the end of a line with "//". Use "/* .... */" for block comments ... block comments CANNOT be nested
- A few Visual Studio Code "gotchas"/reminders
- Remembering that the WOWCUBE is "eight processors all running the same code"
- ON_Tick() vs ON_Render()
- You have to render everything on a screen at once!
- Physical cubelets and "virtual" mapping to them
- Dealing with differing orientation of the screens
- Putting text on a screen
- Basics of developing a simple map with tunnels
- The magic of TOPOLOGY_getAdjacentFacelet()
- How to handle moving from one screen to another (on the same or a different cubelet)
- Tricks when using the Emulator