Fixes for matchup example for better compatibility with new Monkey version #4

Merged
merged 1 commit into from Mar 26, 2013
@@ -6,9 +6,7 @@
Import src.game
-#If TARGET = "android" Then
- #ANDROID_SCREEN_ORIENTATION="landscape"
-#End
+#ANDROID_SCREEN_ORIENTATION = "landscape"
Function Main()
New Game()
@@ -3,20 +3,6 @@ Strict
Import mojo
Import gamefield
-#if TARGET = "glfw" And HOST = "macos"
- Import "native/${TARGET}.macos.${LANG}"
-#Else
- Import "native/${TARGET}.${LANG}"
-#End
-
-Extern
-
-#If LANG="cpp"
- Function SystemMillisecs:Int() = "functions::systemMillisecs"
-#Else
- Function SystemMillisecs:Int() = "functions.systemMillisecs"
-#End
-
Public
Class Game Extends App
@@ -45,6 +31,12 @@ Class Game Extends App
End Method
Method OnUpdate:Int()
+ #If TARGET <> "android"
+ If (KeyHit(KEY_CLOSE)) Error ""
+ #Else
+ If (KeyHit(KEY_BACK)) Error ""
+ #End
+
If (gameField.IsComplete) Then
If (KeyHit(KEY_SPACE)) Then
gameField = New GameField(4, 3)
@@ -164,7 +164,9 @@ Public
If (cardsLeft > 0) Return
cardsLeft = cards.Length()
- Seed = SystemMillisecs()
+
+ Local date:Int[] = GetDate()
+ Seed = (date[3] * 3600 + date[4] * 60 + date[5]) * 1000 + date[6]
Local numTypes:Int = cards.Length() / 2
Local typesLeft:Int[numTypes]
@@ -1,8 +0,0 @@
-
-class functions {
-
- public static int systemMillisecs() {
- return (int) System.currentTimeMillis();
- }
-
-}
@@ -1,8 +0,0 @@
-
-class functions {
-
- static public function systemMillisecs():int {
- return (new Date).getTime();
- }
-
-}
@@ -1,19 +0,0 @@
-
-#include <time.h>
-#include <math.h>
-
-class functions {
-
-public:
-
- static int systemMillisecs() {
- double n;
- time_t t;
- struct tm * timeinfo;
- time(&t);
- timeinfo = localtime(&t);
- int seconds = (timeinfo->tm_sec + timeinfo->tm_min * 60 + timeinfo->tm_hour * 3600);
- return (seconds + modf(glfwGetTime(), &n)) * 1000;
- }
-
-};
@@ -1,19 +0,0 @@
-
-#include <time.h>
-#include <math.h>
-
-class functions {
-
-public:
-
- static int systemMillisecs() {
- double n;
- time_t t;
- struct tm *timeinfo;
- time(&t);
- timeinfo = localtime(&t);
- int seconds = (timeinfo->tm_sec + timeinfo->tm_min * 60 + timeinfo->tm_hour * 3600);
- return (seconds + modf(glfwGetTime(), &n)) * 1000;
- }
-
-};
@@ -1,6 +0,0 @@
-
-var functions = new Object();
-
-functions.systemMillisecs = function() {
- return (new Date).getTime()
-}
@@ -1 +0,0 @@
-#include <mach/mach_time.h>class functions {public: static int systemMillisecs() { mach_timebase_info_data_t timeInfo; mach_timebase_info(&timeInfo); uint64_t nanos = mach_absolute_time(); nanos *= timeInfo.numer; nanos /= timeInfo.denom; return nanos/1000000L; } };
@@ -1,8 +0,0 @@
-
-class functions {
-
- public static int systemMillisecs() {
- return (int) (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond);
- }
-
-}
@@ -1 +0,0 @@
-class functions { public static int systemMillisecs() { return (int) (DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond); }}