Merge branch 'develop'
1
.gitignore
vendored
@@ -19,6 +19,7 @@ local.properties
|
|||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
project.properties
|
project.properties
|
||||||
|
libs/
|
||||||
|
|
||||||
# Proguard folder generated by Eclipse
|
# Proguard folder generated by Eclipse
|
||||||
proguard/
|
proguard/
|
||||||
|
@@ -14,6 +14,7 @@
|
|||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
-->
|
-->
|
||||||
|
<!-- android:screenOrientation="portrait" -->
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="ve.ucv.ciens.ccg.nxtar"
|
package="ve.ucv.ciens.ccg.nxtar"
|
||||||
android:versionCode="1"
|
android:versionCode="1"
|
||||||
@@ -37,7 +38,6 @@
|
|||||||
<activity
|
<activity
|
||||||
android:name=".MainActivity"
|
android:name=".MainActivity"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:screenOrientation="landscape"
|
|
||||||
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
BIN
assets/data/fonts/d-puntillas-B-to-tiptoe.ttf
Normal file
BIN
assets/data/gfx/gui/Anonymous_Button_Green.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
assets/data/gfx/gui/Anonymous_Button_Red.png
Normal file
After Width: | Height: | Size: 14 KiB |
BIN
assets/data/gfx/gui/Anonymous_Pill_Button_Blue.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/data/gfx/gui/Anonymous_Pill_Button_Cyan.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/data/gfx/gui/Anonymous_Pill_Button_Yellow.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
assets/data/gfx/gui/OUYA_O.png
Normal file
After Width: | Height: | Size: 3.5 KiB |
BIN
assets/data/gfx/gui/PBCrichton_Flat_Button.png
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
assets/data/gfx/gui/orange_glowy_button.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
assets/data/gfx/textures/tile_aqua.png
Normal file
After Width: | Height: | Size: 11 KiB |
12
assets/shaders/bckg/bckg.frag
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform sampler2D u_texture;
|
||||||
|
uniform vec2 u_scaling;
|
||||||
|
|
||||||
|
varying vec2 v_texCoords;
|
||||||
|
|
||||||
|
void main(){
|
||||||
|
gl_FragColor = texture2D(u_texture, v_texCoords * u_scaling);
|
||||||
|
}
|
11
assets/shaders/bckg/bckg.vert
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
uniform mat4 u_projTrans;
|
||||||
|
|
||||||
|
attribute vec4 a_position;
|
||||||
|
attribute vec2 a_texCoord0;
|
||||||
|
|
||||||
|
varying vec2 v_texCoords;
|
||||||
|
|
||||||
|
void main(){
|
||||||
|
v_texCoords = a_texCoord0;
|
||||||
|
gl_Position = u_projTrans * a_position;
|
||||||
|
}
|
@@ -9,3 +9,4 @@
|
|||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-19
|
target=android-19
|
||||||
|
android.library.reference.1=../../../../../Documents/OpenCV-2.4.8-android-sdk/sdk/java
|
||||||
|
21
res/values-es/strings.xml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
* Copyright (C) 2013 Miguel Angel Astor Romero
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<string name="app_name">NxtAR</string>
|
||||||
|
<string name="ocv_failed">No se pudo inicializar OpenCV</string>
|
||||||
|
<string name="ocv_success">OpenCV inicializado con exito</string>
|
||||||
|
</resources>
|
@@ -16,4 +16,6 @@
|
|||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name">NxtAR</string>
|
<string name="app_name">NxtAR</string>
|
||||||
|
<string name="ocv_failed">Failed to initialize OpenCV</string>
|
||||||
|
<string name="ocv_success">OpenCV initialized successfully</string>
|
||||||
</resources>
|
</resources>
|
@@ -15,9 +15,16 @@
|
|||||||
*/
|
*/
|
||||||
package ve.ucv.ciens.ccg.nxtar;
|
package ve.ucv.ciens.ccg.nxtar;
|
||||||
|
|
||||||
|
import org.opencv.android.BaseLoaderCallback;
|
||||||
|
import org.opencv.android.CameraBridgeViewBase.CvCameraViewListener;
|
||||||
|
import org.opencv.android.LoaderCallbackInterface;
|
||||||
|
import org.opencv.android.OpenCVLoader;
|
||||||
|
import org.opencv.core.Mat;
|
||||||
|
|
||||||
import ve.ucv.ciens.ccg.nxtar.interfaces.MulticastEnabler;
|
import ve.ucv.ciens.ccg.nxtar.interfaces.MulticastEnabler;
|
||||||
import ve.ucv.ciens.ccg.nxtar.interfaces.Toaster;
|
import ve.ucv.ciens.ccg.nxtar.interfaces.Toaster;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.pm.ActivityInfo;
|
||||||
import android.net.wifi.WifiManager;
|
import android.net.wifi.WifiManager;
|
||||||
import android.net.wifi.WifiManager.MulticastLock;
|
import android.net.wifi.WifiManager.MulticastLock;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
@@ -27,8 +34,9 @@ import android.widget.Toast;
|
|||||||
import com.badlogic.gdx.Gdx;
|
import com.badlogic.gdx.Gdx;
|
||||||
import com.badlogic.gdx.backends.android.AndroidApplication;
|
import com.badlogic.gdx.backends.android.AndroidApplication;
|
||||||
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
import com.badlogic.gdx.backends.android.AndroidApplicationConfiguration;
|
||||||
|
import com.badlogic.gdx.controllers.mappings.Ouya;
|
||||||
|
|
||||||
public class MainActivity extends AndroidApplication implements Toaster, MulticastEnabler{
|
public class MainActivity extends AndroidApplication implements Toaster, MulticastEnabler, CvCameraViewListener{
|
||||||
private static final String TAG = "NXTAR_ANDROID_MAIN";
|
private static final String TAG = "NXTAR_ANDROID_MAIN";
|
||||||
private static final String CLASS_NAME = MainActivity.class.getSimpleName();
|
private static final String CLASS_NAME = MainActivity.class.getSimpleName();
|
||||||
|
|
||||||
@@ -36,18 +44,53 @@ public class MainActivity extends AndroidApplication implements Toaster, Multica
|
|||||||
private MulticastLock multicastLock;
|
private MulticastLock multicastLock;
|
||||||
private Handler uiHandler;
|
private Handler uiHandler;
|
||||||
private Context uiContext;
|
private Context uiContext;
|
||||||
|
private boolean ocvOn;
|
||||||
|
private BaseLoaderCallback loaderCallback;
|
||||||
|
|
||||||
|
/*static{
|
||||||
|
if (!OpenCVLoader.initDebug()){
|
||||||
|
Gdx.app.exit();
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState){
|
public void onCreate(Bundle savedInstanceState){
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
ocvOn = false;
|
||||||
|
|
||||||
|
if(!Ouya.runningOnOuya){
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
|
}else{
|
||||||
|
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
|
||||||
|
}
|
||||||
|
|
||||||
uiHandler = new Handler();
|
uiHandler = new Handler();
|
||||||
uiContext = this;
|
uiContext = this;
|
||||||
wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
|
wifiManager = (WifiManager)getSystemService(Context.WIFI_SERVICE);
|
||||||
|
|
||||||
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
|
||||||
cfg.useGL20 = false;
|
cfg.useGL20 = true;
|
||||||
|
cfg.useAccelerometer = false;
|
||||||
|
cfg.useCompass = false;
|
||||||
|
cfg.useWakelock = true;
|
||||||
|
|
||||||
|
loaderCallback = new BaseLoaderCallback(this){
|
||||||
|
@Override
|
||||||
|
public void onManagerConnected(int status){
|
||||||
|
switch(status){
|
||||||
|
case LoaderCallbackInterface.SUCCESS:
|
||||||
|
ocvOn = true;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Toast.makeText(uiContext, R.string.ocv_failed, Toast.LENGTH_LONG).show();
|
||||||
|
Gdx.app.exit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
OpenCVLoader.initAsync(OpenCVLoader.OPENCV_VERSION_2_4_7, this, loaderCallback);
|
||||||
initialize(new NxtARCore(this), cfg);
|
initialize(new NxtARCore(this), cfg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +122,7 @@ public class MainActivity extends AndroidApplication implements Toaster, Multica
|
|||||||
/////////////////////////////////////////
|
/////////////////////////////////////////
|
||||||
@Override
|
@Override
|
||||||
public void enableMulticast(){
|
public void enableMulticast(){
|
||||||
Gdx.app.debug(TAG, CLASS_NAME + ".enableMulticast() :: Requesting multicast lock.");
|
Gdx.app.log(TAG, CLASS_NAME + ".enableMulticast() :: Requesting multicast lock.");
|
||||||
multicastLock = wifiManager.createMulticastLock(TAG);
|
multicastLock = wifiManager.createMulticastLock(TAG);
|
||||||
multicastLock.setReferenceCounted(true);
|
multicastLock.setReferenceCounted(true);
|
||||||
multicastLock.acquire();
|
multicastLock.acquire();
|
||||||
@@ -87,10 +130,33 @@ public class MainActivity extends AndroidApplication implements Toaster, Multica
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disableMulticast(){
|
public void disableMulticast(){
|
||||||
Gdx.app.debug(TAG, CLASS_NAME + ".disableMulticast() :: Releasing multicast lock.");
|
Gdx.app.log(TAG, CLASS_NAME + ".disableMulticast() :: Releasing multicast lock.");
|
||||||
if(multicastLock != null){
|
if(multicastLock != null){
|
||||||
multicastLock.release();
|
multicastLock.release();
|
||||||
multicastLock = null;
|
multicastLock = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
// CvCameraViewListener interface methods. //
|
||||||
|
/////////////////////////////////////////////
|
||||||
|
/**
|
||||||
|
* <p>This method does nothing. It is here because it must be implemented in order to use OpenCV.</p>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onCameraViewStarted(int width, int height){ }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>This method does nothing. It is here because it must be implemented in order to use OpenCV.</p>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void onCameraViewStopped(){ }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>This method does nothing. It is here because it must be implemented in order to use OpenCV.</p>
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Mat onCameraFrame(Mat inputFrame){
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|