Browse Source

eums mod + #_msvc backslashing

abakobo 8 years ago
parent
commit
f9be945506
2 changed files with 18 additions and 7 deletions
  1. 17 5
      modules/monkey/docs/language/enums.md
  2. 1 2
      modules/monkey/docs/sdks.md

+ 17 - 5
modules/monkey/docs/language/enums.md

@@ -12,27 +12,39 @@ End
 ```
 Enum myCustomEnum
 	a=7
-	b=31
+	b=31,c,d 'c=32, d=33
 End
 ```
 The values can be accessed with the postfix member acces operator (`.`).
+Enums values are implicitely converted to integral values when assigned to it.
 ```
-Local i:Int=myCustomEnum.b
+Local i:UInt=myCustomEnum.b
 ```
 
-You can also create `Enum` variables. An `Enum` variable contains a 'combination' value in addition to it's constant members (default value is zero).
+You can also create `Enum` variables. An `Enum` variable contains a variable Uint value in addition to it's constant members (default value is zero). This value is of the Uint type.
 
-Bitwise operators (|,&,~) can be used with Enums variables and Enums members to define such combinations. It is higly advised to have powers of 2 numbers as members! (1,2,4,8,16,32,64,...not 0!)
+Bitwise operators (|,&,~) can be used with Enums variables and Enums members to compute combinations. Such Enums most often contain powers of 2 numbers as members! (1,2,4,8,16,32,64,... and 0 if needed).
 
 A bitmask Enum example:
 ```
 Enum Flags 'a classic Enum. (4 bits bitmask)
+	None=0
   A=$0001 'bin OOOI dec 1
   B=$0002 'bin OOIO dec 2
   C=$0004 'bin OIOO dec 4
   D=$0008 'bin IOOO dec 8
 End
 ```
+An enum with modifiers example (in this case the bitwise operators should be used with at least one modifier):
+```
+Enum Foo '(modifiers on 5th and 6th bit)
+	None=0
+	A=1,B,C,D,E,F,G,H,J,K,L,M ' max 15 because the 5th bit is used for modifier
+	Modifier_A=$0010 'bin IOOOO dec 16
+	Modifier_B=$0020 'bin IOOOOO dec 32
+End
+```
+
 Some operations examples:
 ```
 Local flags1:=Flags.A | Flags.B
@@ -40,7 +52,7 @@ Local flags2:=flags1 | Flags.C
 Local flags3:=Flags.B & (flags1 ~ flags3.D)
 ```
 
-You can 'extract' the 'combination' value by simply assigning your `Enum` variable to a `UInt`.
+If needed, you can 'extract' the variable value by simply assigning your `Enum` variable to a `UInt`.
 
 ```
 Local i:UInt=flags1

+ 1 - 2
modules/monkey/docs/sdks.md

@@ -14,7 +14,7 @@ Note that the prebuilt binaries available from itch.io already include mingw in
 
 To use msvc instead of mingw, you will need to install msvc express 2015 and change the following line in bin/env_windows.txt:
 
-#MX2_USE_MSVC=1
+\#MX2\_USE\_MSVC=1
 
 You will need to rebuild all modules after doing this.
 
@@ -70,4 +70,3 @@ With this enabled, android studio doesn't seem to notice when external project f
 #### The iOS Target
 
 Monkey2 uses the command line tools included with xcode to build ios apps.
-