aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosh Kropf <josh@slashdev.ca>2011-04-23 03:13:57 (GMT)
committerJosh Kropf <josh@slashdev.ca>2011-04-23 03:13:57 (GMT)
commitfcdd6af406593f8d62d0969d85fcf1409141ef77 (patch)
treed451bbfb09565357c0b1f8c9e3d24cc3304649d7
parentd472a10282b73b1c9df420e3d11d62978001ed6e (diff)
downloadballdemo-fcdd6af406593f8d62d0969d85fcf1409141ef77.zip
balldemo-fcdd6af406593f8d62d0969d85fcf1409141ef77.tar.gz
balldemo-fcdd6af406593f8d62d0969d85fcf1409141ef77.tar.bz2
added license block to source in iOS project
-rw-r--r--android/jni/main.cpp20
-rw-r--r--ios/Classes/BallDemoAppDelegate.h16
-rw-r--r--ios/Classes/BallDemoAppDelegate.m16
-rw-r--r--ios/Classes/BallDemoViewController.h16
-rw-r--r--ios/Classes/BallDemoViewController.mm26
-rw-r--r--ios/Classes/EAGLView.h16
-rw-r--r--ios/Classes/EAGLView.m17
-rw-r--r--ios/common.mm22
-rw-r--r--ios/main.m16
9 files changed, 97 insertions, 68 deletions
diff --git a/android/jni/main.cpp b/android/jni/main.cpp
index 5565fac..d51a052 100644
--- a/android/jni/main.cpp
+++ b/android/jni/main.cpp
@@ -1,3 +1,11 @@
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
+ */
#include <jni.h>
#include <android/log.h>
@@ -9,11 +17,15 @@
#define LOG_TAG "balldemo"
+// pointer to JNI interface and BallDemo activity instance
JNIEnv *g_env;
jobject g_activity;
stage *g_stage = NULL;
+///
+/// Implementation of the logv() function that calls __android_log_vprint().
+///
void logv(log_level_t level, const char *fmt, va_list args) {
android_LogPriority l;
switch (level) {
@@ -26,6 +38,11 @@ void logv(log_level_t level, const char *fmt, va_list args) {
__android_log_vprint(l, LOG_TAG, fmt, args);
}
+///
+/// Implementation of the loadAsset() function that calls back into Java
+/// to use Android's asset loading API. This function requires that the
+/// global pointers g_env and g_activity are valid.
+///
asset_t * loadAsset(const char * path) {
jstring file = g_env->NewStringUTF(path);
@@ -48,6 +65,7 @@ asset_t * loadAsset(const char * path) {
return NULL;
}
+/// Delete assets data then the asset struct.
void freeAsset(asset_t * asset) {
delete asset->data;
delete asset;
@@ -81,6 +99,8 @@ JNIEXPORT void
JNICALL Java_com_jiggak_balldemo_BallDemo_setupGL
(JNIEnv* env, jobject obj)
{
+ // stage::setupGL() will call loadAsset() so we need to make sure the global
+ // pointer to the BallDemo activity and JNI interface are valid
g_activity = obj;
g_env = env;
diff --git a/ios/Classes/BallDemoAppDelegate.h b/ios/Classes/BallDemoAppDelegate.h
index 82f5672..94fc35b 100644
--- a/ios/Classes/BallDemoAppDelegate.h
+++ b/ios/Classes/BallDemoAppDelegate.h
@@ -1,11 +1,11 @@
-//
-// BallDemoAppDelegate.h
-// BallDemo
-//
-// Created by Josh Kropf on 11-04-09.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
-//
-
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
+ */
#import <UIKit/UIKit.h>
@class BallDemoViewController;
diff --git a/ios/Classes/BallDemoAppDelegate.m b/ios/Classes/BallDemoAppDelegate.m
index fe31340..825d8f4 100644
--- a/ios/Classes/BallDemoAppDelegate.m
+++ b/ios/Classes/BallDemoAppDelegate.m
@@ -1,11 +1,11 @@
-//
-// BallDemoAppDelegate.m
-// BallDemo
-//
-// Created by Josh Kropf on 11-04-09.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
-//
-
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
+ */
#import "BallDemoAppDelegate.h"
#import "BallDemoViewController.h"
diff --git a/ios/Classes/BallDemoViewController.h b/ios/Classes/BallDemoViewController.h
index 4908070..2af114c 100644
--- a/ios/Classes/BallDemoViewController.h
+++ b/ios/Classes/BallDemoViewController.h
@@ -1,11 +1,11 @@
-//
-// BallDemoViewController.h
-// BallDemo
-//
-// Created by Josh Kropf on 11-04-09.
-// Copyright 2011 slashdev.ca. All rights reserved.
-//
-
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
+ */
#import <UIKit/UIKit.h>
#import <OpenGLES/EAGL.h>
diff --git a/ios/Classes/BallDemoViewController.mm b/ios/Classes/BallDemoViewController.mm
index e9e449f..483373e 100644
--- a/ios/Classes/BallDemoViewController.mm
+++ b/ios/Classes/BallDemoViewController.mm
@@ -1,11 +1,11 @@
-//
-// BallDemoViewController.m
-// BallDemo
-//
-// Created by Josh Kropf on 11-04-09.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
-//
-
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
+ */
#import <QuartzCore/QuartzCore.h>
#import "BallDemoViewController.h"
@@ -127,10 +127,12 @@
- (void)setAnimationFrameInterval:(NSInteger)frameInterval
{
- /*
- Frame interval defines how many display frames must pass between each time the display link fires.
- The display link will only fire 30 times a second when the frame internal is two on a display that refreshes 60 times a second. The default frame interval setting of one will fire 60 times a second when the display refreshes at 60 times a second. A frame interval setting of less than one results in undefined behavior.
- */
+ // Frame interval defines how many display frames must pass between each
+ // time the display link fires. The display link will only fire 30 times
+ // a second when the frame internal is two on a display that refreshes
+ // 60 times a second. The default frame interval setting of one will
+ // fire 60 times a second when the display refreshes at 60 times a second.
+ // A frame interval setting of less than one results in undefined behavior.
if (frameInterval >= 1) {
animationFrameInterval = frameInterval;
diff --git a/ios/Classes/EAGLView.h b/ios/Classes/EAGLView.h
index 0083dd6..64ab752 100644
--- a/ios/Classes/EAGLView.h
+++ b/ios/Classes/EAGLView.h
@@ -1,11 +1,11 @@
-//
-// EAGLView.h
-// BallDemo
-//
-// Created by Josh Kropf on 11-04-09.
-// Copyright 2011 slashdev.ca. All rights reserved.
-//
-
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
+ */
#import <UIKit/UIKit.h>
#import <OpenGLES/ES2/gl.h>
diff --git a/ios/Classes/EAGLView.m b/ios/Classes/EAGLView.m
index 76f3730..06a8015 100644
--- a/ios/Classes/EAGLView.m
+++ b/ios/Classes/EAGLView.m
@@ -1,11 +1,11 @@
-//
-// EAGLView.m
-// BallDemo
-//
-// Created by Josh Kropf on 11-04-09.
-// Copyright 2011 slashdev.ca. All rights reserved.
-//
-
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
+ */
#import <QuartzCore/QuartzCore.h>
#import "EAGLView.h"
@@ -20,7 +20,6 @@
@dynamic context;
@synthesize framebufferWidth, framebufferHeight;
-// You must implement this method
+ (Class)layerClass
{
return [CAEAGLLayer class];
diff --git a/ios/common.mm b/ios/common.mm
index 18291dc..c64209b 100644
--- a/ios/common.mm
+++ b/ios/common.mm
@@ -1,16 +1,19 @@
/*
- * common.mm
- * BallDemo
- *
- * Created by Josh Kropf on 11-04-09.
- * Copyright 2011 slashdev.ca. All rights reserved.
- *
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
*/
-
#import <Foundation/Foundation.h>
#include "logging.h"
#include "assets.h"
+///
+/// Implementation of the logv() function that calls NSLog(). Since NSLog
+/// doesn't have severity level output is prefixed with "ERROR" or "INFO".
+///
void logv(log_level_t level, const char *cfmt, va_list args) {
NSString *prefix;
switch (level) {
@@ -24,6 +27,10 @@ void logv(log_level_t level, const char *cfmt, va_list args) {
NSLogv([prefix stringByAppendingString:fmt], args);
}
+///
+/// Implementation of the loadAsset() function that opens and reads files
+/// inside the application bundle.
+///
asset_t * loadAsset(const char * cpath) {
logInfo("loadAsset(%s)", cpath);
@@ -50,6 +57,7 @@ asset_t * loadAsset(const char * cpath) {
return asset;
}
+/// Delete assets data then the asset struct.
void freeAsset(asset_t * asset) {
delete asset->data;
delete asset;
diff --git a/ios/main.m b/ios/main.m
index c3855af..7cb1b09 100644
--- a/ios/main.m
+++ b/ios/main.m
@@ -1,11 +1,11 @@
-//
-// main.m
-// BallDemo
-//
-// Created by Josh Kropf on 11-04-09.
-// Copyright 2011 __MyCompanyName__. All rights reserved.
-//
-
+/*
+ * ----------------------------------------------------------------------------
+ * "THE BEER-WARE LICENSE" (Revision 42):
+ * <josh@slashdev.ca> wrote this file. As long as you retain this notice you
+ * can do whatever you want with this stuff. If we meet some day, and you think
+ * this stuff is worth it, you can buy me a beer in return Josh Kropf
+ * ----------------------------------------------------------------------------
+ */
#import <UIKit/UIKit.h>
int main(int argc, char *argv[]) {