Răsfoiți Sursa

android dir added and did some fixes

mikymod 13 ani în urmă
părinte
comite
c6018ed995
83 a modificat fișierele cu 542 adăugiri și 53 ștergeri
  1. 19 0
      android/AndroidManifest.xml
  2. 17 0
      android/ant.properties
  3. 92 0
      android/build.xml
  4. 165 0
      android/jni/Android.mk
  5. 2 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/Filesystem.cpp
  17. 1 0
      android/jni/Filesystem.h
  18. 1 0
      android/jni/Font.cpp
  19. 1 0
      android/jni/Font.h
  20. 1 0
      android/jni/FontManager.cpp
  21. 1 0
      android/jni/FontManager.h
  22. 1 0
      android/jni/Glyph.h
  23. 1 0
      android/jni/Image.cpp
  24. 1 0
      android/jni/Image.h
  25. 1 0
      android/jni/ImageLoader.cpp
  26. 1 0
      android/jni/ImageLoader.h
  27. 1 0
      android/jni/IndexBuffer.h
  28. 1 0
      android/jni/Log.cpp
  29. 1 0
      android/jni/Log.h
  30. 1 0
      android/jni/Material.cpp
  31. 1 0
      android/jni/Material.h
  32. 1 0
      android/jni/MaterialManager.cpp
  33. 1 0
      android/jni/MaterialManager.h
  34. 1 0
      android/jni/Mesh.cpp
  35. 1 0
      android/jni/Mesh.h
  36. 1 0
      android/jni/MeshChunk.cpp
  37. 1 0
      android/jni/MeshChunk.h
  38. 1 0
      android/jni/MeshLoader.h
  39. 1 0
      android/jni/MeshManager.cpp
  40. 1 0
      android/jni/MeshManager.h
  41. 1 0
      android/jni/MovableCamera.cpp
  42. 1 0
      android/jni/MovableCamera.h
  43. 1 0
      android/jni/OcclusionQuery.h
  44. 1 0
      android/jni/Pixel.cpp
  45. 1 0
      android/jni/Pixel.h
  46. 1 0
      android/jni/Renderer.cpp
  47. 1 0
      android/jni/Renderer.h
  48. 1 0
      android/jni/Resource.h
  49. 1 0
      android/jni/ResourceManager.cpp
  50. 1 0
      android/jni/ResourceManager.h
  51. 1 0
      android/jni/Skybox.cpp
  52. 1 0
      android/jni/Skybox.h
  53. 1 0
      android/jni/SpriteAnimator.cpp
  54. 1 0
      android/jni/SpriteAnimator.h
  55. 1 0
      android/jni/System.h
  56. 1 0
      android/jni/Terrain.cpp
  57. 1 0
      android/jni/Terrain.h
  58. 1 0
      android/jni/TextRenderer.cpp
  59. 1 0
      android/jni/TextRenderer.h
  60. 1 0
      android/jni/Texture.h
  61. 1 0
      android/jni/TextureManager.h
  62. 1 0
      android/jni/VertexBuffer.h
  63. 1 0
      android/jni/World.cpp
  64. 1 0
      android/jni/World.h
  65. 1 0
      android/jni/core
  66. 1 0
      android/jni/input
  67. 1 0
      android/jni/loaders
  68. 1 0
      android/jni/network
  69. 1 0
      android/jni/os
  70. 1 0
      android/jni/renderers
  71. 1 0
      android/jni/windowing
  72. 10 0
      android/local.properties
  73. 20 0
      android/proguard-project.txt
  74. 14 0
      android/project.properties
  75. 13 0
      android/res/layout/main.xml
  76. 4 0
      android/res/values/strings.xml
  77. 15 0
      android/src/crown/android/CrownActivity.java
  78. 1 2
      src/Log.cpp
  79. 2 1
      src/Log.h
  80. 81 36
      src/network/AsyncConnection.cpp
  81. 19 13
      src/network/AsyncConnection.h
  82. 1 1
      src/network/BitMessage.cpp
  83. 1 0
      src/os/OS.h

+ 19 - 0
android/AndroidManifest.xml

@@ -0,0 +1,19 @@
+<?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="10"
+        android:targetSdkVersion="15" />
+
+    <application android:label="@string/app_name" >
+        <activity android:name="CrownActivity"
+                  android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest> 

+ 17 - 0
android/ant.properties

@@ -0,0 +1,17 @@
+# This file is used to override default values used by the Ant build system.
+#
+# This file must be checked into Version Control Systems, as it is
+# integral to the build system of your project.
+
+# This file is only used by the Ant script.
+
+# You can use this to override default values such as
+#  'source.dir' for the location of your java source folder and
+#  'out.dir' for the location of your output folder.
+
+# You can also use it define how the release builds are signed by declaring
+# the following properties:
+#  'key.store' for the location of your keystore and
+#  'key.alias' for the name of the key to use.
+# The password will be asked during the build when you use the 'release' target.
+

+ 92 - 0
android/build.xml

@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="android" 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>

+ 165 - 0
android/jni/Android.mk

@@ -0,0 +1,165 @@
+# 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/streams/FileStream.cpp\
+	core/streams/MemoryStream.cpp\
+	core/streams/Stream.cpp\
+\
+	input/EventDispatcher.cpp\
+	input/InputManager.cpp\
+\
+	loaders/BMPImageLoader.cpp\
+	loaders/TGAImageLoader.cpp\
+\
+	Filesystem.cpp\
+\
+	renderers/gles/GLESIndexBuffer.cpp\
+	renderers/gles/GLESRenderer.cpp\
+	renderers/gles/GLESSupport.cpp\
+	renderers/gles/GLESTextRenderer.cpp\
+	renderers/gles/GLESTexture.cpp\
+	renderers/gles/GLESTextureManager.cpp\
+	renderers/gles/GLESVertexBuffer.cpp\
+\
+	App.cpp\
+	Camera.cpp\
+	Device.cpp\
+	Entity.cpp\
+	Font.cpp\
+	FontManager.cpp\
+	Frame.cpp\
+	Image.cpp\
+	ImageLoader.cpp\
+	Light.cpp\
+	Log.cpp\
+	LogManager.cpp\
+	Material.cpp\
+	MaterialManager.cpp\
+	MeshChunk.cpp\
+	Mesh.cpp\
+	MeshManager.cpp\
+	MovableCamera.cpp\
+	PhysicNode.cpp\
+	PhysicsManager.cpp\
+	Pixel.cpp\
+	Renderer.cpp\
+	RenderWindow.cpp\
+	ResourceManager.cpp\
+	Scene.cpp\
+	SceneManager.cpp\
+	SceneNode.cpp\
+	Skybox.cpp\
+	SpriteAnimator.cpp\
+	Sprite.cpp\
+	Timer.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)/renderers\
+	$(LOCAL_PATH)/things\
+	$(LOCAL_PATH)/filesystem\
+	$(LOCAL_PATH)/gui\
+	$(LOCAL_PATH)/windowing\
+	$(LOCAL_PATH)/windowing/themes\
+	$(LOCAL_PATH)/windowing/layouts\
+	$(LOCAL_PATH)/windowing/templates\
+	$(LOCAL_PATH)/windowing/toolbox\
+	$(LOCAL_PATH)/renderers/gl\
+	$(LOCAL_PATH)/renderers/gl/glx\
+	$(LOCAL_PATH)/renderers/gl/wgl\
+	$(LOCAL_PATH)/renderers/gles\
+	$(LOCAL_PATH)/renderers/gles/egl\
+	$(LOCAL_PATH)/input\
+	$(LOCAL_PATH)/os\
+	$(LOCAL_PATH)/os/android\
+
+LOCAL_CPPFLAGS	:= -g -fexceptions
+LOCAL_LDLIBS	:= -llog -landroid -lEGL -lGLESv1_CM
+LOCAL_STATIC_LIBRARIES := android_native_app_glue
+include $(BUILD_STATIC_LIBRARY)
+
+include $(CLEAR_VARS)
+
+#LOCAL_MODULE    := simple
+#LOCAL_SRC_FILES :=	tests/chainsawbuffet/maain.cpp\
+#					tests/chainsawbuffet/Globals.cpp\
+#					tests/chainsawbuffet/entities/Pg.cpp\
+#					tests/chainsawbuffet/entities/Zombie.cpp\
+#					tests/chainsawbuffet/entities/SolidSceneNode.cpp\
+#					tests/chainsawbuffet/entities/Joystick.cpp\
+#					tests/chainsawbuffet/scenes/ArenaScene.cpp\
+#					tests/chainsawbuffet/entities/Bullet.cpp
+#LOCAL_SHARED_LIBRARIES := crown
+#LOCAL_C_INCLUDES	:=\
+#	$(LOCAL_PATH)/core\
+#	$(LOCAL_PATH)/core/math\
+#	$(LOCAL_PATH)/core/containers\
+#	$(LOCAL_PATH)/core/bv\
+#	$(LOCAL_PATH)/core/mem\
+#	$(LOCAL_PATH)/core/streams\
+#	$(LOCAL_PATH)/loaders\
+#	$(LOCAL_PATH)/renderers\
+#	$(LOCAL_PATH)/things\
+#	$(LOCAL_PATH)/filesystem\
+#	$(LOCAL_PATH)/gui\
+#	$(LOCAL_PATH)/windowing\
+#	$(LOCAL_PATH)/windowing/themes\
+#	$(LOCAL_PATH)/windowing/layouts\
+#	$(LOCAL_PATH)/windowing/templates\
+#	$(LOCAL_PATH)/windowing/toolbox\
+#	$(LOCAL_PATH)/renderers/gl\
+#	$(LOCAL_PATH)/renderers/gl/glx\
+#	$(LOCAL_PATH)/renderers/gl/wgl\
+#	$(LOCAL_PATH)/renderers/gles\
+#	$(LOCAL_PATH)/renderers/gles/egl\
+#	$(LOCAL_PATH)/input\
+#	$(LOCAL_PATH)/input/android\
+#	$(LOCAL_PATH)/tests\
+#	$(LOCAL_PATH)/tests/chainsawbuffet\
+#	$(LOCAL_PATH)/tests/chainsawbuffet/entities\
+#	$(LOCAL_PATH)/tests/chainsawbuffet/scenes\
+
+#LOCAL_CPPFLAGS	:= -g -fexceptions
+#LOCAL_LDLIBS	:= -llog -landroid -lEGL -lGLESv1_CM -lz
+#LOCAL_STATIC_LIBRARIES := android_native_app_glue
+#include $(BUILD_SHARED_LIBRARY)
+#$(call import-module,android/native_app_glue)
+

+ 2 - 0
android/jni/Application.mk

@@ -0,0 +1,2 @@
+APP_PLATFORM := android-9
+APP_STL := gnustl_static

+ 1 - 0
android/jni/CMakeLists.txt

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/CMakeLists.txt

+ 1 - 0
android/jni/Camera.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Camera.cpp

+ 1 - 0
android/jni/Camera.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Camera.h

+ 1 - 0
android/jni/Config.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Config.h

+ 1 - 0
android/jni/Crown.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Crown.h

+ 1 - 0
android/jni/Data.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Data.h

+ 1 - 0
android/jni/Device.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Device.cpp

+ 1 - 0
android/jni/Device.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Device.h

+ 1 - 0
android/jni/EventBuffer.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/EventBuffer.cpp

+ 1 - 0
android/jni/EventBuffer.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/EventBuffer.h

+ 1 - 0
android/jni/Filesystem.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Filesystem.cpp

+ 1 - 0
android/jni/Filesystem.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Filesystem.h

+ 1 - 0
android/jni/Font.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Font.cpp

+ 1 - 0
android/jni/Font.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Font.h

+ 1 - 0
android/jni/FontManager.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/FontManager.cpp

+ 1 - 0
android/jni/FontManager.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/FontManager.h

+ 1 - 0
android/jni/Glyph.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Glyph.h

+ 1 - 0
android/jni/Image.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Image.cpp

+ 1 - 0
android/jni/Image.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Image.h

+ 1 - 0
android/jni/ImageLoader.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/ImageLoader.cpp

+ 1 - 0
android/jni/ImageLoader.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/ImageLoader.h

+ 1 - 0
android/jni/IndexBuffer.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/IndexBuffer.h

+ 1 - 0
android/jni/Log.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Log.cpp

+ 1 - 0
android/jni/Log.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Log.h

+ 1 - 0
android/jni/Material.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Material.cpp

+ 1 - 0
android/jni/Material.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Material.h

+ 1 - 0
android/jni/MaterialManager.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MaterialManager.cpp

+ 1 - 0
android/jni/MaterialManager.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MaterialManager.h

+ 1 - 0
android/jni/Mesh.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Mesh.cpp

+ 1 - 0
android/jni/Mesh.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Mesh.h

+ 1 - 0
android/jni/MeshChunk.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MeshChunk.cpp

+ 1 - 0
android/jni/MeshChunk.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MeshChunk.h

+ 1 - 0
android/jni/MeshLoader.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MeshLoader.h

+ 1 - 0
android/jni/MeshManager.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MeshManager.cpp

+ 1 - 0
android/jni/MeshManager.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MeshManager.h

+ 1 - 0
android/jni/MovableCamera.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MovableCamera.cpp

+ 1 - 0
android/jni/MovableCamera.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/MovableCamera.h

+ 1 - 0
android/jni/OcclusionQuery.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/OcclusionQuery.h

+ 1 - 0
android/jni/Pixel.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Pixel.cpp

+ 1 - 0
android/jni/Pixel.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Pixel.h

+ 1 - 0
android/jni/Renderer.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Renderer.cpp

+ 1 - 0
android/jni/Renderer.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Renderer.h

+ 1 - 0
android/jni/Resource.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Resource.h

+ 1 - 0
android/jni/ResourceManager.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/ResourceManager.cpp

+ 1 - 0
android/jni/ResourceManager.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/ResourceManager.h

+ 1 - 0
android/jni/Skybox.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Skybox.cpp

+ 1 - 0
android/jni/Skybox.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Skybox.h

+ 1 - 0
android/jni/SpriteAnimator.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/SpriteAnimator.cpp

+ 1 - 0
android/jni/SpriteAnimator.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/SpriteAnimator.h

+ 1 - 0
android/jni/System.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/System.h

+ 1 - 0
android/jni/Terrain.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Terrain.cpp

+ 1 - 0
android/jni/Terrain.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Terrain.h

+ 1 - 0
android/jni/TextRenderer.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/TextRenderer.cpp

+ 1 - 0
android/jni/TextRenderer.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/TextRenderer.h

+ 1 - 0
android/jni/Texture.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/Texture.h

+ 1 - 0
android/jni/TextureManager.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/TextureManager.h

+ 1 - 0
android/jni/VertexBuffer.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/VertexBuffer.h

+ 1 - 0
android/jni/World.cpp

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/World.cpp

+ 1 - 0
android/jni/World.h

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/World.h

+ 1 - 0
android/jni/core

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/core

+ 1 - 0
android/jni/input

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/input

+ 1 - 0
android/jni/loaders

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/loaders

+ 1 - 0
android/jni/network

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/network

+ 1 - 0
android/jni/os

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/os

+ 1 - 0
android/jni/renderers

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/renderers

+ 1 - 0
android/jni/windowing

@@ -0,0 +1 @@
+/home/mikymod/Repositories/git/crown/src/windowing

+ 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=android-8

+ 13 - 0
android/res/layout/main.xml

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical"
+    android:layout_width="fill_parent"
+    android:layout_height="fill_parent"
+    >
+<TextView  
+    android:layout_width="fill_parent" 
+    android:layout_height="wrap_content" 
+    android:text="Hello World, CrownActivity"
+    />
+</LinearLayout>
+

+ 4 - 0
android/res/values/strings.xml

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">CrownActivity</string>
+</resources>

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

@@ -0,0 +1,15 @@
+package crown.android;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+public class CrownActivity extends Activity
+{
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState)
+    {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.main);
+    }
+}

+ 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)
 	{

+ 2 - 1
src/Log.h

@@ -26,6 +26,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #pragma once
 
 #include "Str.h"
+#include <cstdarg>
 
 namespace crown
 {
@@ -49,7 +50,7 @@ public:
 	static LogLevel		GetThreshold();
 	static void			SetThreshold(LogLevel threshold);
 
-	static void			LogMessage(LogLevel level, const char* message, va_list arg);
+	static void			LogMessage(LogLevel level, const char* message, ::va_list arg);
 
 	static void			D(const char* message, ...);
 	static void			E(const char* message, ...);

+ 81 - 36
src/network/AsyncConnection.cpp

@@ -11,14 +11,16 @@ AsyncConnection::AsyncConnection(Allocator& allocator) :
 	m_mode(NONE),
 	m_state(DISCONNECTED),
 	m_max_rate(MAX_RATE),
+	m_max_rtt(MAX_RTT),	//in milliseconds
+	m_rtt(0),
+	m_timeout(DEFAULT_TIMEOUT),
+	m_timeout_acc(0),
 	m_sent_packets(0),
 	m_recv_packets(0),
 	m_dropped_packets(0.0f),
 	m_local_sequence(0),
 	m_remote_sequence(0),
 	m_max_sequence(MAX_SEQUENCE),
-	m_max_rtt(MAX_RTT),	//in milliseconds
-	m_rtt(0),
 	m_sent_queue(allocator),
 	m_received_queue(allocator),
 	m_running(false),
@@ -94,6 +96,8 @@ void AsyncConnection::listen()
 //-----------------------------------------------------------------------------
 void AsyncConnection::connect(const os::NetAddress& addr)
 {
+	assert(m_running);
+	
   	_clear_data();
 
 	os::printf("client connecting to ");
@@ -135,22 +139,19 @@ os::NetAddress AsyncConnection::get_remote_address() const
 //-----------------------------------------------------------------------------
 int AsyncConnection::get_outgoing_rate() const
 {
+  
 }
 
 //-----------------------------------------------------------------------------
 int AsyncConnection::get_incoming_rate() const
 {
+  
 }
 
 //-----------------------------------------------------------------------------
-float AsyncConnection::get_incoming_packet_loss() const
+float AsyncConnection::get_packets_loss() const
 {
-	if (m_recv_packets == 0 && m_dropped_packets == 0)
-	{
-		return 0.0f;
-	}
-	// return loss packet %
-	return m_dropped_packets * 100 / (m_recv_packets + m_dropped_packets);
+	return m_dropped_packets;
 }
 
 //-----------------------------------------------------------------------------
@@ -158,6 +159,13 @@ uint16_t AsyncConnection::get_local_sequence() const
 {
 	return m_local_sequence;
 }
+
+//-----------------------------------------------------------------------------
+uint16_t AsyncConnection::get_remote_sequence() const
+{
+	return m_remote_sequence;
+}
+
 //-----------------------------------------------------------------------------
 void AsyncConnection::send_message(BitMessage& msg, const uint32_t time)
 {
@@ -172,6 +180,8 @@ void AsyncConnection::send_message(BitMessage& msg, const uint32_t time)
 	memcpy(data + 12, msg.get_data(), size - 12);
 	// send message
 	m_socket.send(m_remote_address, data, size);
+	
+	_packet_sent(msg.get_size());
 	// storage outgoing message
 	m_sent_queue.push_back(msg);
 }
@@ -202,17 +212,19 @@ int32_t AsyncConnection::receive_message(BitMessage& msg, const uint32_t time)
 	
 	msg.begin_writing();
 	msg.set_header(protocol_id, sequence, ack, ack_bits);
+	
 	//data-taking
  	uint8_t* tmp_ptr = &data[12];
 	memcpy(msg.get_data(), tmp_ptr, msg.get_max_size());
 	msg.set_size(size);
+	// sets BitMessage in read-only for processing
+	msg.begin_reading();
 	
+	_packet_received(sequence, msg.get_size());
+	_process_ack(ack, ack_bits);
  	// storage incoming message	
 	m_received_queue.push_back(msg);
 	
-	// sets BitMessage in read-only for processing
-	msg.begin_reading();
-	
 	// establish connection after first packet is received
 	if (m_mode == SERVER && !is_connected())
 	{
@@ -307,16 +319,16 @@ bool AsyncConnection::is_connect_fail() const
 
 //-----------------------------------------------------------------------------
 void AsyncConnection::_packet_sent(size_t size)
-{/*
+{
 	bool seq_exists_in_sent_queue = false;
 	bool seq_exists_in_pending_ack_queue = false;
   
 	PacketData tmp;
-	PacketData* h_ptr;
 	
 	tmp.sequence = m_local_sequence;
 
 	// If local_sequence_number exists
+	PacketData* h_ptr;
 	h_ptr = std::find(m_sent_packet.begin(), m_sent_packet.end(), tmp);
 	if (h_ptr != m_sent_packet.end())
 	{
@@ -346,15 +358,15 @@ void AsyncConnection::_packet_sent(size_t size)
 	// Increments local sequence
 	m_local_sequence++;
 
-	if (m_local_sequence > m_max_sequence)
+	if (m_local_sequence >= MAX_SEQUENCE)
 	{
 		m_local_sequence = 0;
-	}*/
+	}
 }
 
 //-----------------------------------------------------------------------------
 void AsyncConnection::_packet_received(uint16_t sequence, size_t size)
-{/*
+{
 	PacketData tmp;
 	PacketData* h_ptr;
 
@@ -380,7 +392,7 @@ void AsyncConnection::_packet_received(uint16_t sequence, size_t size)
 	if (_sequence_more_recent(sequence, m_remote_sequence))
 	{
 		m_remote_sequence = sequence;
-	}  */
+	}  
 }
 
 //-----------------------------------------------------------------------------
@@ -391,11 +403,13 @@ void AsyncConnection::_process_ack(uint16_t ack, int32_t ack_bits)
 		return;
 	}
 	
+	uint32_t index = 0;
+	
 	PacketData* i = m_pending_ack.begin();
-	while (i != m_pending_ack.end())
+	for(i = m_pending_ack.begin(), index = 0; i != m_pending_ack.end(); i++, index++)
 	{
 		bool acked = false;
-		
+
 		if (i->sequence == ack)
 		{
 			acked = true;
@@ -408,20 +422,15 @@ void AsyncConnection::_process_ack(uint16_t ack, int32_t ack_bits)
 				acked = (ack_bits >> bit_index) & 1;
 			}
 		}
-
+  
+		PacketData packet;
 		if (acked)
 		{
 			m_rtt += (i->time - m_rtt) * 0.1f;
-			
 			m_acked.push_back(*i);
+			m_pending_ack[index] = packet;
 		}
-		else
-		{
-			++i;
-		}
-	}  
-	
-	m_pending_ack.clear();
+	}
 }
 
 
@@ -473,22 +482,58 @@ int32_t AsyncConnection::_generate_ack_bits()
 }
 
 //-----------------------------------------------------------------------------
-void AsyncConnection::_update_outgoing_rate(const uint32_t time, const size_t size)
+void AsyncConnection::_update_packet_queues(uint32_t delta)
 {
+	PacketData* i;
+	
+	// updates queues time
+	for (i = m_sent_packet.begin(); i != m_sent_packet.end(); i++)
+	{
+		i->time += delta;
+	}
+	for (i = m_received_packet.begin(); i != m_received_packet.end(); i++)
+	{
+		i->time += delta;
+	}
+	for (i = m_pending_ack.begin(); i != m_pending_ack.end(); i++)
+	{
+		i->time += delta;
+	}
+	for (i = m_acked.begin(); i != m_acked.end(); i++)
+	{
+		i->time += delta;
+	}
+	
+	// cleans queues from old packets
+	/*
+	while (m_sent_packet.size() && m_sent_packet.front().time > MAX_RTT)
+	{
+		m_sent_packet.pop_front();
+	}
+	if (m_received_packet.size())
+	{
+		while()
+	}
+	while (m_acked.size() && m_acked.front().time > MAX_RTT * 2)
+	{
+		m_acked.pop_front();
+	}
+	while (m_pending_ack.size() && m_pending_ack.front().time > MAX_RTT)
+	{
+		m_pending_ack
+		m_dropped_packets++;
+	}*/
 
 }
 
 //-----------------------------------------------------------------------------
-void AsyncConnection::_update_incoming_rate(const uint32_t time, const size_t size)
+void AsyncConnection::_update_stats()
 {
- 
+  
 }
 
-//-----------------------------------------------------------------------------
-void AsyncConnection::_update_packet_loss(const uint32_t time, const uint32_t num_recv, const uint32_t num_dropped)
-{
-}
 
+//-----------------------------------------------------------------------------
 void AsyncConnection::_clear_data()
 {
 	m_state = DISCONNECTED;

+ 19 - 13
src/network/AsyncConnection.h

@@ -60,10 +60,10 @@ public:
 									// Returns the average incoming rate over the last second.
 	int32_t							get_incoming_rate() const;
 									// Returns the average incoming packet loss over the last 5 seconds.
-	real							get_incoming_packet_loss() const;
-									// return the current local sequence number
+	real							get_packets_loss() const;
+									// returns the current local sequence number
 	uint16_t						get_local_sequence() const;
-									// return the current remote sequence number
+									// returns the current remote sequence number
 	uint16_t						get_remote_sequence() const;
 									// Sends message
 	void							send_message(BitMessage& msg, const uint32_t time);
@@ -110,10 +110,11 @@ private:
 	bool							_sequence_more_recent(uint16_t s1, uint16_t s2);
 	int32_t							_bit_index_for_sequence(uint16_t seq, uint16_t ack);
 	int32_t							_generate_ack_bits();
+	void							_update_stats();
+	void							_update_packet_queues(uint32_t delta);
+// 	void							_insert_sorted_in_queue(PacketData* begin, PacketData* end);
 									// methods which provides a flow control system
-	void							_update_outgoing_rate(const uint32_t delta, const size_t size);
-	void							_update_incoming_rate(const uint32_t delta, const size_t size);
-	void							_update_packet_loss(const uint32_t delta, const uint32_t num_recv, const uint32_t num_dropped);
+
 	
 	void							_clear_data();
 
@@ -126,6 +127,10 @@ private:
 	Mode							m_mode;						// connection mode
 	State							m_state;					// connection state
 	uint32_t						m_max_rate;					// maximum number of bytes that may go out per second
+	real							m_max_rtt;					// Maximum round trip time
+	real							m_rtt;						// Round trip time
+	real							m_timeout;					// connection timeout value
+	real							m_timeout_acc;				// timeout accumulator
 
 									// variables to keep track of the incoming packet loss
 	uint32_t						m_sent_packets;		
@@ -136,13 +141,8 @@ private:
 	uint16_t						m_local_sequence;
 	uint16_t						m_remote_sequence;
 	uint16_t						m_max_sequence;
-	
-	real							m_max_rtt;					// Maximum round trip time
-	real							m_rtt;						// Round trip time
-	real							m_timeout;					// connection timeout value
-	real							m_timeout_acc;				// timeout accumulator
-	
-									// reliable message queues
+
+									// message queues
 	Queue<BitMessage>				m_sent_queue;
 	Queue<BitMessage>				m_received_queue;
 	
@@ -155,6 +155,12 @@ private:
 	Queue<PacketData>				m_pending_ack;					// Pending acknokledges queue
 	Queue<PacketData>				m_acked;						// Acknowledges queue
 	
+									// statistic variables
+	real							m_sent_bytes_per_sec;
+	real							m_acked_bytes_per_sec;
+	real							m_sent_bandwidth;
+	real							m_acked_bandwidth;
+	
 	Allocator*						m_allocator;					// dynamic allocator
 									
 									// constants

+ 1 - 1
src/network/BitMessage.cpp

@@ -65,7 +65,7 @@ uint8_t* BitMessage::get_byte_space(int32_t len)
 
 bool BitMessage::check_overflow(int32_t num_bits)
 {
-	assert( num_bits >= 0 );
+	assert(num_bits >= 0);
 	
 	if (num_bits > get_remaining_write_bits()) 
 	{

+ 1 - 0
src/os/OS.h

@@ -28,6 +28,7 @@ OTHER DEALINGS IN THE SOFTWARE.
 #include "Config.h"
 #include "Str.h"
 #include "List.h"
+#include <cstdarg>
 #include "Types.h"
 
 namespace crown