Plasmacore:Quickstart
From Plasmaworks
Contents |
Overview
The quickstart guide serves to help people with quick questions about how to do simple tasks in Slag/Plasmacore.
Each section is specific to the language or framework it applies to. This means that items in the slag section are supported in Plasmacore but it may not work the same if you're trying to perform an operation from Plasmacore in Slag
Slag
Class Skeleton
When making a class in slag there isn't a lot required to make an empty class file
class ExampleClass
SINGLETONS
PROPERTIES
METHODS
endClass
The singletons subsection allows you to declare or create references to singletons.
The properties subsection is where primitive data type and objects are declared in the class. If they're declared here they're accessible throughout the class.
The methods subsection is where you declare the methods of the class.
Importing/Including Other Class Files
To import another class file so that you have access to it you just need to type '[include "<filename.slag>"]'. This must be put at the top of the class file, above all the class declarations. The <filename.slag> is the file name and must be in double quotes. By default it checks the current directory that the file making the include statement is in.
| Example |
|---|
| [include "GenericClassFile.slag"] |
Below is an example for including the GenericClassFile.slag.
[include "GenericClassFile.slag"]
class ExampleClass
SINGLETONS
PROPERTIES
METHOD
endClass
Commenting
Single Line
To make a single line comment in slag you use the '#' (number/pound/octothorpe sign)
| Example |
|---|
| # This is a single line comment |
Multi-Line
To make a multi-line comment in slag you use the format of '#{ <comment> }#'. The '#{' represents the start of the comment and the '}#' represents the end of the comment. The '<comment>' is where your multi-line comment would start.
| Example |
|---|
| #{ This is a multi-line comment }# |
Plasmacore
Starting a new project
- If you have not downloaded the plasmacore files
- Open up a command prompt in windows, a terminal in mac, or the shell in linux
- Navigate to the correct directory
- Optional Step:
- Once satisfied navigate to the main directory of the project itself.
If we didn't change our project name the main directory would be:Windows Mac/Linux C:\Users\<username>\Documents\Plasmacore Projects\new_project /home/Documents/Plasmacore Projects/new_project
-
Once in the directory you will need to do the first build of the project. To do this you type:
Windows Mac/Linux gogo build ./gogo build
-
You'll be prompted prompted to select a module by typing a number that corresponds to the build and pressing enter.
Windows Mac/Linux Type 1 Type 2
If you intend to develop this project for different platforms like the iOS, Android, Windows/Mac/PC, you will need to install the other modules. You can do this from the main directory of the project by typing:Windows Mac/Linux gogo install ./gogo install
-
Once you have installed the needed modules you can run the default template project.
To do this you need to be in the projects main directory.
From there you type:
Windows Mac/Linux gogo build ./gogo build
Go to the Plasmacore Download Page.
Download the current version.
Extract the contents
Navigate and find the 'new_folder', then move it to the desired directory.
If you want to follow this example you can use these directories:
| Windows | Mac/Linux |
| C:\Users\<username>\Documents\Plasmacore Projects\ | /home/Documents/Plasmacore Projects/ |
If you're following this example you will have to make the folder/directory yourself if it doesn't exist already.
To make the directory you need to be in the desired parent directory of 'new_project' and then type the corresponding commands in via command line/terminal/bash:
| Command for Windows/Mac/Linux |
| mkdir "Plasmacore Projects" |
Rename the 'new_project' folder to the desired project name You can do this from the parent directory of the project by typing in these commands at the command line.
| Windows | Mac/Linux |
| rename new_project project_name | mv new_project project_name |
After that the default program in the 'src' folder of the main project folder will be run. It will demonstrate the drawing of a square, input from the mouse that's output to the top left corner, and the background color being changed.
Any further classes needing to be added must be in the src directory of the main project folder.
If we're keeping with the examples above the 'src' directories would be:
| Windows | Mac/Linux |
| C:\Users\<username>\Documents\Plasmacore Projects\new_project\src | /home/Documents/Plasmacore Projects/new_project/src |
Then you can include them in the other classes as needed by seeing the Importing/Including Other Class Filessection.
Looking For Specific Documentation
To look through Plasmacore's useful documentation all you need to do is be in the project's main directory. Once there type:
| Windows | Mac/Linux |
| gogo doc <class name> | ./gogo doc <class name> |
For example if we wanted to look into the class 'Box' we just type:
| Windows | Mac/Linux |
| gogo doc Box | ./gogo doc Box |
If we wanted to look further into the information of Box we can look into its methods by using two colons and then typing the method name following it. For example, let's say we want to look into the Box's class, and we want to see its constructor, we can simply just type:
| Windows | Mac/Linux |
| gogo doc Box::init | ./gogo doc Box::init |
If you're not sure what methods are in a class simply perform the gogo doc command on the class, find the method you're looking for and then perform gogo doc using the colon modifier to see more information about the method.