REFACTOR : glanimation rechristend, touch handling genericized

- 'animation' was too constrained a name to what these do, so switch to the overloaded term 'node' ;-)
    - Touch handling is no longer the sole purview of the touchjoy, (in prep for touchable HUD elements)
This commit is contained in:
Aaron Culliney 2015-04-12 15:35:16 -07:00
parent 5b5c6fa533
commit ca139ee94a
18 changed files with 268 additions and 211 deletions

View File

@ -94,14 +94,14 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeGraphicsChanged(JNIEnv *env
}
void Java_org_deadc0de_apple2ix_Apple2Activity_nativeGraphicsInitialized(JNIEnv *env, jobject obj, jint width, jint height) {
LOG("%s", "native graphicsInitialized...");
video_backend->reshape(width, height);
LOG("native graphicsInitialized width:%d height:%d", width, height);
static bool graphicsPreviouslyInitialized = false;
if (graphicsPreviouslyInitialized) {
video_backend->shutdown();
}
graphicsPreviouslyInitialized = true;
video_backend->reshape(width, height);
video_backend->init((void *)0);
}
@ -196,7 +196,7 @@ jboolean Java_org_deadc0de_apple2ix_Apple2Activity_nativeOnTouch(JNIEnv *env, jo
// LOG("\t[%f,%f]", x_coords[i], y_coords[i]);
//}
bool consumed = joydriver_onTouchEvent(joyaction, pointerCount, pointerIndex, x_coords, y_coords);
bool consumed = interface_onTouchEvent(joyaction, pointerCount, pointerIndex, x_coords, y_coords);
(*env)->ReleaseFloatArrayElements(env, xCoords, x_coords, 0);
(*env)->ReleaseFloatArrayElements(env, yCoords, y_coords, 0);
@ -220,8 +220,8 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeIncreaseCPUSpeed(JNIEnv *en
LOG("native set emulation percentage to %f", cpu_scale_factor);
if (video_animation_show_cpuspeed) {
video_animation_show_cpuspeed();
if (video_backend->video_animation_show_cpuspeed) {
video_backend->video_animation_show_cpuspeed();
}
#warning HACK TODO FIXME ... refactor timing stuff
@ -253,8 +253,8 @@ void Java_org_deadc0de_apple2ix_Apple2Activity_nativeDecreaseCPUSpeed(JNIEnv *en
LOG("native set emulation percentage to %f", cpu_scale_factor);
if (video_animation_show_cpuspeed) {
video_animation_show_cpuspeed();
if (video_backend->video_animation_show_cpuspeed) {
video_backend->video_animation_show_cpuspeed();
}
#warning HACK TODO FIXME ... refactor timing stuff

View File

@ -11,7 +11,7 @@ APPLE2_ARM_SRC := \
APPLE2_VIDEO_SRC = \
$(APPLE2_SRC_PATH)/video/glvideo.c \
$(APPLE2_SRC_PATH)/video/glanimation.c \
$(APPLE2_SRC_PATH)/video/glnode.c \
$(APPLE2_SRC_PATH)/video/glhudmodel.c \
$(APPLE2_SRC_PATH)/video/glcpuanim.c \
$(APPLE2_SRC_PATH)/video/gltouchjoy.c \
@ -32,7 +32,7 @@ APPLE2_META_SRC = \
APPLE2_MAIN_SRC = \
$(APPLE2_SRC_PATH)/font.c $(APPLE2_SRC_PATH)/rom.c $(APPLE2_SRC_PATH)/misc.c $(APPLE2_SRC_PATH)/display.c $(APPLE2_SRC_PATH)/vm.c \
$(APPLE2_SRC_PATH)/timing.c $(APPLE2_SRC_PATH)/zlib-helpers.c $(APPLE2_SRC_PATH)/joystick.c $(APPLE2_SRC_PATH)/keys.c \
$(APPLE2_SRC_PATH)/disk.c $(APPLE2_SRC_PATH)/cpu-supp.c
$(APPLE2_SRC_PATH)/interface.c $(APPLE2_SRC_PATH)/disk.c $(APPLE2_SRC_PATH)/cpu-supp.c
APPLE2_BASE_CFLAGS := -DAPPLE2IX=1 -DTOUCH_JOYSTICK=1 -DMOBILE_DEVICE=1 -DVIDEO_OPENGL=1 -DDEBUGGER=1 -std=gnu11 -I$(APPLE2_SRC_PATH)
APPLE2_BASE_CFLAGS := -DAPPLE2IX=1 -DINTERFACE_TOUCH=1 -DMOBILE_DEVICE=1 -DVIDEO_OPENGL=1 -DDEBUGGER=1 -std=gnu11 -I$(APPLE2_SRC_PATH)

View File

@ -37,10 +37,10 @@ INTERFACE_CLASSIC_SRC = \
VIDEO_SRC = \
src/video/xvideo.c \
src/video/glvideo.c \
src/video/glanimation.c \
src/video/glcpuanim.c \
src/video/glhudmodel.c \
src/video/glutinput.c \
src/video/glnode.c \
src/video/glhudmodel.c \
src/video/glcpuanim.c \
src/video_util/matrixUtil.c \
src/video_util/modelUtil.c \
src/video_util/sourceUtil.c \

View File

@ -170,7 +170,7 @@ AC_ARG_ENABLE([opengl], AS_HELP_STRING([--disable-opengl], [Disable OpenGL video
opengl_supported='yes'
AC_DEFINE(VIDEO_OPENGL, 1, [Use OpenGL])
AC_DEFINE(USE_GLUT, 1, [Use GLUT library])
VIDEO_O="src/video/glvideo.o src/video/glanimation.o src/video/glcpuanim.o src/video/glhudmodel.o src/video/glutinput.o src/video_util/matrixUtil.o src/video_util/modelUtil.o src/video_util/sourceUtil.o src/video_util/vectorUtil.o"
VIDEO_O="src/video/glvideo.o src/video/glnode.o src/video/glcpuanim.o src/video/glhudmodel.o src/video/glutinput.o src/video_util/matrixUtil.o src/video_util/modelUtil.o src/video_util/sourceUtil.o src/video_util/vectorUtil.o"
AC_MSG_RESULT([Building emulator with OpenGL support, w00t!])
], [
AC_MSG_WARN([Did not find OpenGL GLEW library...])

View File

@ -16,6 +16,11 @@
#include "common.h"
#if INTERFACE_TOUCH
// touch interface managed elsewhere
bool (*interface_onTouchEvent)(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords) = NULL;
#endif
// 2015/04/12 : This was legacy code for rendering the menu interfaces on desktop Linux. Portions here are resurrected
// to render HUD messages on desktop and mobile. Nothing special or pretty here, but has "just worked" for 20+ years ;-)

View File

@ -48,4 +48,19 @@ void interface_printMessage(uint8_t *fb, int fb_pix_width, int col, int row, int
// Plots a string/template into the specified framebuffer
void interface_printMessageCentered(uint8_t *fb, int fb_cols, int fb_rows, interface_colorscheme_t cs, char *message, int message_cols, int message_rows);
#if INTERFACE_TOUCH
typedef enum interface_touch_event_t {
TOUCH_CANCEL = 0,
TOUCH_DOWN,
TOUCH_MOVE,
TOUCH_UP,
TOUCH_POINTER_DOWN,
TOUCH_POINTER_UP,
} interface_touch_event_t;
// handle touch event
extern bool (*interface_onTouchEvent)(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords);
#endif
#endif

View File

@ -256,8 +256,7 @@ void c_joystick_reset(void)
#endif
}
#if TOUCH_JOYSTICK
bool (*joydriver_onTouchEvent)(joystick_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords) = NULL;
#if INTERFACE_TOUCH
// is the touch joystick available
bool (*joydriver_isTouchJoystickAvailable)(void) = NULL;

View File

@ -32,25 +32,13 @@ void c_joystick_reset(void);
void c_calibrate_joystick(void);
#endif
#if TOUCH_JOYSTICK
typedef enum joystick_touch_event_t {
TOUCH_CANCEL = 0,
TOUCH_DOWN,
TOUCH_MOVE,
TOUCH_UP,
TOUCH_POINTER_DOWN,
TOUCH_POINTER_UP,
} joystick_touch_event_t;
#if INTERFACE_TOUCH
typedef enum touchjoy_axis_type_t {
AXIS_EMULATED_DEVICE = 0, // touch joystick axis emulate a physical joystick device
AXIS_EMULATED_KEYBOARD, // touch joystick axis send single key events
} touchjoy_axis_type_t;
// handle touch event
extern bool (*joydriver_onTouchEvent)(joystick_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords);
// is the touch joystick available
extern bool (*joydriver_isTouchJoystickAvailable)(void);
@ -66,6 +54,6 @@ extern void (*joydriver_setTouchAxisType)(touchjoy_axis_type_t axisType);
// set the axis button parameters (7bit ASCII characters or MOUSETEXT values)
extern void (*joydriver_setTouchAxisValues)(char north, char west, char east, char south);
#endif // TOUCH_JOYSTICK
#endif // INTERFACE_TOUCH
#endif // whole file

View File

@ -253,8 +253,8 @@ void c_keys_handle_input(int scancode, int pressed, int is_cooked)
if (current_key == kF9)
{
timing_toggle_cpu_speed();
if (video_animation_show_cpuspeed) {
video_animation_show_cpuspeed();
if (video_backend->video_animation_show_cpuspeed) {
video_backend->video_animation_show_cpuspeed();
}
break;
}
@ -284,8 +284,8 @@ void c_keys_handle_input(int scancode, int pressed, int is_cooked)
cpu_scale_factor = scale;
}
if (video_animation_show_cpuspeed) {
video_animation_show_cpuspeed();
if (video_backend->video_animation_show_cpuspeed) {
video_backend->video_animation_show_cpuspeed();
}
#warning HACK TODO FIXME ... refactor timing stuff
timing_toggle_cpu_speed();
@ -313,8 +313,8 @@ void c_keys_handle_input(int scancode, int pressed, int is_cooked)
cpu_scale_factor = scale;
}
if (video_animation_show_cpuspeed) {
video_animation_show_cpuspeed();
if (video_backend->video_animation_show_cpuspeed) {
video_backend->video_animation_show_cpuspeed();
}
#warning HACK TODO FIXME ... refactor timing stuff
timing_toggle_cpu_speed();

View File

@ -1,84 +0,0 @@
/*
* Apple // emulator for *nix
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#include "common.h"
#include "video/glanimation.h"
#include "video/glvideo.h"
void (*video_animation_show_cpuspeed)(void) = NULL;
void (*video_animation_show_track_sector)(int drive, int track, int sect) = NULL;
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
typedef struct glanim_array_node_t {
struct glanim_array_node_t *next;
glanim_t *anim;
} glanim_array_node_t;
static glanim_array_node_t *animations = NULL;
// -----------------------------------------------------------------------------
void gldriver_register_animation(glanim_t *anim) {
pthread_mutex_lock(&mutex);
glanim_array_node_t *node = malloc(sizeof(glanim_array_node_t));
assert(node);
node->next = NULL;
node->anim = anim;
if (animations == NULL) {
animations = node;
} else {
glanim_array_node_t *p = animations;
while (p->next) {
p = p->next;
}
p->next = node;
}
pthread_mutex_unlock(&mutex);
}
void gldriver_animation_init(void) {
LOG("gldriver_animation_init ...");
glanim_array_node_t *p = animations;
while (p) {
p->anim->ctor();
p = p->next;
}
}
void gldriver_animation_destroy(void) {
LOG("gldriver_animation_destroy ...");
glanim_array_node_t *p = animations;
while (p) {
p->anim->dtor();
p = p->next;
}
}
void gldriver_animation_render(void) {
glanim_array_node_t *p = animations;
while (p) {
p->anim->render();
p = p->next;
}
}
void gldriver_animation_reshape(int w, int h) {
glanim_array_node_t *p = animations;
while (p) {
p->anim->reshape(w, h);
p = p->next;
}
}

View File

@ -1,40 +0,0 @@
/*
* Apple // emulator for *nix
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#include "common.h"
#ifndef _GLANIMATION_H_
#define _GLANIMATION_H_
typedef struct glanim_t {
void (*ctor)(void);
void (*dtor)(void);
void (*render)(void);
void (*reshape)(int w, int h);
} glanim_t;
// register an animation
void gldriver_register_animation(glanim_t *anim);
// initialize animations module
void gldriver_animation_init(void);
// destroy animations module
void gldriver_animation_destroy(void);
// renders the animation
void gldriver_animation_render(void);
// renders the animation
void gldriver_animation_reshape(int w, int h);
#endif

View File

@ -12,6 +12,7 @@
#include "common.h"
#include "video/glvideo.h"
#include "video/glhudmodel.h"
#include "video/glnode.h"
#define MODEL_DEPTH -0.0625
@ -29,8 +30,6 @@ static struct timespec cputiming_begin = { 0 };
static GLModel *cpuMessageObjModel = NULL;
static glanim_t cpuMessageAnimation = { 0 };
// ----------------------------------------------------------------------------
static void _cpuanim_show(GLModel *parent) {
@ -98,8 +97,8 @@ static void cpuanim_init(void) {
isAvailable = true;
}
static void cpuanim_destroy(void) {
LOG("gldriver_animation_destroy ...");
static void cpuanim_shutdown(void) {
LOG("cpuanim_shutdown ...");
if (!isAvailable) {
return;
}
@ -154,14 +153,24 @@ static void cpuanim_show(void) {
isEnabled = true;
}
#if INTERFACE_TOUCH
static bool cpuanim_onTouchEvent(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords) {
return false; // non-interactive element ...
}
#endif
__attribute__((constructor))
static void _init_glcpuanim(void) {
LOG("Registering CPU speed animations");
video_animation_show_cpuspeed = &cpuanim_show;
cpuMessageAnimation.ctor = &cpuanim_init;
cpuMessageAnimation.dtor = &cpuanim_destroy;
cpuMessageAnimation.render = &cpuanim_render;
cpuMessageAnimation.reshape = &cpuanim_reshape;
gldriver_register_animation(&cpuMessageAnimation);
video_backend->video_animation_show_cpuspeed = &cpuanim_show;
glnode_registerNode(RENDER_MIDDLE, (GLNode){
.setup = &cpuanim_init,
.shutdown = &cpuanim_shutdown,
.render = &cpuanim_render,
.reshape = &cpuanim_reshape,
#if INTERFACE_TOUCH
.onTouchEvent = &cpuanim_onTouchEvent,
#endif
});
}

109
src/video/glnode.c Normal file
View File

@ -0,0 +1,109 @@
/*
* Apple // emulator for *nix
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#include "common.h"
#include "video/glnode.h"
#include "video/glvideo.h"
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
// WARNING : linked list designed for convenience and not performance =P ... if the amount of GLNode objecs grows
// wildly, should rethink this ...
typedef struct glnode_array_node_s {
struct glnode_array_node_s *next;
glnode_render_order_t order;
GLNode node;
} glnode_array_node_s;
static glnode_array_node_s *glNodes = NULL;
// -----------------------------------------------------------------------------
void glnode_registerNode(glnode_render_order_t order, GLNode node) {
pthread_mutex_lock(&mutex);
glnode_array_node_s *arrayNode = malloc(sizeof(glnode_array_node_s));
assert(arrayNode);
arrayNode->next = NULL;
arrayNode->order = order;
arrayNode->node = node;
if (glNodes == NULL) {
glNodes = arrayNode;
} else {
glnode_array_node_s *p = glNodes;
while ((order < p->order) && p->next) {
p = p->next;
}
glnode_array_node_s *q = p->next;
p->next = arrayNode;
arrayNode->next = q;
}
pthread_mutex_unlock(&mutex);
}
void glnode_setupNodes(void) {
LOG("glnode_setupNodes ...");
glnode_array_node_s *p = glNodes;
while (p) {
p->node.setup();
p = p->next;
}
}
void glnode_shutdownNodes(void) {
LOG("glnode_shutdownNodes ...");
glnode_array_node_s *p = glNodes;
while (p) {
p->node.shutdown();
p = p->next;
}
}
void glnode_renderNodes(void) {
glnode_array_node_s *p = glNodes;
while (p) {
p->node.render();
p = p->next;
}
}
void glnode_reshapeNodes(int w, int h) {
glnode_array_node_s *p = glNodes;
while (p) {
p->node.reshape(w, h);
p = p->next;
}
}
#if INTERFACE_TOUCH
bool glnode_onTouchEvent(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords) {
glnode_array_node_s *p = glNodes;
bool handled = false;
while (p) {
handled = p->node.onTouchEvent(action, pointer_count, pointer_idx, x_coords, y_coords);
if (handled) {
break;
}
p = p->next;
}
return handled;
}
#endif
__attribute__((constructor))
static void _init_glnode_manager(void) {
LOG("Initializing GLNode manager routines");
#if INTERFACE_TOUCH
interface_onTouchEvent = &glnode_onTouchEvent;
#endif
}

58
src/video/glnode.h Normal file
View File

@ -0,0 +1,58 @@
/*
* Apple // emulator for *nix
*
* This software package is subject to the GNU General Public License
* version 2 or later (your choice) as published by the Free Software
* Foundation.
*
* THERE ARE NO WARRANTIES WHATSOEVER.
*
*/
#include "common.h"
#ifndef _GLNODE_H_
#define _GLNODE_H_
#include "common.h"
typedef enum glnode_render_order_t {
RENDER_BOTTOM=0, // e.g., the //e framebuffer node itself
RENDER_LOW =1, // e.g., the touchjoy and touchkbd
RENDER_MIDDLE=10, // e.g., floating messages
RENDER_TOP =20, // e.g., the HUD menu items
} glnode_render_order_t;
// renderable and potentially interactive node
typedef struct GLNode {
void (*setup)(void);
void (*shutdown)(void);
void (*render)(void);
#if INTERFACE_TOUCH
bool (*onTouchEvent)(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords);
#endif
void (*reshape)(int w, int h);
} GLNode;
// registers a node with manager
void glnode_registerNode(glnode_render_order_t order, GLNode node);
// setup nodes (occurs when OpenGL context created)
void glnode_setupNodes(void);
// shutdown nodes (occurs when OpenGL context about to be lost)
void glnode_shutdownNodes(void);
// render pass over all nodes in their requested render order
void glnode_renderNodes(void);
// distribute viewport dimension changes
void glnode_reshapeNodes(int w, int h);
#if INTERFACE_TOUCH
// distribute touch event to node which can handle it (in render order)
bool glnode_onTouchEvent(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords);
#endif
#endif

View File

@ -12,6 +12,11 @@
#include "common.h"
#include "video/glvideo.h"
#include "video/glhudmodel.h"
#include "video/glnode.h"
#if !INTERFACE_TOUCH
#error this is a touch interface module, possibly you mean to not compile this at all?
#endif
#define MODEL_DEPTH -0.03125
@ -53,8 +58,6 @@ static bool isEnabled = true; // Does player want touchjoy enabled?
static bool isVisible = true; // Does player want touchjoy to have some form of visibility?
static float minAlpha = 0.0; // Minimum alpha value of touchjoy components (at zero, will not draw)
static glanim_t touchjoyAnimation = { 0 };
// viewport touch
static struct {
int width;
@ -230,8 +233,8 @@ static void _model_to_screen(float screenCoords[4], GLModel *model) {
screenCoords[3] = yFlip1;
}
static void gltouchjoy_init(void) {
LOG("gltouchjoy_init ...");
static void gltouchjoy_setup(void) {
LOG("gltouchjoy_setup ...");
mdlDestroyModel(&axes.model);
mdlDestroyModel(&buttons.model);
@ -264,8 +267,8 @@ static void gltouchjoy_init(void) {
isAvailable = true;
}
static void gltouchjoy_destroy(void) {
LOG("gltouchjoy_destroy ...");
static void gltouchjoy_shutdown(void) {
LOG("gltouchjoy_shutdown ...");
if (!isAvailable) {
return;
}
@ -491,7 +494,7 @@ static inline void _move_button_axis(int x, int y) {
}
}
static bool gltouchjoy_onTouchEvent(joystick_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords) {
static bool gltouchjoy_onTouchEvent(interface_touch_event_t action, int pointer_count, int pointer_idx, float *x_coords, float *y_coords) {
if (!isAvailable) {
return false;
@ -667,18 +670,19 @@ static void _init_gltouchjoy(void) {
buttons.activeChar = MOUSETEXT_OPENAPPLE;
buttons.switchThreshold = BUTTON_SWITCH_THRESHOLD_DEFAULT;
joydriver_onTouchEvent = &gltouchjoy_onTouchEvent;
joydriver_isTouchJoystickAvailable = &gltouchjoy_isTouchJoystickAvailable;
joydriver_setTouchJoyEnabled = &gltouchjoy_setTouchJoyEnabled;
joydriver_setTouchButtonValues = &gltouchjoy_setTouchButtonValues;
joydriver_setTouchAxisType = &gltouchjoy_setTouchAxisType;
joydriver_setTouchAxisValues = &gltouchjoy_setTouchAxisValues;
touchjoyAnimation.ctor = &gltouchjoy_init;
touchjoyAnimation.dtor = &gltouchjoy_destroy;
touchjoyAnimation.render = &gltouchjoy_render;
touchjoyAnimation.reshape = &gltouchjoy_reshape;
gldriver_register_animation(&touchjoyAnimation);
glnode_registerNode(RENDER_LOW, (GLNode){
.setup = &gltouchjoy_setup;
.shutdown = &gltouchjoy_shutdown;
.render = &gltouchjoy_render;
.reshape = &gltouchjoy_reshape;
.onTouchEvent = &gltouchjoy_onTouchEvent;
});
}
void gldriver_joystick_reset(void) {

View File

@ -14,7 +14,7 @@
#include "common.h"
#include "video/glvideo.h"
#include "video/glinput.h"
#include "video/glanimation.h"
#include "video/glnode.h"
bool safe_to_do_opengl_logging = false;
@ -476,7 +476,7 @@ static GLuint _build_program(demoSource *vertexSource, demoSource *fragmentSourc
glUniform1i(messageSamplerLoc, TEXTURE_ID_MESSAGE);
}
#if TOUCH_JOYSTICK
#if INTERFACE_TOUCH
GLint axisSamplerLoc = glGetUniformLocation(prgName, "axisTexture");
if (axisSamplerLoc < 0) {
LOG("OOPS, no axisSamplerLoc shader : %d", axisSamplerLoc);
@ -629,7 +629,7 @@ static void gldriver_shutdown(void) {
crtModel = NULL;
glDeleteProgram(program);
program = UNINITIALIZED_GL;
gldriver_animation_destroy();
glnode_shutdownNodes();
}
//----------------------------------------------------------------------------
@ -761,8 +761,8 @@ static void gldriver_render(void) {
// Draw the CRT object and others
glDrawElements(GL_TRIANGLES, crtNumElements, crtElementType, 0);
// Prep any other objects/animations
gldriver_animation_render();
// Render HUD nodes
glnode_renderNodes();
_vid_dirty = false;
@ -816,8 +816,8 @@ static void gldriver_reshape(int w, int h) {
glViewport(viewportX, viewportY, viewportWidth, viewportHeight);
// Prep any other objects/animations
gldriver_animation_reshape(w, h);
// Reshape HUD nodes
glnode_reshapeNodes(w, h);
}
#if USE_GLUT
@ -869,7 +869,7 @@ static void gldriver_init(void *fbo) {
#else
#error no working codepaths
#endif
gldriver_animation_init();
glnode_setupNodes();
}
static void gldriver_main_loop(void) {

View File

@ -22,7 +22,7 @@
enum {
TEXTURE_ID_FRAMEBUFFER=0,
TEXTURE_ID_MESSAGE,
#if TOUCH_JOYSTICK
#if INTERFACE_TOUCH
TEXTURE_ID_TOUCHJOY_AXIS,
TEXTURE_ID_TOUCHJOY_BUTTON,
#endif
@ -31,7 +31,7 @@ enum {
enum {
TEXTURE_ACTIVE_FRAMEBUFFER = GL_TEXTURE0,
TEXTURE_ACTIVE_MESSAGE = GL_TEXTURE1,
#if TOUCH_JOYSTICK
#if INTERFACE_TOUCH
TEXTURE_ACTIVE_TOUCHJOY_AXIS = GL_TEXTURE2,
TEXTURE_ACTIVE_TOUCHJOY_BUTTON = GL_TEXTURE3,
#endif

View File

@ -18,13 +18,24 @@
#define A2_VIDEO_H
typedef struct video_backend_s {
// mandatory video backend functions
void (*init)(void *context);
void (*main_loop)(void);
void (*reshape)(int width, int height);
void (*render)(void);
void (*shutdown)(void);
// optional functions
void (*video_animation_show_cpuspeed)(void);
void (*video_animation_show_track_sector)(int drive, int track, int sect);
} video_backend_s;
/*
* The registered video backend (renderer).
*/
extern video_backend_s *video_backend;
/*
* Color structure
*/
@ -39,11 +50,6 @@ typedef struct A2Color_s {
*/
extern A2Color_s colormap[];
/*
* The registered video backend (renderer).
*/
extern video_backend_s *video_backend;
/*
* Prepare the video system, converting console to graphics mode, or
* opening X window, or whatever. This is called only once when the
@ -123,18 +129,6 @@ bool video_dirty(void);
// ----------------------------------------------------------------------------
/*
* Show CPU speed animation
*/
extern void (*video_animation_show_cpuspeed)(void);
/*
* Show track/sector animation
*/
extern void (*video_animation_show_track_sector)(int drive, int track, int sect);
// ----------------------------------------------------------------------------
/*
* VBL routines
*/