mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-24 06:12:52 -06:00
Added Android builder juicy example
git-svn-id: svn://ultimatepp.org/upp/trunk@8640 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
20ee1a9a47
commit
99222001cf
15 changed files with 439 additions and 0 deletions
13
examples/AndroidMathUtility/AndroidMathUtility.cpp
Normal file
13
examples/AndroidMathUtility/AndroidMathUtility.cpp
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#include "AndroidMathUtility.h"
|
||||
|
||||
namespace AndroidMathUtility {
|
||||
|
||||
int Power(int number, int n) {
|
||||
int result = number;
|
||||
for(int i = 0; i < n - 1; i++) {
|
||||
result *= number;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
13
examples/AndroidMathUtility/AndroidMathUtility.h
Normal file
13
examples/AndroidMathUtility/AndroidMathUtility.h
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef _AndroidMathUtility_AndroidMathUtiliy_h
|
||||
#define _AndroidMathUtility_AndroidMathUtiliy_h
|
||||
|
||||
#include "Vector.h"
|
||||
|
||||
namespace AndroidMathUtility {
|
||||
|
||||
int Power(int number, int n);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
8
examples/AndroidMathUtility/AndroidMathUtility.upp
Normal file
8
examples/AndroidMathUtility/AndroidMathUtility.upp
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
description "Supportive package for AndroidMath\377";
|
||||
|
||||
file
|
||||
AndroidMathUtility.h,
|
||||
AndroidMathUtility.cpp,
|
||||
Vector.h,
|
||||
Vector.cpp;
|
||||
|
||||
51
examples/AndroidMathUtility/Vector.cpp
Normal file
51
examples/AndroidMathUtility/Vector.cpp
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
#include <sstream>
|
||||
|
||||
#include "AndroidMathUtility.h"
|
||||
|
||||
namespace AndroidMathUtility {
|
||||
|
||||
Vector::Vector()
|
||||
{
|
||||
this->size = 0;
|
||||
}
|
||||
|
||||
Vector::Vector(int size)
|
||||
{
|
||||
data = new float[size];
|
||||
for(int i = 0; i < size; i++) {
|
||||
data[i] = 0.0f;
|
||||
}
|
||||
this->size = size;
|
||||
}
|
||||
|
||||
Vector::Vector(const Vector& vec)
|
||||
{
|
||||
if(vec.GetSize() > 0) {
|
||||
size = vec.GetSize();
|
||||
data = new float[size];
|
||||
for(int i = 0; i < size; i++) {
|
||||
data[i] = vec.data[i];
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Vector::~Vector()
|
||||
{
|
||||
delete[] data;
|
||||
}
|
||||
|
||||
std::string Vector::ToString() const
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << "[";
|
||||
for(int i = 0; i < size; i++) {
|
||||
ss << data[i];
|
||||
if(i + 1 < size)
|
||||
ss << ", ";
|
||||
}
|
||||
ss << "]";
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
}
|
||||
26
examples/AndroidMathUtility/Vector.h
Normal file
26
examples/AndroidMathUtility/Vector.h
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#ifndef _AndroidMathUtility_Vector_h_
|
||||
#define _AndroidMathUtility_Vector_h_
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace AndroidMathUtility {
|
||||
|
||||
class Vector {
|
||||
public:
|
||||
Vector();
|
||||
Vector(int size);
|
||||
Vector(const Vector& vec);
|
||||
virtual ~Vector();
|
||||
|
||||
int GetSize() const { return this->size; }
|
||||
|
||||
std::string ToString() const;
|
||||
|
||||
private:
|
||||
float* data;
|
||||
int size;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
3
examples/AndroidMathUtility/init
Normal file
3
examples/AndroidMathUtility/init
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
#ifndef _AndroidMathUtility_icpp_init_stub
|
||||
#define _AndroidMathUtility_icpp_init_stub
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue