소스 검색

Merge branch 'android-port' into resource-manager

Conflicts:
	.gitignore
	src/CMakeLists.txt
	src/Config.h
	src/Log.h
	src/core/containers/Str.h
	src/os/OS.h
Daniele Bartolini 12 년 전
부모
커밋
671c48d6a1
100개의 변경된 파일1877개의 추가작업 그리고 15개의 파일을 삭제
  1. 7 0
      .gitignore
  2. 21 0
      android/AndroidManifest.xml
  3. 92 0
      android/build.xml
  4. 108 0
      android/jni/Android.mk
  5. 3 0
      android/jni/Application.mk
  6. 1 0
      android/jni/CMakeLists.txt
  7. 1 0
      android/jni/Camera.cpp
  8. 1 0
      android/jni/Camera.h
  9. 1 0
      android/jni/Config.h
  10. 1 0
      android/jni/Crown.h
  11. 1 0
      android/jni/Data.h
  12. 1 0
      android/jni/Device.cpp
  13. 1 0
      android/jni/Device.h
  14. 1 0
      android/jni/EventBuffer.cpp
  15. 1 0
      android/jni/EventBuffer.h
  16. 1 0
      android/jni/FPSSystem.cpp
  17. 1 0
      android/jni/FPSSystem.h
  18. 1 0
      android/jni/Filesystem.cpp
  19. 1 0
      android/jni/Filesystem.h
  20. 1 0
      android/jni/Font.cpp
  21. 1 0
      android/jni/Font.h
  22. 1 0
      android/jni/FontManager.cpp
  23. 1 0
      android/jni/FontManager.h
  24. 1 0
      android/jni/Glyph.h
  25. 1 0
      android/jni/Image.cpp
  26. 1 0
      android/jni/Image.h
  27. 1 0
      android/jni/ImageLoader.cpp
  28. 1 0
      android/jni/ImageLoader.h
  29. 1 0
      android/jni/IndexBuffer.h
  30. 1 0
      android/jni/Log.cpp
  31. 1 0
      android/jni/Log.h
  32. 1 0
      android/jni/Material.cpp
  33. 1 0
      android/jni/Material.h
  34. 1 0
      android/jni/MaterialManager.cpp
  35. 1 0
      android/jni/MaterialManager.h
  36. 1 0
      android/jni/Mesh.cpp
  37. 1 0
      android/jni/Mesh.h
  38. 1 0
      android/jni/MeshChunk.cpp
  39. 1 0
      android/jni/MeshChunk.h
  40. 1 0
      android/jni/MeshLoader.h
  41. 1 0
      android/jni/MeshManager.cpp
  42. 1 0
      android/jni/MeshManager.h
  43. 1 0
      android/jni/MovableCamera.cpp
  44. 1 0
      android/jni/MovableCamera.h
  45. 1 0
      android/jni/OcclusionQuery.h
  46. 1 0
      android/jni/Pixel.cpp
  47. 1 0
      android/jni/Pixel.h
  48. 1 0
      android/jni/Renderer.cpp
  49. 1 0
      android/jni/Renderer.h
  50. 1 0
      android/jni/Resource.h
  51. 1 0
      android/jni/ResourceManager.cpp
  52. 1 0
      android/jni/ResourceManager.h
  53. 1 0
      android/jni/Skybox.cpp
  54. 1 0
      android/jni/Skybox.h
  55. 1 0
      android/jni/SpriteAnimator.cpp
  56. 1 0
      android/jni/SpriteAnimator.h
  57. 1 0
      android/jni/System.h
  58. 1 0
      android/jni/Terrain.cpp
  59. 1 0
      android/jni/Terrain.h
  60. 1 0
      android/jni/TextRenderer.cpp
  61. 1 0
      android/jni/TextRenderer.h
  62. 1 0
      android/jni/Texture.h
  63. 1 0
      android/jni/TextureManager.h
  64. 1 0
      android/jni/VertexBuffer.h
  65. 1 0
      android/jni/World.cpp
  66. 1 0
      android/jni/World.h
  67. 1 0
      android/jni/core
  68. 1 0
      android/jni/input
  69. 1 0
      android/jni/loaders
  70. 1 0
      android/jni/network
  71. 1 0
      android/jni/os
  72. 1 0
      android/jni/renderers
  73. 1 0
      android/jni/samples
  74. 10 0
      android/local.properties
  75. 20 0
      android/proguard-project.txt
  76. 14 0
      android/project.properties
  77. 123 0
      android/src/crown/android/CrownActivity.java
  78. 16 0
      android/src/crown/android/CrownEnum.java
  79. 27 0
      android/src/crown/android/CrownLib.java
  80. 185 0
      android/src/crown/android/CrownSensor.java
  81. 64 0
      android/src/crown/android/CrownTouch.java
  82. 352 0
      android/src/crown/android/CrownView.java
  83. 4 0
      samples/CMakeLists.txt
  84. BIN
      samples/android/res/grass.tga
  85. BIN
      samples/android/res/red_down.tga
  86. BIN
      samples/android/res/red_east.tga
  87. BIN
      samples/android/res/red_north.tga
  88. BIN
      samples/android/res/red_south.tga
  89. BIN
      samples/android/res/red_up.tga
  90. BIN
      samples/android/res/red_west.tga
  91. 98 0
      samples/android/triangle.cpp
  92. 26 0
      samples/json/json.cpp
  93. 17 12
      samples/terrain/terrain.cpp
  94. 7 0
      src/CMakeLists.txt
  95. 1 1
      src/Device.cpp
  96. 166 0
      src/FPSSystem.cpp
  97. 44 0
      src/FPSSystem.h
  98. 326 0
      src/JSONParser.cpp
  99. 77 0
      src/JSONParser.h
  100. 1 2
      src/Log.cpp

+ 7 - 0
.gitignore

@@ -3,3 +3,10 @@
 
 # Ignore CMake-generated config files
 /src/Config.h
+
+# Ignore some android directories
+/android/bin
+/android/gen
+/android/libs
+/android/obj
+/android/res

+ 21 - 0
android/AndroidManifest.xml

@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+      package="crown.android"
+      android:versionCode="1"
+      android:versionName="1.0">
+    <uses-sdk
+        android:minSdkVersion="9"/>
+
+    <application android:label="Crown" >
+        <activity android:name="CrownActivity"
+                  android:label="Crown"
+				  android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
+				  android:screenOrientation="landscape" 
+				  android:configChanges="orientation|keyboardHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest> 

+ 92 - 0
android/build.xml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="Crown" default="help">
+
+    <!-- The local.properties file is created and updated by the 'android' tool.
+         It contains the path to the SDK. It should *NOT* be checked into
+         Version Control Systems. -->
+    <property file="local.properties" />
+
+    <!-- The ant.properties file can be created by you. It is only edited by the
+         'android' tool to add properties to it.
+         This is the place to change some Ant specific build properties.
+         Here are some properties you may want to change/update:
+
+         source.dir
+             The name of the source directory. Default is 'src'.
+         out.dir
+             The name of the output directory. Default is 'bin'.
+
+         For other overridable properties, look at the beginning of the rules
+         files in the SDK, at tools/ant/build.xml
+
+         Properties related to the SDK location or the project target should
+         be updated using the 'android' tool with the 'update' action.
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems.
+
+         -->
+    <property file="ant.properties" />
+
+    <!-- if sdk.dir was not set from one of the property file, then
+         get it from the ANDROID_HOME env var.
+         This must be done before we load project.properties since
+         the proguard config can use sdk.dir -->
+    <property environment="env" />
+    <condition property="sdk.dir" value="${env.ANDROID_HOME}">
+        <isset property="env.ANDROID_HOME" />
+    </condition>
+
+    <!-- The project.properties file is created and updated by the 'android'
+         tool, as well as ADT.
+
+         This contains project specific properties such as project target, and library
+         dependencies. Lower level build properties are stored in ant.properties
+         (or in .classpath for Eclipse projects).
+
+         This file is an integral part of the build system for your
+         application and should be checked into Version Control Systems. -->
+    <loadproperties srcFile="project.properties" />
+
+    <!-- quick check on sdk.dir -->
+    <fail
+            message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through the ANDROID_HOME environment variable."
+            unless="sdk.dir"
+    />
+
+    <!--
+        Import per project custom build rules if present at the root of the project.
+        This is the place to put custom intermediary targets such as:
+            -pre-build
+            -pre-compile
+            -post-compile (This is typically used for code obfuscation.
+                           Compiled code location: ${out.classes.absolute.dir}
+                           If this is not done in place, override ${out.dex.input.absolute.dir})
+            -post-package
+            -post-build
+            -pre-clean
+    -->
+    <import file="custom_rules.xml" optional="true" />
+
+    <!-- Import the actual build file.
+
+         To customize existing targets, there are two options:
+         - Customize only one target:
+             - copy/paste the target into this file, *before* the
+               <import> task.
+             - customize it to your needs.
+         - Customize the whole content of build.xml
+             - copy/paste the content of the rules files (minus the top node)
+               into this file, replacing the <import> task.
+             - customize to your needs.
+
+         ***********************
+         ****** IMPORTANT ******
+         ***********************
+         In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
+         in order to avoid having your file be overridden by tools such as "android update project"
+    -->
+    <!-- version-tag: 1 -->
+    <import file="${sdk.dir}/tools/ant/build.xml" />
+
+</project>

+ 108 - 0
android/jni/Android.mk

@@ -0,0 +1,108 @@
+# Copyright (C) 2010 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+LOCAL_MODULE    := crown
+LOCAL_SRC_FILES :=\
+	core/bv/Circle.cpp\
+	core/bv/Frustum.cpp\
+	core/bv/Rect.cpp\
+	core/containers/Generic.cpp\
+	core/containers/Str.cpp\
+	core/math/Color4.cpp\
+	core/math/Mat3.cpp\
+	core/math/Mat4.cpp\
+	core/math/MathUtils.cpp\
+	core/math/Plane.cpp\
+	core/math/Quat.cpp\
+	core/math/Shape.cpp\
+	core/math/Vec2.cpp\
+	core/math/Vec3.cpp\
+	core/math/Vec4.cpp\
+	core/mem/MallocAllocator.cpp\
+	core/streams/FileStream.cpp\
+	core/streams/MemoryStream.cpp\
+	core/streams/Stream.cpp\
+\
+	input/EventDispatcher.cpp\
+	input/InputManager.cpp\
+\
+	loaders/BMPImageLoader.cpp\
+	loaders/TGAImageLoader.cpp\
+\
+	os/OS.cpp\
+	os/android/AndroidOS.cpp\
+	os/android/AndroidInput.cpp\
+	os/android/AndroidDevice.cpp\
+	os/android/File.cpp\
+\
+	Filesystem.cpp\
+\
+	renderers/gles/GLESIndexBuffer.cpp\
+	renderers/gles/GLESRenderer.cpp\
+	renderers/gles/GLESTexture.cpp\
+	renderers/gles/GLESTextureManager.cpp\
+	renderers/gles/GLESUtils.cpp\
+	renderers/gles/GLESVertexBuffer.cpp\
+\
+	Camera.cpp\
+	Device.cpp\
+	Font.cpp\
+	FontManager.cpp\
+	Image.cpp\
+	ImageLoader.cpp\
+	Log.cpp\
+	Material.cpp\
+	MaterialManager.cpp\
+	MeshChunk.cpp\
+	Mesh.cpp\
+	MeshManager.cpp\
+	MovableCamera.cpp\
+	Pixel.cpp\
+	Renderer.cpp\
+	ResourceManager.cpp\
+	Skybox.cpp\
+	FPSSystem.cpp\
+\
+	samples/android/triangle.cpp\
+\
+
+LOCAL_C_INCLUDES	:=\
+	$(LOCAL_PATH)/core\
+	$(LOCAL_PATH)/core/math\
+	$(LOCAL_PATH)/core/compressors\
+	$(LOCAL_PATH)/core/containers\
+	$(LOCAL_PATH)/core/bv\
+	$(LOCAL_PATH)/core/mem\
+	$(LOCAL_PATH)/core/streams\
+	$(LOCAL_PATH)/loaders\
+	$(LOCAL_PATH)/os\
+	$(LOCAL_PATH)/os/android\
+	$(LOCAL_PATH)/renderers\
+	$(LOCAL_PATH)/things\
+	$(LOCAL_PATH)/filesystem\
+	$(LOCAL_PATH)/renderers/gl\
+	$(LOCAL_PATH)/renderers/gles\
+	$(LOCAL_PATH)/renderers/gles/egl\
+	$(LOCAL_PATH)/input\
+	$(LOCAL_PATH)/samples\
+
+
+LOCAL_CPPFLAGS	:= -g -fexceptions
+LOCAL_LDLIBS	:= -llog -landroid -lGLESv1_CM
+include $(BUILD_SHARED_LIBRARY)
+#(call import-module, android/native_app_glue)

+ 3 - 0
android/jni/Application.mk

@@ -0,0 +1,3 @@
+APP_PLATFORM := android-9
+APP_STL := gnustl_static
+APP_ABI := armeabi-v7a

+ 1 - 0
android/jni/CMakeLists.txt

@@ -0,0 +1 @@
+../../src/CMakeLists.txt

+ 1 - 0
android/jni/Camera.cpp

@@ -0,0 +1 @@
+../../src/Camera.cpp

+ 1 - 0
android/jni/Camera.h

@@ -0,0 +1 @@
+../../src/Camera.h

+ 1 - 0
android/jni/Config.h

@@ -0,0 +1 @@
+../../src/Config.h

+ 1 - 0
android/jni/Crown.h

@@ -0,0 +1 @@
+../../src/Crown.h

+ 1 - 0
android/jni/Data.h

@@ -0,0 +1 @@
+../../src/Data.h

+ 1 - 0
android/jni/Device.cpp

@@ -0,0 +1 @@
+../../src/Device.cpp

+ 1 - 0
android/jni/Device.h

@@ -0,0 +1 @@
+../../src/Device.h

+ 1 - 0
android/jni/EventBuffer.cpp

@@ -0,0 +1 @@
+../../src/EventBuffer.cpp

+ 1 - 0
android/jni/EventBuffer.h

@@ -0,0 +1 @@
+../../src/EventBuffer.h

+ 1 - 0
android/jni/FPSSystem.cpp

@@ -0,0 +1 @@
+../../src/FPSSystem.cpp

+ 1 - 0
android/jni/FPSSystem.h

@@ -0,0 +1 @@
+../../src/FPSSystem.h

+ 1 - 0
android/jni/Filesystem.cpp

@@ -0,0 +1 @@
+../../src/Filesystem.cpp

+ 1 - 0
android/jni/Filesystem.h

@@ -0,0 +1 @@
+../../src/Filesystem.h

+ 1 - 0
android/jni/Font.cpp

@@ -0,0 +1 @@
+../../src/Font.cpp

+ 1 - 0
android/jni/Font.h

@@ -0,0 +1 @@
+../../src/Font.h

+ 1 - 0
android/jni/FontManager.cpp

@@ -0,0 +1 @@
+../../src/FontManager.cpp

+ 1 - 0
android/jni/FontManager.h

@@ -0,0 +1 @@
+../../src/FontManager.h

+ 1 - 0
android/jni/Glyph.h

@@ -0,0 +1 @@
+../../src/Glyph.h

+ 1 - 0
android/jni/Image.cpp

@@ -0,0 +1 @@
+../../src/Image.cpp

+ 1 - 0
android/jni/Image.h

@@ -0,0 +1 @@
+../../src/Image.h

+ 1 - 0
android/jni/ImageLoader.cpp

@@ -0,0 +1 @@
+../../src/ImageLoader.cpp

+ 1 - 0
android/jni/ImageLoader.h

@@ -0,0 +1 @@
+../../src/ImageLoader.h

+ 1 - 0
android/jni/IndexBuffer.h

@@ -0,0 +1 @@
+../../src/IndexBuffer.h

+ 1 - 0
android/jni/Log.cpp

@@ -0,0 +1 @@
+../../src/Log.cpp

+ 1 - 0
android/jni/Log.h

@@ -0,0 +1 @@
+../../src/Log.h

+ 1 - 0
android/jni/Material.cpp

@@ -0,0 +1 @@
+../../src/Material.cpp

+ 1 - 0
android/jni/Material.h

@@ -0,0 +1 @@
+../../src/Material.h

+ 1 - 0
android/jni/MaterialManager.cpp

@@ -0,0 +1 @@
+../../src/MaterialManager.cpp

+ 1 - 0
android/jni/MaterialManager.h

@@ -0,0 +1 @@
+../../src/MaterialManager.h

+ 1 - 0
android/jni/Mesh.cpp

@@ -0,0 +1 @@
+../../src/Mesh.cpp

+ 1 - 0
android/jni/Mesh.h

@@ -0,0 +1 @@
+../../src/Mesh.h

+ 1 - 0
android/jni/MeshChunk.cpp

@@ -0,0 +1 @@
+../../src/MeshChunk.cpp

+ 1 - 0
android/jni/MeshChunk.h

@@ -0,0 +1 @@
+../../src/MeshChunk.h

+ 1 - 0
android/jni/MeshLoader.h

@@ -0,0 +1 @@
+../../src/MeshLoader.h

+ 1 - 0
android/jni/MeshManager.cpp

@@ -0,0 +1 @@
+../../src/MeshManager.cpp

+ 1 - 0
android/jni/MeshManager.h

@@ -0,0 +1 @@
+../../src/MeshManager.h

+ 1 - 0
android/jni/MovableCamera.cpp

@@ -0,0 +1 @@
+../../src/MovableCamera.cpp

+ 1 - 0
android/jni/MovableCamera.h

@@ -0,0 +1 @@
+../../src/MovableCamera.h

+ 1 - 0
android/jni/OcclusionQuery.h

@@ -0,0 +1 @@
+../../src/OcclusionQuery.h

+ 1 - 0
android/jni/Pixel.cpp

@@ -0,0 +1 @@
+../../src/Pixel.cpp

+ 1 - 0
android/jni/Pixel.h

@@ -0,0 +1 @@
+../../src/Pixel.h

+ 1 - 0
android/jni/Renderer.cpp

@@ -0,0 +1 @@
+../../src/Renderer.cpp

+ 1 - 0
android/jni/Renderer.h

@@ -0,0 +1 @@
+../../src/Renderer.h

+ 1 - 0
android/jni/Resource.h

@@ -0,0 +1 @@
+../../src/Resource.h

+ 1 - 0
android/jni/ResourceManager.cpp

@@ -0,0 +1 @@
+../../src/ResourceManager.cpp

+ 1 - 0
android/jni/ResourceManager.h

@@ -0,0 +1 @@
+../../src/ResourceManager.h

+ 1 - 0
android/jni/Skybox.cpp

@@ -0,0 +1 @@
+../../src/Skybox.cpp

+ 1 - 0
android/jni/Skybox.h

@@ -0,0 +1 @@
+../../src/Skybox.h

+ 1 - 0
android/jni/SpriteAnimator.cpp

@@ -0,0 +1 @@
+../../src/SpriteAnimator.cpp

+ 1 - 0
android/jni/SpriteAnimator.h

@@ -0,0 +1 @@
+../../src/SpriteAnimator.h

+ 1 - 0
android/jni/System.h

@@ -0,0 +1 @@
+../../src/System.h

+ 1 - 0
android/jni/Terrain.cpp

@@ -0,0 +1 @@
+../../src/Terrain.cpp

+ 1 - 0
android/jni/Terrain.h

@@ -0,0 +1 @@
+../../src/Terrain.h

+ 1 - 0
android/jni/TextRenderer.cpp

@@ -0,0 +1 @@
+../../src/TextRenderer.cpp

+ 1 - 0
android/jni/TextRenderer.h

@@ -0,0 +1 @@
+../../src/TextRenderer.h

+ 1 - 0
android/jni/Texture.h

@@ -0,0 +1 @@
+../../src/Texture.h

+ 1 - 0
android/jni/TextureManager.h

@@ -0,0 +1 @@
+../../src/TextureManager.h

+ 1 - 0
android/jni/VertexBuffer.h

@@ -0,0 +1 @@
+../../src/VertexBuffer.h

+ 1 - 0
android/jni/World.cpp

@@ -0,0 +1 @@
+../../src/World.cpp

+ 1 - 0
android/jni/World.h

@@ -0,0 +1 @@
+../../src/World.h

+ 1 - 0
android/jni/core

@@ -0,0 +1 @@
+../../src/core

+ 1 - 0
android/jni/input

@@ -0,0 +1 @@
+../../src/input

+ 1 - 0
android/jni/loaders

@@ -0,0 +1 @@
+../../src/loaders

+ 1 - 0
android/jni/network

@@ -0,0 +1 @@
+../../src/network

+ 1 - 0
android/jni/os

@@ -0,0 +1 @@
+../../src/os

+ 1 - 0
android/jni/renderers

@@ -0,0 +1 @@
+../../src/renderers

+ 1 - 0
android/jni/samples

@@ -0,0 +1 @@
+../../samples/

+ 10 - 0
android/local.properties

@@ -0,0 +1,10 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must *NOT* be checked into Version Control Systems,
+# as it contains information specific to your local configuration.
+
+# location of the SDK. This is only used by Ant
+# For customization when using a Version Control System, please read the
+# header note.
+sdk.dir=/opt/android-sdk

+ 20 - 0
android/proguard-project.txt

@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}

+ 14 - 0
android/project.properties

@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=Google Inc.:Google APIs:17

+ 123 - 0
android/src/crown/android/CrownActivity.java

@@ -0,0 +1,123 @@
+package crown.android;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.WindowManager;
+import android.view.MotionEvent;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+import android.content.Context;
+import android.widget.Toast;
+import android.content.res.AssetManager;
+import crown.android.CrownEnum;
+
+/**
+*	BootStrap of Android Application
+*/
+public class CrownActivity extends Activity
+{
+	// Debug
+	public static String TAG = "CrownActivity";
+
+	// Resource attributes
+    static AssetManager 		mAssetManager;
+
+	// Graphic attributes
+	private CrownView 			mView;
+
+	// Input attributes
+	private CrownTouch 			mTouch;
+	private CrownSensor			mSensor;
+
+	/**
+	*
+	*/
+    public void onCreate(Bundle savedInstanceState)
+    {
+        super.onCreate(savedInstanceState);
+
+		// init AssetManager
+		mAssetManager = getAssets();
+		CrownLib.initAssetManager(mAssetManager);
+
+        // Init GLSurfaceView for rendering
+        mView = new CrownView(getApplication());
+		setContentView(mView);
+
+		// Init Input
+		mTouch = new CrownTouch();
+		mSensor = new CrownSensor(this);
+    }
+
+	/**
+	*
+	*/
+	public void onStart()
+	{
+		super.onStart();
+	}
+
+	/**
+	*
+	*/
+	public void onRestart()
+	{
+		super.onRestart();
+	}
+
+	/**
+	*
+	*/
+	public void onResume()
+	{
+		super.onResume();
+        mView.onResume();
+		
+		// init accelerometer
+		if (!mSensor.startListening(this))
+		{
+			finish();
+		}
+	}
+
+	/**
+	*
+	*/
+	public void onPause()
+	{
+		super.onPause();
+        mView.onPause();
+	}
+
+	/**
+	*
+	*/
+	public void onStop()
+	{
+		super.onStop();
+
+		// stop accelerometer
+		mSensor.stopListening();
+	}
+
+	/**
+	*
+	*/
+	public void onDestroy()
+	{
+		super.onDestroy();
+	}
+
+	/**
+	*	Callback method which takes touch data and 
+	*	sends them to Crown.
+	*/
+	public boolean onTouchEvent(MotionEvent event)
+	{
+		mTouch.onTouch(event);
+		return true;
+	}
+}

+ 16 - 0
android/src/crown/android/CrownEnum.java

@@ -0,0 +1,16 @@
+package crown.android;
+
+public class CrownEnum
+{
+	// OSEventType enum in OS.h
+	public static int OSET_NONE				= 0;
+	public static int OSET_KEY_PRESS		= 1;
+	public static int OSET_KEY_RELEASE		= 2;
+	public static int OSET_BUTTON_PRESS		= 3;
+	public static int OSET_BUTTON_RELEASE	= 4;
+	public static int OSET_MOTION_NOTIFY	= 5;
+	public static int OSET_TOUCH_DOWN 		= 6;
+	public static int OSET_TOUCH_MOVE		= 7;
+	public static int OSET_TOUCH_UP			= 8;
+	public static int OSET_ACCELEROMETER	= 9; 
+}

+ 27 - 0
android/src/crown/android/CrownLib.java

@@ -0,0 +1,27 @@
+package crown.android;
+
+import android.content.res.AssetManager;
+
+public class CrownLib
+{
+	static 
+	{
+		System.loadLibrary("crown");
+	}
+	
+	// Device functions
+	public static native void init();
+	public static native void frame();
+	public static native void shutdown();
+
+	// AssetManager functions
+	public static native void initAssetManager(AssetManager assetManager);
+
+	// InputManager functions
+	public static native void pushIntEvent(int type, int a, int b, int c, int d);
+	public static native void pushFloatEvent(int type, float a, float b, float c, float d);
+
+	// RenderWindow functions
+	public static native void setRenderWindowMetrics(int width, int height);
+
+}

+ 185 - 0
android/src/crown/android/CrownSensor.java

@@ -0,0 +1,185 @@
+package crown.android;
+
+import java.util.List;
+import java.lang.Math;
+
+import android.content.Context;
+import android.util.Log;
+import android.hardware.Sensor;
+import android.hardware.SensorEvent;
+import android.hardware.SensorEventListener;
+import android.hardware.SensorManager;
+
+import crown.android.CrownEnum;
+
+
+/**
+*	CrownSensor manage sensors for Android Devices.
+*/
+public class CrownSensor
+{
+    private final float MIN_VALUE = -1.0f;
+    private final float MAX_VALUE = 1.0f;
+    private final static float RAD2DEG = (float) (180.0f / Math.PI);
+
+    private SensorManager sensorManager;
+    private Sensor mAccelerometerSensor;
+    private Sensor mCompassSensor;
+    private SensorEventListener mAccelerometerEventListener;
+    private SensorEventListener mCompassEventListener;
+    private boolean isAccelerometerAvailable;
+    private boolean isCompassAvailable;
+
+    private float[] mRotationMatrix;
+    private float[] mGravity;
+    private float[] mLastGravity;
+    private float[] mBufferedAccelGData;
+    private float[] mGeoMagn;
+    private float[] mBufferedMagnetData;
+    private float[] mOrientation;
+
+    private float[] mRotAngle;
+ 
+
+//-----------------------------------------------------------------------------------
+    public CrownSensor(Context context)
+    {
+        mRotationMatrix = new float[16];
+        mGravity = new float[3];
+        mLastGravity = new float[3];
+        mGeoMagn = new float[3];
+        mOrientation = new float[3];
+        mRotAngle = new float[3];
+
+        isAccelerometerAvailable = context.getPackageManager().hasSystemFeature("android.hardware.sensor.accelerometer");
+        isCompassAvailable = context.getPackageManager().hasSystemFeature("android.hardware.sensor.compass");
+
+        if (hasAccelerometerSupport())
+        {
+            mAccelerometerEventListener = new SensorEventListener()
+            {
+                public void onAccuracyChanged(Sensor sensor, int accuracy) 
+                {
+                }
+
+                public void onSensorChanged(SensorEvent event)
+                {
+                    mGravity[0] = (mGravity[0] * 2 + event.values[0]) * 0.33334f * RAD2DEG;
+                    mGravity[1] = (mGravity[1] * 2 + event.values[1]) * 0.33334f * RAD2DEG;
+                    mGravity[2] = (mGravity[2] * 2 + event.values[2]) * 0.33334f * RAD2DEG;
+
+                    norm();
+
+                    CrownLib.pushFloatEvent(CrownEnum.OSET_ACCELEROMETER, mGravity[0], mGravity[1], mGravity[2], 0.0f);
+                }
+            };           
+        }
+
+        if (hasCompassSupport())
+        {
+            mCompassEventListener = new SensorEventListener()
+            {
+                public void onAccuracyChanged(Sensor sensor, int accuracy) 
+                {
+                }
+
+                public void onSensorChanged(SensorEvent event)
+                {
+                    mGeoMagn[0] = (mGeoMagn[0] + event.values[0]) * 0.5f;
+                    mGeoMagn[1] = (mGeoMagn[1] + event.values[1]) * 0.5f;
+                    mGeoMagn[2] = (mGeoMagn[2] + event.values[2]) * 0.5f; 
+
+                    // CrownLib.pushFloatEvent(CrownEnum.OSET_ACCELEROMETER, mGeoMagn[0], mGeoMagn[1], mGeoMagn[2], 0.0f);
+                }                
+            };
+        }
+    }
+
+//-----------------------------------------------------------------------------------
+    public boolean startListening(Context context)
+    {
+        sensorManager = (SensorManager)context.getSystemService(Context.SENSOR_SERVICE);
+
+        mAccelerometerSensor = sensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
+        mCompassSensor = sensorManager.getDefaultSensor(Sensor.TYPE_MAGNETIC_FIELD);
+
+        sensorManager.registerListener(mAccelerometerEventListener, mAccelerometerSensor, SensorManager.SENSOR_DELAY_GAME);
+        sensorManager.registerListener(mCompassEventListener, mCompassSensor, SensorManager.SENSOR_DELAY_GAME);
+
+        return true;
+    }
+
+//-----------------------------------------------------------------------------------
+    public void stopListening()
+    {
+    	sensorManager.unregisterListener(mAccelerometerEventListener);
+        sensorManager.unregisterListener(mCompassEventListener);
+    }
+
+//-----------------------------------------------------------------------------------
+    public boolean hasAccelerometerSupport()
+    {
+        return isAccelerometerAvailable;       
+    }
+
+//-----------------------------------------------------------------------------------
+    public boolean hasCompassSupport()
+    {   
+        return isCompassAvailable;
+    }
+
+ //-----------------------------------------------------------------------------------
+//     private void lowPassFiltering(float x, float y, float z)
+//     {
+//         float updateFreq = 30; // match this to your update speed
+//         float cutOffFreq = 0.9f;
+//         float timeRC = 1.0f / cutOffFreq;
+//         float dt = 1.0f / updateFreq;
+//         float filterConstant = timeRC / (dt + timeRC);
+//         float alpha = filterConstant;                 
+//         float kAccelerometerMinStep = 0.033f;
+//         float kAccelerometerNoiseAttenuation = 3.0f;
+
+//         float d = clamp((Math.abs(norm(mGravity[0], mGravity[1], mGravity[2]) - norm(x, y, z)) / kAccelerometerMinStep - 1.0f), MIN_VALUE, MAX_VALUE);
+//         alpha = d * filterConstant / kAccelerometerNoiseAttenuation + (1.0f - d) * filterConstant;
+
+//         mGravity[0] = (float) (alpha * (mGravity[0] + x - mLastGravity[0]));
+//         mGravity[1] = (float) (alpha * (mGravity[1] + y - mLastGravity[1]));
+//         mGravity[2] = (float) (alpha * (mGravity[2] + z - mLastGravity[2]));
+
+//         mLastGravity[0] = mGravity[0];
+//         mLastGravity[1] = mGravity[1];
+//         mLastGravity[2] = mGravity[2];
+//     }
+
+//-----------------------------------------------------------------------------------
+    private float clamp(float v, float min, float max)
+    {
+        if (v < min)
+        {
+            v = min;
+        }
+        else if (v > max)
+        {
+            v = max;
+        }
+
+        return v;
+    }
+
+//-----------------------------------------------------------------------------------
+    private void norm()
+    {
+        float v = mGravity[0] * mGravity[0] + mGravity[1] * mGravity[1] + mGravity[2] * mGravity[2];
+        float magnitude = (float)Math.sqrt(v);
+        float invMagnitude = 1 / magnitude;
+
+        mGravity[0] *= invMagnitude;
+        mGravity[1] *= invMagnitude;
+        mGravity[2] *= invMagnitude;
+
+        mGravity[0] = clamp(mGravity[0], MIN_VALUE, MAX_VALUE);
+        mGravity[1] = clamp(mGravity[1], MIN_VALUE, MAX_VALUE);
+        mGravity[2] = clamp(mGravity[2], MIN_VALUE, MAX_VALUE);
+    }
+}

+ 64 - 0
android/src/crown/android/CrownTouch.java

@@ -0,0 +1,64 @@
+package crown.android;
+
+import android.content.Context;
+import android.view.MotionEvent;
+
+public class CrownTouch
+{
+	private boolean isListening;
+
+//-----------------------------------------------------------------------------------
+	public CrownTouch()
+	{
+	}
+
+//-----------------------------------------------------------------------------------
+	public void onTouch(MotionEvent event)
+	{
+		final int pointerIndex = event.getActionIndex();
+		final int pointerCount = event.getPointerCount();
+
+		final int pointerId = event.getPointerId(pointerIndex);
+		final float x = event.getX(pointerIndex);
+		final float y = event.getY(pointerIndex);
+
+		final int actionMasked = event.getActionMasked();
+
+		switch (actionMasked) 
+		{	
+			case MotionEvent.ACTION_DOWN:
+			case MotionEvent.ACTION_POINTER_DOWN:
+			{
+				CrownLib.pushIntEvent(CrownEnum.OSET_TOUCH_DOWN, pointerId, (int)x, (int)y, 0);
+				break;			
+			}
+
+			case MotionEvent.ACTION_UP:
+			case MotionEvent.ACTION_POINTER_UP:
+			case MotionEvent.ACTION_OUTSIDE:
+			case MotionEvent.ACTION_CANCEL:
+			{
+				CrownLib.pushIntEvent(CrownEnum.OSET_TOUCH_UP, pointerId, (int)x, (int)y, 0);
+				break;			
+			}
+			
+			case MotionEvent.ACTION_MOVE:
+			{
+				for (int index = 0; index < pointerCount; index++)
+				{
+					CrownLib.pushIntEvent(CrownEnum.OSET_TOUCH_MOVE, event.getPointerId(index), (int)event.getX(index), (int)event.getY(index), 0);
+				}
+
+				break;
+			}
+		}
+	}
+
+//-----------------------------------------------------------------------------------
+	public boolean hasMultiTouchSupport(Context context)
+	{
+		return context.getPackageManager().hasSystemFeature("android.hardware.touchscreen.multitouch");
+	}
+
+
+}

+ 352 - 0
android/src/crown/android/CrownView.java

@@ -0,0 +1,352 @@
+package crown.android;
+
+import android.content.Context;
+import android.graphics.PixelFormat;
+import android.opengl.GLSurfaceView;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.KeyEvent;
+
+import javax.microedition.khronos.egl.EGL10;
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
+import javax.microedition.khronos.egl.EGLDisplay;
+import javax.microedition.khronos.opengles.GL10;
+
+
+/**
+*	This class provides a GL context used by 
+*	Crown for rendering
+*/
+class CrownView extends GLSurfaceView 
+{
+    private static String TAG = "CrownView";
+
+    private static final boolean DEBUG = false;
+
+	/**
+	*	Constructor
+	*/
+    public CrownView(Context context) 
+	{
+        super(context);
+        init(false, 0, 0);
+    }
+
+	/**
+	*	Constructor
+	*/
+    public CrownView(Context context, boolean translucent, int depth, int stencil) 
+	{
+        super(context);
+        init(translucent, depth, stencil);
+    }
+
+	/**
+	*	
+	*/
+    private void init(boolean translucent, int depth, int stencil) 
+	{
+
+        /* By default, GLSurfaceView() creates a RGB_565 opaque surface.
+         * If we want a translucent one, we should change the surface's
+         * format here, using PixelFormat.TRANSLUCENT for GL Surfaces
+         * is interpreted as any 32-bit surface with alpha by SurfaceFlinger.
+         */
+        if (translucent) 
+		{
+            this.getHolder().setFormat(PixelFormat.TRANSLUCENT);
+        }
+
+        /* Setup the context factory for 2.0 rendering.
+         * See ContextFactory class definition below
+         */
+        setEGLContextFactory(new ContextFactory());
+
+        /* We need to choose an EGLConfig that matches the format of
+         * our surface exactly. This is going to be done in our
+         * custom config chooser. See ConfigChooser class definition
+         * below.
+         */
+        setEGLConfigChooser( translucent ?
+                             new ConfigChooser(8, 8, 8, 8, depth, stencil) :
+                             new ConfigChooser(5, 6, 5, 0, depth, stencil) );
+
+        /* Set the renderer responsible for frame rendering */
+        setRenderer(new Renderer());
+    }
+
+	/**
+	* 	ContextFactory generate a EGL context that will be used by Crown
+	*/
+    private static class ContextFactory implements GLSurfaceView.EGLContextFactory 
+	{
+        private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
+
+        public EGLContext createContext(EGL10 egl, EGLDisplay display, EGLConfig eglConfig) 
+		{
+            Log.w(TAG, "creating EGL context");
+
+            checkEglError("Before eglCreateContext", egl);
+
+			// Create OpenGL|ES 1.1 context
+            int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 1, EGL10.EGL_NONE };
+			// Create OpenGL|ES 2 context
+//          int[] attrib_list = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
+
+            EGLContext context = egl.eglCreateContext(display, eglConfig, EGL10.EGL_NO_CONTEXT, attrib_list);
+
+            checkEglError("After eglCreateContext", egl);
+
+            return context;
+        }
+
+        public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) 
+		{
+            egl.eglDestroyContext(display, context);
+        }
+    }
+
+	/**
+	*	check EGL fails
+	*/
+    private static void checkEglError(String prompt, EGL10 egl) 
+	{
+        int error;
+        while ((error = egl.eglGetError()) != EGL10.EGL_SUCCESS) 
+		{
+            Log.e(TAG, String.format("%s: EGL error: 0x%x", prompt, error));
+        }
+    }
+
+	/**
+	*	ConfigChooser is used to set EGL configuration
+	*/
+    private static class ConfigChooser implements GLSurfaceView.EGLConfigChooser 
+	{
+
+        public ConfigChooser(int r, int g, int b, int a, int depth, int stencil) 
+		{
+            mRedSize = r;
+            mGreenSize = g;
+            mBlueSize = b;
+            mAlphaSize = a;
+            mDepthSize = depth;
+            mStencilSize = stencil;
+        }
+
+		// Choose OpenGL|ES 1 bit
+        private static int EGL_OPENGL_ES_BIT = 1;
+		// Choose OpenGl|ES 2 bit
+//        private static int EGL_OPENGL_ES_BIT = 4;
+        private static int[] s_configAttribs2 =
+        {
+            EGL10.EGL_RED_SIZE, 4,
+            EGL10.EGL_GREEN_SIZE, 4,
+            EGL10.EGL_BLUE_SIZE, 4,
+            EGL10.EGL_RENDERABLE_TYPE, EGL_OPENGL_ES_BIT,
+            EGL10.EGL_NONE
+        };
+
+        public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display) 
+		{
+			Log.i(TAG, "JAVA CHOOSE CONFIG CALLED.");
+            /* Get the number of minimally matching EGL configurations
+             */
+            int[] num_config = new int[1];
+            egl.eglChooseConfig(display, s_configAttribs2, null, 0, num_config);
+
+            int numConfigs = num_config[0];
+
+            if (numConfigs <= 0) 
+			{
+                throw new IllegalArgumentException("No configs match configSpec");
+            }
+
+            /* Allocate then read the array of minimally matching EGL configs
+             */
+            EGLConfig[] configs = new EGLConfig[numConfigs];
+            egl.eglChooseConfig(display, s_configAttribs2, configs, numConfigs, num_config);
+
+            if (DEBUG) 
+			{
+                 printConfigs(egl, display, configs);
+            }
+            /* Now return the "best" one
+             */
+            return chooseConfig(egl, display, configs);
+        }
+
+        public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display, EGLConfig[] configs) 
+		{
+            for(EGLConfig config : configs) 
+			{
+                int d = findConfigAttrib(egl, display, config,
+                        EGL10.EGL_DEPTH_SIZE, 0);
+                int s = findConfigAttrib(egl, display, config,
+                        EGL10.EGL_STENCIL_SIZE, 0);
+
+                // We need at least mDepthSize and mStencilSize bits
+                if (d < mDepthSize || s < mStencilSize)
+                    continue;
+
+                // We want an *exact* match for red/green/blue/alpha
+                int r = findConfigAttrib(egl, display, config,
+                        EGL10.EGL_RED_SIZE, 0);
+                int g = findConfigAttrib(egl, display, config,
+                            EGL10.EGL_GREEN_SIZE, 0);
+                int b = findConfigAttrib(egl, display, config,
+                            EGL10.EGL_BLUE_SIZE, 0);
+                int a = findConfigAttrib(egl, display, config,
+                        EGL10.EGL_ALPHA_SIZE, 0);
+
+                if (r == mRedSize && g == mGreenSize && b == mBlueSize && a == mAlphaSize)
+				{
+                    return config;	
+				}
+            }
+            return null;
+        }
+
+        private int findConfigAttrib(EGL10 egl, EGLDisplay display, EGLConfig config, int attribute, int defaultValue) 
+		{
+            if (egl.eglGetConfigAttrib(display, config, attribute, mValue)) 
+			{
+                return mValue[0];
+            }
+            return defaultValue;
+        }
+
+        private void printConfigs(EGL10 egl, EGLDisplay display, EGLConfig[] configs) 
+		{
+//            int numConfigs = configs.length;
+//            Log.w(TAG, String.format("%d configurations", numConfigs));
+//            for (int i = 0; i < numConfigs; i++) 
+//			{
+//                Log.w(TAG, String.format("Configuration %d:\n", i));
+//                printConfig(egl, display, configs[i]);
+//            }
+        }
+
+        private void printConfig(EGL10 egl, EGLDisplay display, EGLConfig config) 
+		{
+//            int[] attributes = {
+//				                    EGL10.EGL_BUFFER_SIZE,
+//            				        EGL10.EGL_ALPHA_SIZE,
+//                    				EGL10.EGL_BLUE_SIZE,
+//                   					EGL10.EGL_GREEN_SIZE,
+//                    				EGL10.EGL_RED_SIZE,
+//                    				EGL10.EGL_DEPTH_SIZE,
+//                   	 				EGL10.EGL_STENCIL_SIZE,
+//                    				EGL10.EGL_CONFIG_CAVEAT,
+//                    				EGL10.EGL_CONFIG_ID,
+//                    				EGL10.EGL_LEVEL,
+//                    				EGL10.EGL_MAX_PBUFFER_HEIGHT,
+//                    				EGL10.EGL_MAX_PBUFFER_PIXELS,
+//                    				EGL10.EGL_MAX_PBUFFER_WIDTH,
+//                    				EGL10.EGL_NATIVE_RENDERABLE,
+//								    EGL10.EGL_NATIVE_VISUAL_ID,
+//								    EGL10.EGL_NATIVE_VISUAL_TYPE,
+//								    0x3030, // EGL10.EGL_PRESERVED_RESOURCES,
+//								    EGL10.EGL_SAMPLES,
+//								    EGL10.EGL_SAMPLE_BUFFERS,
+//								    EGL10.EGL_SURFACE_TYPE,
+//								    EGL10.EGL_TRANSPARENT_TYPE,
+//								    EGL10.EGL_TRANSPARENT_RED_VALUE,
+//								    EGL10.EGL_TRANSPARENT_GREEN_VALUE,
+//								    EGL10.EGL_TRANSPARENT_BLUE_VALUE,
+//								    0x3039, // EGL10.EGL_BIND_TO_TEXTURE_RGB,
+//								    0x303A, // EGL10.EGL_BIND_TO_TEXTURE_RGBA,
+//								    0x303B, // EGL10.EGL_MIN_SWAP_INTERVAL,
+//								    0x303C, // EGL10.EGL_MAX_SWAP_INTERVAL,
+//								    EGL10.EGL_LUMINANCE_SIZE,
+//								    EGL10.EGL_ALPHA_MASK_SIZE,
+//								    EGL10.EGL_COLOR_BUFFER_TYPE,
+//								    EGL10.EGL_RENDERABLE_TYPE,
+//								    0x3042 // EGL10.EGL_CONFORMANT
+//            };
+//            String[] names = {
+//								    "EGL_BUFFER_SIZE",
+//								    "EGL_ALPHA_SIZE",
+//								    "EGL_BLUE_SIZE",
+//								    "EGL_GREEN_SIZE",
+//								    "EGL_RED_SIZE",
+//								    "EGL_DEPTH_SIZE",
+//								    "EGL_STENCIL_SIZE",
+//								    "EGL_CONFIG_CAVEAT",
+//								    "EGL_CONFIG_ID",
+//								    "EGL_LEVEL",
+//								    "EGL_MAX_PBUFFER_HEIGHT",
+//								    "EGL_MAX_PBUFFER_PIXELS",
+//								    "EGL_MAX_PBUFFER_WIDTH",
+//								    "EGL_NATIVE_RENDERABLE",
+//								    "EGL_NATIVE_VISUAL_ID",
+//								    "EGL_NATIVE_VISUAL_TYPE",
+//								    "EGL_PRESERVED_RESOURCES",
+//								    "EGL_SAMPLES",
+//								    "EGL_SAMPLE_BUFFERS",
+//								    "EGL_SURFACE_TYPE",
+//								    "EGL_TRANSPARENT_TYPE",
+//								    "EGL_TRANSPARENT_RED_VALUE",
+//								    "EGL_TRANSPARENT_GREEN_VALUE",
+//								    "EGL_TRANSPARENT_BLUE_VALUE",
+//								    "EGL_BIND_TO_TEXTURE_RGB",
+//								    "EGL_BIND_TO_TEXTURE_RGBA",
+//								    "EGL_MIN_SWAP_INTERVAL",
+//								    "EGL_MAX_SWAP_INTERVAL",
+//								    "EGL_LUMINANCE_SIZE",
+//								    "EGL_ALPHA_MASK_SIZE",
+//								    "EGL_COLOR_BUFFER_TYPE",
+//								    "EGL_RENDERABLE_TYPE",
+//								    "EGL_CONFORMANT"
+//            };
+
+//            int[] value = new int[1];
+//            for (int i = 0; i < attributes.length; i++) 
+//			{
+//                int attribute = attributes[i];
+//                String name = names[i];
+//                if ( egl.eglGetConfigAttrib(display, config, attribute, value))
+//				{
+//                    Log.w(TAG, String.format("  %s: %d\n", name, value[0]));
+//                } 
+//				else 
+//				{
+//                    // Log.w(TAG, String.format("  %s: failed\n", name));
+//                    while (egl.eglGetError() != EGL10.EGL_SUCCESS);
+//                }
+//            }
+        }
+
+        // Subclasses can adjust these values:
+        protected int mRedSize;
+        protected int mGreenSize;
+        protected int mBlueSize;
+        protected int mAlphaSize;
+        protected int mDepthSize;
+        protected int mStencilSize;
+        private int[] mValue = new int[1];
+    }
+	
+	/**
+	*	Renderer wraps Crown rendering functions
+	*/
+    private static class Renderer implements GLSurfaceView.Renderer
+	{
+        public void onDrawFrame(GL10 gl)
+		{
+			CrownLib.frame();
+        }
+
+        public void onSurfaceChanged(GL10 gl, int width, int height)
+		{
+			CrownLib.init();
+            CrownLib.setRenderWindowMetrics(width, height);
+        }
+
+        public void onSurfaceCreated(GL10 gl, EGLConfig config)
+		{
+
+        }
+    }
+}

+ 4 - 0
samples/CMakeLists.txt

@@ -9,8 +9,12 @@ add_executable(terrain terrain/terrain.cpp)
 add_executable(texturing texturing/texturing.cpp)
 add_executable(textrenderer textrenderer/textrenderer.cpp)
 add_executable(collision collision/collision.cpp)
+add_executable(json json/json.cpp)
 
 target_link_libraries(terrain crown)
 target_link_libraries(texturing crown)
 target_link_libraries(textrenderer crown)
 target_link_libraries(collision crown)
+target_link_libraries(json crown)
+
+

BIN
samples/android/res/grass.tga


BIN
samples/android/res/red_down.tga


BIN
samples/android/res/red_east.tga


BIN
samples/android/res/red_north.tga


BIN
samples/android/res/red_south.tga


BIN
samples/android/res/red_up.tga


BIN
samples/android/res/red_west.tga


+ 98 - 0
samples/android/triangle.cpp

@@ -0,0 +1,98 @@
+#include "Crown.h"
+#include "OS.h"
+#include <jni.h>
+#include <GLES/gl.h>
+#include "MovableCamera.h"
+
+namespace crown
+{
+
+MovableCamera* cam;
+
+extern "C"
+{
+	JNIEXPORT void JNICALL Java_crown_android_CrownLib_frame(JNIEnv* env, jobject obj);
+};
+
+class MainScene : public AccelerometerListener, TouchListener
+{
+	
+public:
+
+	MainScene()
+	{
+		get_input_manager()->register_accelerometer_listener(this);
+		get_input_manager()->register_touch_listener(this);
+
+		cam = new MovableCamera(Vec3::ZERO, true, 90.0f, 1.6f, true, 0.1f, 2.5f);
+
+		if (cam)
+		{
+			cam->SetActive(true);
+			cam->SetSpeed(0.1);
+			cam->SetFarClipDistance(1000.0f);
+		}
+	}
+
+	void accelerometer_changed(const AccelerometerEvent& event)
+	{
+		cam->SetRotation(event.x, event.y);
+	}
+
+	void touch_down(const TouchEvent& event)
+	{
+		cam->MoveBackward();
+	}
+
+	void touch_move(const TouchEvent& event)
+	{
+		cam->MoveBackward();
+	}
+
+	void draw_triangle()
+	{
+		GetDevice()->GetRenderer()->SetClearColor(Color4::LIGHTBLUE);
+
+		GetDevice()->GetRenderer()->SetMatrix(MT_VIEW, Mat4::IDENTITY);
+		GetDevice()->GetRenderer()->SetMatrix(MT_MODEL, Mat4::IDENTITY);
+
+		cam->Render();
+
+		static GLfloat vertices[] = {  -1.0f, -1.0f, -2.0f,
+										1.0f, -1.0f, -2.0f,
+										0.0f, 1.0f, -2.0f};
+
+		GetDevice()->GetRenderer()->SetMatrix(MT_MODEL, Mat4::IDENTITY);
+
+		glEnableClientState(GL_VERTEX_ARRAY);
+		glVertexPointer(3, GL_FLOAT, 0, vertices);
+
+		glDrawArrays(GL_TRIANGLES, 0, 3);
+
+		glDisableClientState(GL_VERTEX_ARRAY);
+	}
+
+	void frame()
+	{
+		Device* mDevice = GetDevice();
+
+		os::event_loop();
+
+		get_input_manager()->event_loop();
+
+		GetDevice()->GetRenderer()->_BeginFrame();
+		draw_triangle();
+		GetDevice()->GetRenderer()->_EndFrame();
+
+		os::swap_buffers();
+	}
+};
+
+MainScene* scene = new MainScene();
+
+JNIEXPORT void JNICALL Java_crown_android_CrownLib_frame(JNIEnv* env, jobject obj)
+{
+	scene->frame();
+}
+
+} // namespace crown

+ 26 - 0
samples/json/json.cpp

@@ -0,0 +1,26 @@
+#include <stdio.h>
+#include "JSONParser.h"
+
+using namespace crown;
+
+int main(int argc, char** argv)
+{
+	const char* src = "\"test\" : {\"string\" : \"dio\", \"number\" : 33}";
+
+	JSONParser* parser = new JSONParser();
+	json_error error;
+	JSONToken* tokens;
+
+	parser->init();
+	error = parser->parse(src);
+	tokens = parser->get_tokens();
+
+	for (int i = 0; i < parser->get_tokens_number(); i++)
+	{
+		tokens[i].print();
+	}
+
+	printf("return: %d\n", error);
+
+	return 0;
+}

+ 17 - 12
samples/terrain/terrain.cpp

@@ -4,6 +4,7 @@
 #include <GL/glew.h>
 #include <GL/glu.h>
 #include "OS.h"
+#include "FPSSystem.h"
 
 using namespace crown;
 
@@ -13,7 +14,7 @@ public:
 
 	WndCtrl()
 	{
-		GetInputManager()->RegisterKeyboardListener(this);
+		get_input_manager()->register_keyboard_listener(this);
 	}
 
 	void KeyReleased(const KeyboardEvent& event)
@@ -37,8 +38,8 @@ public:
 		optShowCrate(true),
 		optShowTerrain(true)
 	{
-		GetInputManager()->RegisterKeyboardListener(this);
-		GetInputManager()->RegisterMouseListener(this);
+		get_input_manager()->register_keyboard_listener(this);
+		get_input_manager()->register_mouse_listener(this);
 		mouseRightPressed = false;
 		mouseLeftPressed = false;
 	}
@@ -47,7 +48,7 @@ public:
 	{
 	}
 
-	void KeyReleased(const KeyboardEvent& event)
+	void key_released(const KeyboardEvent& event)
 	{
 		if (event.key == '1')
 		{
@@ -78,7 +79,7 @@ public:
 		}
 	}
 
-	void ButtonPressed(const MouseEvent& event)
+	void button_pressed(const MouseEvent& event)
 	{
 		if (event.button == MB_LEFT)
 		{
@@ -121,7 +122,7 @@ public:
 		wheel += event.wheel * 0.25;
 	}
 
-	void ButtonReleased(const MouseEvent& event)
+	void button_released(const MouseEvent& event)
 	{
 		if (event.button == MB_LEFT)
 		{
@@ -134,14 +135,14 @@ public:
 		wheel -= event.wheel * 0.25;
 	}
 		
-
 	void OnLoad()
 	{
 		crown::Renderer* renderer = crown::GetDevice()->GetRenderer();
 		renderer->SetClearColor(Color4::LIGHTBLUE);
-
+		
+		Vec3 start = Vec3(0.0f, 10.0f, 0.0f);
 		// Add a movable camera
-		cam = new MovableCamera(Vec3::ZERO, true, 90.0f, 1.6f, true, 0.1, 2.5);
+		cam = new MovableCamera(/*Vec3::ZERO*/start, true, 90.0f, 1.6f, true, 0.1, 2.5);
 
 		if (cam)
 		{
@@ -150,6 +151,8 @@ public:
 			cam->SetFarClipDistance(1000.0f);
 		}
 
+		system = new FPSSystem(cam);
+
 		// Add a skybox
 		skybox = new Skybox(Vec3::ZERO, true);
 
@@ -177,8 +180,9 @@ public:
 	void RenderScene()
 	{
 		Renderer* renderer = GetDevice()->GetRenderer();
-
-		cam->Render();
+		
+		system->set_view_by_cursor();
+		system->camera_render();
 
 		renderer->_SetLighting(false);
 		renderer->_SetTexturing(0, false);
@@ -235,6 +239,7 @@ public:
 
 private:
 
+	FPSSystem* system;
 	MovableCamera* cam;
 	Skybox* skybox;
 	Mat4 ortho;
@@ -268,7 +273,7 @@ int main(int argc, char** argv)
 	{
 		os::event_loop();
 
-		GetInputManager()->EventLoop();
+		get_input_manager()->event_loop();
 
 		GetDevice()->GetRenderer()->_BeginFrame();
 			mainScene.RenderScene();

+ 7 - 0
src/CMakeLists.txt

@@ -14,11 +14,15 @@ set (SRC
 	Skybox.cpp
 	Terrain.cpp
 	World.cpp
+
 	TextureResource.cpp
 	
 	TextResource.cpp
 	ArchiveResourceArchive.cpp
 	FileResourceArchive.cpp
+
+	FPSSystem.cpp
+	JSONParser.cpp
 )
 
 set (HEADERS
@@ -48,6 +52,9 @@ set (HEADERS
 	TextResource.h
 	ArchiveResourceArchive.h
 	FileResourceArchive.h
+
+	FPSSystem.h
+	JSONParser.h
 )
 
 set (CORE_SRC

+ 1 - 1
src/Device.cpp

@@ -174,7 +174,7 @@ void Device::Frame()
 {
 	os::event_loop();
 
-	GetInputManager()->EventLoop();
+	get_input_manager()->event_loop();
 
 		mRenderer->begin_frame();
 		mRenderer->end_frame();

+ 166 - 0
src/FPSSystem.cpp

@@ -0,0 +1,166 @@
+#include "InputManager.h"
+#include "MovableCamera.h"
+#include "FPSSystem.h"
+#include "Vec2.h"
+#include "Vec3.h"
+#include "Mat3.h"
+#include "OS.h"
+
+namespace crown
+{
+
+//-----------------------------------------------------------------------
+FPSSystem::FPSSystem(MovableCamera* camera) :
+	m_angle_x(0),
+	m_angle_y(0),
+	m_camera(camera),
+	m_up_pressed(false),
+	m_right_pressed(false),
+	m_down_pressed(false),
+	m_left_pressed(false)
+{
+	get_input_manager()->register_keyboard_listener(this);
+	get_input_manager()->register_accelerometer_listener(this);
+	//get_input_manager()->register_mouse_listener(this);
+	get_input_manager()->set_cursor_relative_xy(Vec2(0.5f, 0.5f));
+	
+}
+
+//-----------------------------------------------------------------------
+void FPSSystem::key_pressed(const KeyboardEvent& event)
+{
+	switch (event.key)
+	{
+		case 'w':
+		case 'W':
+		{
+			m_up_pressed = true;
+			break;
+		}
+		case 'a':
+		case 'A':
+		{
+			m_left_pressed = true;
+			break;
+		}
+		case 's':
+		case 'S':
+		{
+			m_down_pressed = true;
+			break;
+		}
+		case 'd':
+		case 'D':
+		{
+			m_right_pressed = true;
+			break;
+		}
+		default:
+		{
+			break;
+		}
+	}
+}
+
+//-----------------------------------------------------------------------
+void FPSSystem::key_released(const KeyboardEvent& event)
+{
+	switch (event.key)
+	{
+		case 'w':
+		{
+			m_up_pressed = false;
+			break;
+		}
+		case 'a':
+		{
+			m_left_pressed = false;
+			break;
+		}
+		case 's':
+		{
+			m_down_pressed = false;
+			break;
+		}
+		case 'd':
+		{
+			m_right_pressed = false;
+			break;
+		}
+		default:
+		{
+			break;
+		}
+	}
+}
+
+//-----------------------------------------------------------------------
+void FPSSystem::accelerometer_changed(const AccelerometerEvent& event)
+{
+	set_view_by_cursor();
+}
+//-----------------------------------------------------------------------
+void FPSSystem::set_camera(MovableCamera* camera)
+{
+	m_camera = camera;
+}
+
+//-----------------------------------------------------------------------
+MovableCamera* FPSSystem::get_camera()
+{
+	return m_camera;
+}
+
+//-----------------------------------------------------------------------
+void FPSSystem::camera_render()
+{
+	if (m_up_pressed)
+	{
+		m_camera->MoveForward();
+	}
+
+	if (m_left_pressed)
+	{
+		m_camera->StrafeLeft();
+	}		
+
+	if (m_down_pressed)
+	{
+		m_camera->MoveBackward();
+	}
+
+	if (m_right_pressed)
+	{
+		m_camera->StrafeRight();
+	}
+
+	m_camera->Render();
+}
+
+//-----------------------------------------------------------------------	
+void FPSSystem::set_view_by_cursor()
+{
+	static Vec2 lastPos = get_input_manager()->get_cursor_relative_xy();
+	Vec2 currentPos = get_input_manager()->get_cursor_relative_xy();
+	get_input_manager()->set_cursor_relative_xy(Vec2(0.5f, 0.5f));
+
+	if (lastPos == currentPos)
+	{
+		return;
+	}
+
+	Vec2 delta = lastPos - currentPos;
+
+	get_input_manager()->set_cursor_relative_xy(Vec2(0.5f, 0.5f));
+	lastPos = get_input_manager()->get_cursor_relative_xy();
+
+	m_angle_x += delta.y * m_camera->GetSensibility();
+	m_angle_y += delta.x * m_camera->GetSensibility();
+
+	m_angle_x = math::clamp_to_range(-89.999f * math::DEG_TO_RAD, 89.999f * math::DEG_TO_RAD, m_angle_x);
+	m_angle_y = math::fmod(m_angle_y, math::TWO_PI);
+
+	m_camera->SetRotation(m_angle_x, m_angle_y);
+}
+
+} // namespace crown

+ 44 - 0
src/FPSSystem.h

@@ -0,0 +1,44 @@
+#pragma once
+
+#include "Types.h"
+#include "Camera.h"
+#include "Vec2.h"
+#include "Mouse.h"
+#include "Keyboard.h"
+#include "Touch.h"
+#include "Accelerometer.h"
+
+namespace crown
+{
+/// TODO: set_view_by_cursor must be implemented through scripting
+class FPSSystem : public MouseListener, public KeyboardListener, public AccelerometerListener
+{
+public:
+
+					/// Constructor
+					FPSSystem(MovableCamera* camera);
+
+	void 			set_camera(MovableCamera* camera);
+	MovableCamera*	get_camera();
+
+	void			camera_render();
+	void			set_view_by_cursor();	
+
+	virtual void 	key_pressed(const KeyboardEvent& event);
+	virtual void 	key_released(const KeyboardEvent& event);
+	virtual void 	accelerometer_changed(const AccelerometerEvent& event);
+
+private:
+
+	real 	m_angle_x;
+	real 	m_angle_y;
+
+	bool m_up_pressed : 1;
+	bool m_right_pressed : 1;
+	bool m_down_pressed : 1;
+	bool m_left_pressed : 1;
+
+	MovableCamera* m_camera;
+};
+
+} // namespace crown

+ 326 - 0
src/JSONParser.cpp

@@ -0,0 +1,326 @@
+#include "JSONParser.h"
+#include "OS.h"
+
+namespace crown
+{
+
+void JSONToken::print()
+{
+	os::printf("Type:\t%d\n",m_type);
+	os::printf("Start:\t%d\n",m_start);
+	os::printf("End:\t%d\n",m_end);
+	os::printf("Parent:\t%d\n",m_parent);
+	os::printf("Size:\t%d\n",m_size);
+	os::printf("\n");
+}
+
+//--------------------------------------------------------------------------
+JSONParser::JSONParser(size_t size)
+{
+	if (size > 1024)
+	{
+		m_tokens = new JSONToken[size];
+	}
+	else
+	{
+		m_tokens = m_tokens_list;
+	}
+
+	m_size = size;
+}
+
+//--------------------------------------------------------------------------
+void 
+JSONParser::init()
+{
+	m_pos = 0;
+	m_next_token = 0;
+	m_prev_token = -1;
+
+	is_init = true;
+}
+
+//--------------------------------------------------------------------------
+json_error 
+JSONParser::parse(const char* src)
+{
+	json_error error;
+	JSONToken* token;
+
+	if (!is_init)
+	{
+		return JSON_NO_INIT; 
+	}
+
+	while(src[m_pos] != '\0')
+	{
+		json_type type;
+		char c;
+
+		c = src[m_pos];
+
+		switch(c)
+		{
+			case '{':
+			case '[':
+			{
+				token = allocate_token();
+
+				if (token == NULL)
+				{
+					return JSON_NO_MEMORY;
+				}
+				if (m_prev_token != -1)
+				{
+					m_tokens[m_prev_token].m_size++;
+					token->m_parent = m_prev_token;
+				}
+
+				token->m_type = c == '{' ? JSON_OBJECT : JSON_ARRAY;
+				token->m_start = m_pos;
+				m_prev_token = m_next_token - 1;
+
+				break;
+			}
+			case '}':
+			case ']':
+			{
+				type = c == '}' ? JSON_OBJECT : JSON_ARRAY;
+
+				if (m_next_token < 1)
+				{
+					os::printf("1\n");
+					return JSON_INV_CHAR;
+				}
+
+				token = &m_tokens[m_next_token - 1];
+
+				while (true)
+				{
+					if (token->m_start != -1 && token->m_end == -1)
+					{
+						if (token->m_type != type)
+						{
+							os::printf("%d\t%d\n", token->m_type, type);
+							return JSON_INV_CHAR;
+						}
+						token->m_end = m_pos + 1;
+						m_prev_token = token->m_parent;
+						break;
+					}
+
+					if (token->m_parent == -1)
+					{
+						break;
+					}
+
+					token = &m_tokens[token->m_parent];
+				}
+
+				break;
+			}
+			case '\"':
+			{
+				error = parse_string(src);
+            	if (m_prev_token != -1)
+            	{
+            		m_tokens[m_prev_token].m_size++;
+            	}
+				break;
+			}
+            case '\t': 
+            case '\r': 
+            case '\n': 
+            case ':': 
+            case ',': 
+            case ' ': 
+            {
+            	break;
+            }
+            case '-':
+            case '0':
+            case '1':
+            case '2':
+            case '3':
+            case '4':
+            case '5':
+            case '6':
+            case '7':
+            case '8':
+            case '9':
+            case 't':
+            case 'f':
+            case 'n':
+            {
+            	error = parse_primitive(src);
+            	if (m_prev_token != -1)
+            	{
+            		m_tokens[m_prev_token].m_size++;
+            	}
+            	break;
+            }
+		}
+		m_pos++;
+	}
+
+	return JSON_SUCCESS;
+}
+
+//--------------------------------------------------------------------------
+json_error
+JSONParser::parse_string(const char* src)
+{
+	JSONToken* token;
+
+	int start = m_pos;
+
+	m_pos++;
+
+	while(src[m_pos] != '\0')
+	{	
+		char c = src[m_pos];
+
+		if (c == '\"' || c == '\'')
+		{
+			token = allocate_token();
+
+			if (token == NULL)
+			{
+				m_pos = start;
+				return JSON_NO_MEMORY;
+			}
+
+			fill_token(token, JSON_STRING, start + 1, m_pos);
+			token->m_parent = m_prev_token;
+
+			return JSON_SUCCESS;
+		}
+
+		if (c == '\\')
+		{
+			m_pos++;
+
+			switch(src[m_pos])
+			{
+				case '\"': 
+				case '/' : 
+				case '\\': 
+				case 'b':
+                case 'f': 
+                case 'r': 
+                case 'n': 
+                case 't':
+                {
+                	break;
+                }
+                case 'u' :
+                {
+                	// TODO
+                	break;
+                }
+                default:
+               	{
+                	m_pos = start;
+					os::printf("3\n");
+                	return JSON_INV_CHAR;
+                	break;
+                }
+			}
+		}
+		m_pos++;
+	}
+	m_pos = start;
+	return JSON_INV_PART;
+}
+
+//--------------------------------------------------------------------------
+json_error
+JSONParser::parse_primitive(const char* src)
+{
+	JSONToken* token;
+
+	int start = m_pos;
+
+	while (src[m_pos] != '\0')
+	{
+		char c = src[m_pos];
+
+		switch (c)
+		{
+			case ':' :
+			case '\t': 
+			case '\r':
+			case '\n': 
+			case ' ' :
+			case ',' : 
+			case ']' : 
+			case '}' :
+			{
+				token = allocate_token();
+				if (token == NULL)
+				{
+					m_pos = start;
+					return JSON_NO_MEMORY;
+				}
+
+				fill_token(token, JSON_PRIMITIVE, start, m_pos);
+
+				token->m_parent = m_prev_token;
+				m_pos--;
+
+				return JSON_SUCCESS;
+			}
+		}
+
+		if (c < 32 || c >= 127)
+		{
+			m_pos = start;
+			os::printf("4\n");
+			return JSON_INV_CHAR;
+		}
+
+		m_pos++;
+	}
+}
+
+//--------------------------------------------------------------------------
+JSONToken* 
+JSONParser::allocate_token()
+{
+	JSONToken* token;
+
+	if (m_next_token >= m_size)
+	{
+		return NULL;
+	}	
+
+	token = &m_tokens[m_next_token++];
+	token->m_start = token->m_end = -1;
+	token->m_size = 0;
+	token->m_parent = -1;
+
+	return token;
+}
+
+//--------------------------------------------------------------------------
+void JSONParser::fill_token(JSONToken* token, json_type type, int32_t start, int32_t end)
+{
+	token->m_type = type;
+	token->m_start = start;
+	token->m_end = end;
+	token->m_size = token->m_end - token->m_start;
+}
+
+//--------------------------------------------------------------------------
+JSONToken* JSONParser::get_tokens()
+{
+	return m_tokens;
+}
+
+//--------------------------------------------------------------------------
+int32_t JSONParser::get_tokens_number()
+{
+	return m_next_token;
+}
+
+} //namespace crown

+ 77 - 0
src/JSONParser.h

@@ -0,0 +1,77 @@
+#pragma once
+
+#include "Types.h"
+
+namespace crown
+{
+
+enum json_type
+{
+	JSON_PRIMITIVE 	= 0,	// Number, boolean or null
+	JSON_OBJECT 	= 1,	// Object
+	JSON_ARRAY 		= 2,	// Array
+	JSON_STRING 	= 3		// String
+};
+
+enum json_error
+{
+	JSON_NO_MEMORY	= 0,	// Not enough token provided
+	JSON_INV_CHAR	= 1,	// Invalid character inside JSON string
+	JSON_INV_PART	= 2,	// JSON string is incompleted
+	JSON_NO_INIT	= 3,	// JSON parser not initialized
+	JSON_SUCCESS	= 4		// Everything OK!
+};
+
+struct JSONToken
+{
+	json_type	m_type;
+	int32_t 	m_start;
+	int32_t 	m_end;
+	size_t 		m_size;
+	int32_t 	m_parent;
+
+	void print();
+};
+
+class JSONParser
+{
+public:
+	/// Constructor
+					JSONParser(size_t size = 1024);
+	/// Init JSON parser, must be called for each different JSON string
+	void 			init();
+	/// Parse JSON data
+	json_error 		parse(const char* src);
+	/// Parse string in JSON data
+	json_error		parse_string(const char* src);
+	/// Parse number or boolean in JSON data
+	json_error		parse_primitive(const char* src);
+	/// Allocate token node
+	JSONToken* 		allocate_token();
+	/// Fill token and set boundaries
+	void			fill_token(JSONToken* token, json_type type, int32_t start, int32_t end);
+	/// Get all tokens
+	JSONToken*		get_tokens();
+	/// Get next token
+	int32_t			get_tokens_number();
+
+private:
+	/// JSON string offset
+	uint32_t 		m_pos;
+	/// Next token to allocate				
+	int32_t			m_next_token;
+	/// Previous token e.g parent or array		
+	int32_t			m_prev_token;
+
+	/// JSON tokens list, used as default
+	JSONToken		m_tokens_list[1024];
+	/// JSON tokens ptr (used only if we need more then 1024 tokens)
+	JSONToken* 		m_tokens;
+	/// m_tokens default size, default 1024
+	size_t			m_size;
+
+	// is JSON parser initilized
+	bool 			is_init;		
+};
+
+} // namespace crown

+ 1 - 2
src/Log.cpp

@@ -25,7 +25,6 @@ OTHER DEALINGS IN THE SOFTWARE.
 
 #include "Log.h"
 #include "OS.h"
-#include <cstdarg>
 
 namespace crown
 {
@@ -43,7 +42,7 @@ void Log::SetThreshold(LogLevel threshold)
 	mThreshold = threshold;
 }
 
-void Log::LogMessage(LogLevel level, const char* message, va_list arg)
+void Log::LogMessage(LogLevel level, const char* message, ::va_list arg)
 {
 	if (level > mThreshold)
 	{

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.