X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmodern%2Fmain.c;h=91178bfe841db3d8f600b9592da3cfc95f4645b9;hb=HEAD;hp=ea1080552e88e2b2fd64e530d7c5adecc43259c4;hpb=7ef52b31864696747396945b2ca8892d8796f96c;p=retroray
diff --git a/src/modern/main.c b/src/modern/main.c
index ea10805..91178bf 100644
--- a/src/modern/main.c
+++ b/src/modern/main.c
@@ -20,6 +20,8 @@ along with this program. If not, see .
#include
#include "miniglut.h"
#include "app.h"
+#include "options.h"
+#include "rtk.h"
#include "logger.h"
static void display(void);
@@ -45,12 +47,16 @@ static void (*glx_swap_interval_sgi)();
static PROC wgl_swap_interval_ext;
#endif
+static rtk_rect rband;
int main(int argc, char **argv)
{
glutInit(&argc, argv);
- glutInitWindowSize(640, 480);
+
+ load_options(CFGFILE);
+
+ glutInitWindowSize(opt.xres, opt.yres);
glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE);
glutCreateWindow("RetroRay");
@@ -84,6 +90,7 @@ int main(int argc, char **argv)
win_aspect = (float)win_width / win_height;
init_logger();
+ add_log_stream(stdout);
if(app_init() == -1) {
return 1;
@@ -93,32 +100,54 @@ int main(int argc, char **argv)
return 0;
}
-long app_getmsec(void)
+unsigned long get_msec(void)
{
- return glutGet(GLUT_ELAPSED_TIME);
+ return (unsigned long)glutGet(GLUT_ELAPSED_TIME);
}
-void app_redisplay(void)
+void app_redisplay(int x, int y, int w, int h)
{
+ /*dbgmsg("fakeupd: %d,%d (%dx%d)\n", x, y, w, h);*/
glutPostRedisplay();
}
void app_swap_buffers(void)
{
+ glViewport(0, 0, win_width, win_height);
+
+ glMatrixMode(GL_MODELVIEW);
+ glLoadIdentity();
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
+ glOrtho(0, win_width, win_height, 0, -1, 1);
- glRasterPos2i(-1, 1);
+ glRasterPos2i(0, 0);
glPixelZoom(1, -1);
glEnable(GL_ALPHA_TEST);
glAlphaFunc(GL_GREATER, 0.5f);
glDrawPixels(win_width, win_height, GL_BGRA, GL_UNSIGNED_BYTE, framebuf);
glDisable(GL_ALPHA_TEST);
- glMatrixMode(GL_PROJECTION);
+ if(rband.width | rband.height) {
+ glPushAttrib(GL_ENABLE_BIT);
+ glDisable(GL_DEPTH_TEST);
+ glDisable(GL_LIGHTING);
+
+ glEnable(GL_COLOR_LOGIC_OP);
+ glLogicOp(GL_XOR);
+
+ glBegin(GL_LINE_LOOP);
+ glColor3f(1, 1, 1);
+ glVertex2f(rband.x, rband.y);
+ glVertex2f(rband.x + rband.width, rband.y);
+ glVertex2f(rband.x + rband.width, rband.y + rband.height);
+ glVertex2f(rband.x, rband.y + rband.height);
+ glEnd();
+
+ glPopAttrib();
+ }
+
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
@@ -178,6 +207,16 @@ void app_vsync(int vsync)
}
#endif
+void app_rband(int x, int y, int w, int h)
+{
+ rband.x = x;
+ rband.y = y;
+ rband.width = w;
+ rband.height = h;
+
+ glutPostRedisplay();
+}
+
static void display(void)
{