What works? - Reading files (AssetManager::loadFile) - Rendering colored & textured rects (Renderer::addRect) - Getting input (TouchInputEvent) TODO Port this to windows
65 lines
1.1 KiB
C++
65 lines
1.1 KiB
C++
#ifndef KRIMI_DINNER_ENGINE_NATIVEENGINE_H
|
|
#define KRIMI_DINNER_ENGINE_NATIVEENGINE_H
|
|
|
|
#include "Position.h"
|
|
#include "StringRepository.h"
|
|
|
|
#include <game-activity/native_app_glue/android_native_app_glue.h>
|
|
#include <EGL/egl.h>
|
|
|
|
struct NativeEngineState
|
|
{
|
|
bool has_focus;
|
|
};
|
|
|
|
class NativeEngine {
|
|
public:
|
|
NativeEngine(struct android_app* app);
|
|
~NativeEngine();
|
|
|
|
void gameLoop();
|
|
|
|
void handleAppCmd(int32_t event);
|
|
|
|
private:
|
|
bool isAnimating() const;
|
|
|
|
JNIEnv* getJniEnv();
|
|
|
|
bool prepareToRender();
|
|
void renderFrame();
|
|
|
|
bool initDisplay();
|
|
void killDisplay();
|
|
bool initSurface();
|
|
void killSurface();
|
|
bool initContext();
|
|
void killContext();
|
|
|
|
bool initGLObjects();
|
|
void killGLObjects();
|
|
|
|
struct android_app* m_app;
|
|
|
|
bool m_has_window;
|
|
bool m_has_focus;
|
|
bool m_is_visible;
|
|
|
|
NativeEngineState m_state;
|
|
|
|
EGLDisplay m_egl_display;
|
|
EGLSurface m_egl_surface;
|
|
EGLContext m_egl_context;
|
|
EGLConfig m_egl_config;
|
|
|
|
StringHandle m_smiley;
|
|
Position m_smiley_pos;
|
|
|
|
Position m_last_down;
|
|
bool m_in_motion;
|
|
|
|
JNIEnv* m_jni_env;
|
|
};
|
|
|
|
|
|
#endif |