Browse Source

Update README.md

Clarify project. Add links. Modify example.
Greg Douglas 11 years ago
parent
commit
df08e07afd
1 changed files with 35 additions and 6 deletions
  1. 35 6
      README.md

+ 35 - 6
README.md

@@ -1,4 +1,8 @@
 ##GameMonkey Script
 ##GameMonkey Script
+
+**This project**  
+This project is Greg's personal build of GM Script. It is primarily maintained for stability.
+
 **What is GameMonkey Script?**  
 **What is GameMonkey Script?**  
 GameMonkey is a embedded scripting language that is intended for use in game and tool applications. GameMonkey is however suitable for use in any project requiring simple scripting support. GameMonkey borrows concepts from Lua (www.lua.org), but uses syntax similar to C, making it more accessible to game programmers. GameMonkey also natively supports multithreading and the concept of states.
 GameMonkey is a embedded scripting language that is intended for use in game and tool applications. GameMonkey is however suitable for use in any project requiring simple scripting support. GameMonkey borrows concepts from Lua (www.lua.org), but uses syntax similar to C, making it more accessible to game programmers. GameMonkey also natively supports multithreading and the concept of states.
 
 
@@ -6,7 +10,6 @@ GameMonkey is a embedded scripting language that is intended for use in game and
 Yes, GameMonkey is distributed under the MIT license and is free for any use including commercial products. Please read the full license included in the download package.
 Yes, GameMonkey is distributed under the MIT license and is free for any use including commercial products. Please read the full license included in the download package.
 
 
 **What are the key features of GM?**  
 **What are the key features of GM?**  
-
 * Small code base. Compiled code may use about 75kb of RAM. Less when tweaking or sharing with application.
 * Small code base. Compiled code may use about 75kb of RAM. Less when tweaking or sharing with application.
 * Compile source code at run time, or link to precompiled libs.
 * Compile source code at run time, or link to precompiled libs.
 * Lightweight, native threading (coroutines).
 * Lightweight, native threading (coroutines).
@@ -39,15 +42,32 @@ Here is an example of binding a script function in C:
 // Use in script as: DebugText(int x, int y, string text)
 // Use in script as: DebugText(int x, int y, string text)
 int GM_CDECL DebugText(gmThread *a_thread)
 int GM_CDECL DebugText(gmThread *a_thread)
 {
 {
-  GM_CHECK_NUM_PARAMS(1);
-  GM_CHECK_STRING_PARAM(text, 2);
-  GM_INT_PARAM(x, 0, 10);
-  GM_INT_PARAM(y, 1, 10);
+  GM_CHECK_NUM_PARAMS(3);
+  GM_INT_PARAM(x, 0);
+  GM_INT_PARAM(y, 1);
+  GM_CHECK_STRING_PARAM(text, 2);  
+  
+  Font::Text(text, x, y);
+  
+  return GM_OK;
+}
+
+// Similar example without macros and less validity checks
+int GM_CDECL DebugText(gmThread *a_thread)
+{
+  if( a_thread->GetNumParams() < 3 )
+  {
+    return GM_EXCEPTION;
+  }
+  int x = a_thread->ParamInt(0);
+  int y = a_thread->ParamInt(1);
+  const char* text = a_thread->ParamString(2);
   
   
-  Font::Text(text, (float) x, (float) y);
+  Font::Text(text, x, y);
   
   
   return GM_OK;
   return GM_OK;
 }
 }
+
 ```
 ```
 
 
 **How easy is it to call script from C?**  
 **How easy is it to call script from C?**  
@@ -80,3 +100,12 @@ int AddTwoIntegers(int valueA, int valueB)
 
 
 **What platforms does GameMonkey run on?**  
 **What platforms does GameMonkey run on?**  
 Written entirely in C++, it should run on any platform with at most minor modification or configuration. It has been successfully compiled and run on: Windows PC, Apple Mac, Microsoft XBox, Sony PlayStation2, Sony PSP and Nintendo GameCube. 
 Written entirely in C++, it should run on any platform with at most minor modification or configuration. It has been successfully compiled and run on: Windows PC, Apple Mac, Microsoft XBox, Sony PlayStation2, Sony PSP and Nintendo GameCube. 
+
+GameMonkey Script Links
+-----------------------
+* [GameMonkey Script Official Website] (http://www.gmscript.com)
+* [GameMonkey Script Official Downloads] (http://www.gmscript.com/gamemonkey/downloads/)
+* [GameMonkey Script Official Forums] (http://www.gmscript.com/gamemonkey/forum/)
+* [GameDev.net - Introduction to GameMonkey Script - Part 1] (http://www.gamedev.net/page/resources/_/technical/apis-and-tools/introduction-to-gamemonkey-script-r3297)
+* [GameDev.net - Introduction to GameMonkey Script - Part 2] (http://www.gamedev.net/page/resources/_/technical/game-programming/introduction-to-gamemonkey-script-part-2-r2296)
+* [GameDev.net - Continuing GameMonkey Script: Advanced Use] (http://www.gamedev.net/page/resources/_/technical/game-programming/continuing-gamemonkey-script-advanced-use-r2666)