Commits

Christian Fischer committed aef537f

moved sample code into seperate repository

  • Participants
  • Parent commits e211de2

Comments (0)

Files changed (15)

samples/HelloWiesel/CMakeLists.txt

-# makefile for the current project
-
-# ensure a correct version of cmake is installed
-cmake_minimum_required(VERSION 2.8)
-
-# compatibility
-set(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required
-
-
-# set the project name
-project(HelloWiesel)
-
-
-# in this case, the engine folder is in the same repository,
-# so we always know the correct location.
-# when the engine location is different on various build environments,
-# you may put the definition of WIESEL_DIR into a separate file under 
-# config/local, where it is not committed into version control.
-set(WIESEL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../..)
-
-# include the main build file of the engine
-include(${WIESEL_DIR}/build/build.cmake)
-
-
-
-wiesel_create_executable(HelloWiesel ./src)
-
-# optional libraries
-# wiesel_module_add_dependency(HelloWiesel wiesel-net)
-
-# default setup for the project
-include(wiesel-default-setup)
-wiesel_default_project_setup(HelloWiesel)

samples/HelloWiesel/android/AndroidManifest.xml

-<?xml version="1.0" encoding="utf-8"?>
-<manifest
-	xmlns:android="http://schemas.android.com/apk/res/android"
-	package="wiesel.android.sample1"
-	android:versionCode="1"
-	android:versionName="1.0"
->
-	<!-- Android 2.3.4 required -->
-	<uses-sdk android:minSdkVersion="10" />
-	
-	<!-- Tell the system this app requires OpenGL ES 2.0. -->
-	<uses-feature android:glEsVersion="0x00020000" android:required="true" />
-
-	<application
-			android:icon="@drawable/ic_launcher"
-			android:label="@string/app_name"
-			android:hasCode="false" 
-	>
-		<activity
-		    	android:name="android.app.NativeActivity"
-    			android:label="@string/app_name"
-    			android:configChanges="orientation|keyboardHidden"
-    	>
-			<!-- Tell NativeActivity the name of or .so -->
-			<meta-data
-					android:name="android.app.lib_name"
-					android:value="main" />
-			<intent-filter>
-				<action android:name="android.intent.action.MAIN" />
-				<category android:name="android.intent.category.LAUNCHER" />
-			</intent-filter>
-		</activity>
-	</application>
-	
-	<application
-		android:icon="@drawable/ic_launcher"
-		android:label="@string/app_name"
-	>
-	</application>
-
-</manifest>

samples/HelloWiesel/android/build.xml

-<?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" />
-
-    <!-- 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 an env var"
-            unless="sdk.dir"
-    />
-
-
-<!-- extension targets. Uncomment the ones where you want to do custom work
-     in between standard targets -->
-<!--
-    <target name="-pre-build">
-    </target>
-    <target name="-pre-compile">
-    </target>
-
-    /* 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} */
-    <target name="-post-compile">
-    </target>
--->
-
-    <!-- check if wiesel.dir exists -->
-    <fail
-            message="wiesel.dir is missing. Add the path to the wiesel home directory to your local.properties"
-            unless="wiesel.dir"
-    />
-    <!-- Import the wiesel build-support file for extra build-targets -->
-	<import file="${wiesel.dir}/build/android/build-support.xml" />
-
-    <!-- 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>

samples/HelloWiesel/android/jni/Android.mk

-# HelloWiesel
-
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-# add the path to the libraries into search path
-WIESEL_PATH := $(LOCAL_PATH)/../$(WIESEL_DIR)/libraries/android-native
-WIESEL_SRC_PATH := $(WIESEL_PATH)/../../src
-$(call import-add-path,$(WIESEL_PATH))
-
-# define the source folders of this project
-MY_LOCAL_FOLDERS := \
-				$(LOCAL_PATH)									\
-				$(LOCAL_PATH)/../../src							\
-				
-
-MY_SUBFOLDERS := \
-				$(foreach dir,$(MY_LOCAL_FOLDERS),$(shell /usr/bin/find $(dir) -type d -print))
-
-MY_FILES := \
-				$(subst $(LOCAL_PATH), ,$(foreach dir,$(MY_SUBFOLDERS),$(wildcard $(dir)/*.cpp)))
-
-
-# configure the application's build
-LOCAL_MODULE                  := main
-LOCAL_SRC_FILES               := $(MY_FILES)
-LOCAL_C_INCLUDES              := $(MY_LOCAL_FOLDERS)
-LOCAL_LDLIBS                  :=
-LOCAL_STATIC_LIBRARIES        := wiesel-common wiesel-core
-LOCAL_WHOLE_STATIC_LIBRARIES  := wiesel-android wiesel-opengl
-
-# optional libraries
-# LOCAL_STATIC_LIBRARIES        += wiesel-net
-
-# build the shared library
-include $(BUILD_SHARED_LIBRARY)
-
-# import all required modules
-$(call import-module,wiesel-android)
-$(call import-module,wiesel-opengl)
-$(call import-module,wiesel-base)
-$(call import-module,wiesel-core)
-$(call import-module,wiesel-common)
-$(call import-module,wiesel-net)

samples/HelloWiesel/android/jni/Application.mk

-# Build both ARMv5TE and ARMv7-A and x86 machine code.
-APP_PLATFORM := android-10
-#APP_ABI := armeabi armeabi-v7a x86
-APP_CPPFLAGS += -frtti
-APP_STL := gnustl_static
-APP_DEBUG := true

samples/HelloWiesel/android/jni/module_registry.cpp

-
-#include "wiesel/resources/graphics/image_loader_libpng.loadable_module"
-#include "wiesel/util/libxml_sax_parser.loadable_module"
-#include "wiesel/generic_platform.loadable_module"
-
-#include "wiesel/android/util/log_writer_android.loadable_module"
-#include "wiesel/android/video/android_video_loader.loadable_module"
-#include "wiesel/android/android_platform.loadable_module"
-
-// various optional libraries
-// #include "wiesel/io/net/socket_connection.loadable_module"

samples/HelloWiesel/android/proguard.cfg

--optimizationpasses 5
--dontusemixedcaseclassnames
--dontskipnonpubliclibraryclasses
--dontpreverify
--verbose
--optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
-
--keep public class * extends android.app.Activity
--keep public class * extends android.app.Application
--keep public class * extends android.app.Service
--keep public class * extends android.content.BroadcastReceiver
--keep public class * extends android.content.ContentProvider
--keep public class * extends android.app.backup.BackupAgentHelper
--keep public class * extends android.preference.Preference
--keep public class com.android.vending.licensing.ILicensingService
-
--keepclasseswithmembernames class * {
-    native <methods>;
-}
-
--keepclasseswithmembers class * {
-    public <init>(android.content.Context, android.util.AttributeSet);
-}
-
--keepclasseswithmembers class * {
-    public <init>(android.content.Context, android.util.AttributeSet, int);
-}
-
--keepclassmembers class * extends android.app.Activity {
-   public void *(android.view.View);
-}
-
--keepclassmembers enum * {
-    public static **[] values();
-    public static ** valueOf(java.lang.String);
-}
-
--keep class * implements android.os.Parcelable {
-  public static final android.os.Parcelable$Creator *;
-}

samples/HelloWiesel/android/project.properties

-# 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 use,
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-
-# Project target.
-target=android-10

samples/HelloWiesel/android/res/drawable-hdpi/ic_launcher.png

Removed
Old image

samples/HelloWiesel/android/res/drawable-ldpi/ic_launcher.png

Removed
Old image

samples/HelloWiesel/android/res/drawable-mdpi/ic_launcher.png

Removed
Old image

samples/HelloWiesel/android/res/values/strings.xml

-<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<resources>
-    <string name="app_name">HelloWiesel</string>
-</resources>

samples/HelloWiesel/resources/common/images/font.png

Removed
Old image

samples/HelloWiesel/resources/common/images/wiesel.png

Removed
Old image

samples/HelloWiesel/src/HelloWiesel.cpp

-/**
- * Copyright (C) 2012
- * Christian Fischer
- *
- * https://bitbucket.org/baldur/wiesel/
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 3 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, write to the
- * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-#include <wiesel/application_main.h>
-#include <wiesel/graph/2d/sprite_node.h>
-#include <wiesel/io/filesystem.h>
-#include <wiesel/math/matrix.h>
-#include <wiesel/resources/graphics/spritesheet.h>
-#include <wiesel/ui/bitmapfont.h>
-#include <wiesel/ui/label_node.h>
-#include <wiesel/video/render_context.h>
-#include <wiesel/video/screen.h>
-#include <wiesel/video/shader.h>
-#include <wiesel/video/texture.h>
-#include <wiesel/video/vertexbuffer.h>
-#include <wiesel/video/video_driver.h>
-#include <wiesel.h>
-
-using namespace wiesel;
-using namespace wiesel::video;
-using namespace std;
-
-
-class HelloWiesel
-: public wiesel::Application
-{
-public:
-	HelloWiesel() {}
-	virtual ~HelloWiesel() {}
-
-public:
-	virtual bool onInit() {
-		Log::info << "start application HelloWiesel" << std::endl;
-
-		// at first, we create our screen object
-		screen = keep(new Screen());
-
-		// the screen needs to be initialized
-		screen->loadVideoDevice(dimension(640, 480), 0);
-		
-		// successful?
-		assert(screen->getVideoDeviceDriver());
-		if (!screen->getVideoDeviceDriver()) {
-			return false;
-		}
-
-		// print video information
-		Log::info << *(screen->getVideoDeviceDriver()->getVideoInfo()) << std::endl;
-
-		// get the screen centre
-		const dimension &screen_size = screen->getVideoDeviceDriver()->getResolution();
-		float center_x = screen_size.width  / 2;
-		float center_y = screen_size.height / 2;
-		float size     = min(screen_size.width, screen_size.height);
-
-		// note: we're loading this image from SDcard, it's currently not part of this sample application
-		File *tex_file = Engine::getInstance()->getAssetFileSystem()->findFile("/images/wiesel.png");
-		if (tex_file) {
-			Log::info << "load texture from: " << tex_file->getFullPath() << std::endl;
-			texture = keep(Texture::fromFile(tex_file));
-			texture->loadContentFrom(screen);
-		}
-		else {
-			Log::info << "texture not found" << endl;
-			texture = NULL;
-		}
-
-		sprite = keep(new SpriteNode(texture));
-		sprite->setPosition(center_x, center_y);
-		sprite->setScale(size / sprite->getContentSize().getMin());
-
-		// load the bitmap font
-		File*			font_file		= Engine::getInstance()->getAssetFileSystem()->findFile("/images/font.png");
-		Texture*		font_texture	= Texture::fromFile(font_file);
-		SpriteSheet*	font_ss			= new SpriteSheet(font_texture);
-
-		// prepare the texture
-		font_texture->loadContentFrom(screen);
-
-		// configure the font
-		font_ss->createRasterFrames(16, 8,  0, 26, 'A');
-		font_ss->createRasterFrames(16, 8, 32, 26, 'a');
-		font_ss->createRasterFrames(16, 8, 97, 31, '!');
-		BitmapFont *font = new BitmapFont(font_ss);
-
-		label = keep(new LabelNode());
-		label->setFont(font);
-		label->setText("Hello Wiesel");
-		label->setPosition(center_x, 0.0f);
-		label->setPivot(0.5f, 0.0f);
-		label->setScale(screen_size.width / label->getContentSize().width * 0.95f);
-
-		Scene *scene = keep(new Scene());
-		scene->addChild(sprite);
-		scene->addChild(label);
-		pushScene(scene);
-
-		return true;
-	}
-
-
-	virtual void onRun(float dt) {
-		Application::onRun(dt);
-
-		switch(screen->getState()) {
-			case Video_Uninitialized: {
-				// do nothing
-				break;
-			}
-
-			case Video_Suspended: {
-				// do nothing
-				break;
-			}
-
-			case Video_Background:
-			case Video_Active: {
-				if (screen && screen->getVideoDeviceDriver()) {
-					screen->getVideoDeviceDriver()->preRender();
-					this->onRender(screen->getVideoDeviceDriver()->getCurrentRenderContext());
-					screen->getVideoDeviceDriver()->postRender();
-				}
-
-				break;
-			}
-		}
-
-		return;
-	}
-
-
-	virtual void onRender(RenderContext *render_context) {
-		Application::onRender(render_context);
-		return;
-	}
-
-
-	virtual void onShutdown() {
-		safe_release(texture);
-		safe_release(sprite);
-		safe_release(label);
-
-		safe_release(screen);
-
-		return;
-	}
-
-private:
-	Screen*			screen;
-
-	Texture*		texture;
-
-	SpriteNode*		sprite;
-	LabelNode*		label;
-};
-
-
-
-// define the application entry point
-WIESEL_APPLICATION_SETUP( HelloWiesel );
-
-