<commit_before>#include "Crown.h"
#include "OS.h"
#include <jni.h>
#include <GLES/gl.h>
#include "MovableCamera.h"

namespace crown
{

MovableCamera* cam;

extern "C"
{
	JNIEXPORT void JNICALL Java_crown_android_CrownLib_frame(JNIEnv* env, jobject obj);
};

class MainScene : public AccelerometerListener, TouchListener
{
	
public:

	MainScene()
	{
		get_input_manager()->register_accelerometer_listener(this);
		get_input_manager()->register_touch_listener(this);

		cam = new MovableCamera(Vec3::ZERO, true, 90.0f, 1.6f, true, 0.1f, 2.5f);

		if (cam)
		{
			cam->SetActive(true);
			cam->SetSpeed(0.1);
			cam->SetFarClipDistance(1000.0f);
		}
	}

	void accelerometer_changed(const AccelerometerEvent& event)
	{
		cam->SetRotation(event.x, event.y);
	}

	void touch_down(const TouchEvent& event)
	{
		cam->MoveBackward();
	}

	void touch_move(const TouchEvent& event)
	{
		cam->MoveBackward();
	}

	void draw_triangle()
	{
		GetDevice()->GetRenderer()->set_clear_color(Color4::LIGHTBLUE);

		GetDevice()->GetRenderer()->set_matrix(MT_VIEW, Mat4::IDENTITY);
		GetDevice()->GetRenderer()->set_matrix(MT_MODEL, Mat4::IDENTITY);

		cam->Render();

		static GLfloat vertices[] = {  -1.0f, -1.0f, -2.0f,
										1.0f, -1.0f, -2.0f,
										0.0f, 1.0f, -2.0f};

		GetDevice()->GetRenderer()->set_matrix(MT_MODEL, Mat4::IDENTITY);

		glEnableClientState(GL_VERTEX_ARRAY);
		glVertexPointer(3, GL_FLOAT, 0, vertices);

		glDrawArrays(GL_TRIANGLES, 0, 3);

		glDisableClientState(GL_VERTEX_ARRAY);
	}

	void frame()
	{
		Device* mDevice = GetDevice();

		os::event_loop();

		get_input_manager()->event_loop();

		GetDevice()->GetRenderer()->begin_frame();
		draw_triangle();
		GetDevice()->GetRenderer()->end_frame();

		os::swap_buffers();
	}
};

MainScene* scene = new MainScene();

JNIEXPORT void JNICALL Java_crown_android_CrownLib_frame(JNIEnv* env, jobject obj)
{
	scene->frame();
}

} // namespace crown<commit_msg>Fix android build - not tested<commit_after>#include "Crown.h"
#include "OS.h"
#include <jni.h>
#include <GLES/gl.h>
#include "MovableCamera.h"

namespace crown
{

MovableCamera* cam;

extern "C"
{
	JNIEXPORT void JNICALL Java_crown_android_CrownLib_frame(JNIEnv* env, jobject obj);
};

class MainScene : public AccelerometerListener, TouchListener
{
	
public:

	MainScene()
	{
		get_input_manager()->register_accelerometer_listener(this);
		get_input_manager()->register_touch_listener(this);

		cam = new MovableCamera(Vec3::ZERO, true, 90.0f, 1.6f, true, 0.1f, 2.5f);

		if (cam)
		{
			cam->SetActive(true);
			cam->SetSpeed(0.1);
			cam->SetFarClipDistance(1000.0f);
		}
	}

	void accelerometer_changed(const AccelerometerEvent& event)
	{
		cam->SetRotation(event.x, event.y);
	}

	void touch_down(const TouchEvent& event)
	{
		cam->MoveBackward();
	}

	void touch_move(const TouchEvent& event)
	{
		cam->MoveBackward();
	}

	void draw_triangle()
	{
		GetDevice()->renderer()->set_clear_color(Color4::LIGHTBLUE);

		GetDevice()->renderer()->set_matrix(MT_VIEW, Mat4::IDENTITY);
		GetDevice()->renderer()->set_matrix(MT_MODEL, Mat4::IDENTITY);

		cam->Render();

		static GLfloat vertices[] = {  -1.0f, -1.0f, -2.0f,
										1.0f, -1.0f, -2.0f,
										0.0f, 1.0f, -2.0f};

		GetDevice()->renderer()->set_matrix(MT_MODEL, Mat4::IDENTITY);

		glEnableClientState(GL_VERTEX_ARRAY);
		glVertexPointer(3, GL_FLOAT, 0, vertices);

		glDrawArrays(GL_TRIANGLES, 0, 3);

		glDisableClientState(GL_VERTEX_ARRAY);
	}

	void frame()
	{
		Device* engine = GetDevice();

		os::event_loop();

		get_input_manager()->event_loop();

		engine->renderer()->begin_frame();
		draw_triangle();
		engine->renderer()->end_frame();
	}
};

MainScene* scene = new MainScene();

JNIEXPORT void JNICALL Java_crown_android_CrownLib_frame(JNIEnv* env, jobject obj)
{
	scene->frame();
}

} // namespace crown
{'fraction_non_alphanumeric': 0.16136662286465178, 'fraction_numerical': 0.022601839684625494, 'mean_word_length': 4.740573152337858, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 53, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7363814', 'n_tokens_mistral': 1624, 'n_tokens_neox': 1453, 'n_words': 238}