-/* winduprobot, Copyright (c) 2014-2017 Jamie Zawinski <jwz@jwz.org>
+/* winduprobot, Copyright (c) 2014-2018 Jamie Zawinski <jwz@jwz.org>
*
* Permission to use, copy, modify, distribute, and sell this software and its
* documentation for any purpose is hereby granted without fee, provided that
#undef DEBUG
#define WORDBUBBLES
-# define refresh_robot 0
# define release_robot 0
#undef countof
#define countof(x) (sizeof((x))/sizeof((*x)))
#include "xlockmore.h"
#include "gltrackball.h"
-#include "xpm-ximage.h"
+#include "ximage-loader.h"
#include "involute.h"
#include "sphere.h"
#endif
#ifdef HAVE_TEXTURE
-# include "../images/chromesphere.xpm"
+# include "images/gen/chromesphere_png.h"
#endif
#ifdef USE_GL /* whole file */
reshape_robot (ModeInfo *mi, int width, int height)
{
GLfloat h = (GLfloat) height / (GLfloat) width;
+ int y = 0;
- glViewport (0, 0, width, height);
+ if (width > height * 5) { /* tiny window: show middle */
+ height = width * 9/16;
+ y = -height/2;
+ h = height / (GLfloat) width;
+ }
+
+ glViewport (0, y, width, height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
robot_configuration *bp = &bps[MI_SCREEN(mi)];
XImage *xi;
- xi = xpm_to_ximage (mi->dpy, mi->xgwa.visual, mi->xgwa.colormap,
- chromesphere_xpm);
+ xi = image_data_to_ximage (mi->dpy, mi->xgwa.visual,
+ chromesphere_png, sizeof(chromesphere_png));
clear_gl_error();
glGenTextures (1, &bp->chrome_texture);
glPixelStorei (GL_UNPACK_ALIGNMENT, 1);
glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA,
xi->width, xi->height, 0,
- GL_RGBA,
-# ifndef USE_IPHONE
- GL_UNSIGNED_INT_8_8_8_8_REV,
-# else
- GL_UNSIGNED_BYTE,
-# endif
- xi->data);
+ GL_RGBA, GL_UNSIGNED_BYTE, xi->data);
check_gl_error("texture");
glEnable(GL_TEXTURE_GEN_S);
static int unit_gear (ModeInfo *, GLfloat color[4]);
static int draw_ground (ModeInfo *, GLfloat color[4]);
static void init_walker (ModeInfo *, walker *);
-static void free_robot (ModeInfo *mi);
static void
parse_color (ModeInfo *mi, char *key, GLfloat color[4])
robot_configuration *bp;
int wire = MI_IS_WIREFRAME(mi);
int i;
- MI_INIT (mi, bps, free_robot);
+ MI_INIT (mi, bps);
bp = &bps[MI_SCREEN(mi)];
glXSwapBuffers(dpy, window);
}
-static void
+ENTRYPOINT void
free_robot (ModeInfo *mi)
{
# ifdef WORDBUBBLES