# HG changeset patch # User John Tsiombikas # Date 1443225367 -10800 # Node ID 64e15874f3bd4bf8381da507d9c2682a6e0c0caf # Parent 661bf09db398148564afeaeed5994943ea789394 foo diff -r 661bf09db398 -r 64e15874f3bd Makefile --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Makefile Sat Sep 26 02:56:07 2015 +0300 @@ -0,0 +1,34 @@ +src = $(wildcard src/*.c) $(wildcard src/glut/*.c) +ccsrc = $(wildcard src/*.cc) + +obj = $(src:.c=.o) $(ccsrc:.cc=.o) +dep = $(obj:.o=.d) +bin = test + +incdir = -Isrc +def = -DNO_FREETYPE + +CFLAGS = -pedantic -Wall -g $(def) $(incdir) +CXXFLAGS = $(CFLAGS) +LDFLAGS = -lGL -lGLU -lglut -lGLEW -lm -ldl + +include libs/Makefile + +$(bin): $(obj) + $(CXX) -o $@ $(obj) $(LDFLAGS) + +-include $(dep) + +%.d: %.c + @$(CPP) $(CFLAGS) -MM -MT $(@:.d=.o) $< >$@ + +%.d: %.cc + @$(CPP) $(CXXFLAGS) -MM -MT $(@:.d=.o) $< >$@ + +.PHONY: clean +clean: + rm -f $(obj) $(bin) + +.PHONY: cleandep +cleandep: + rm -f $(dep) diff -r 661bf09db398 -r 64e15874f3bd libs/Makefile --- a/libs/Makefile Thu Sep 24 07:09:37 2015 +0300 +++ b/libs/Makefile Sat Sep 26 02:56:07 2015 +0300 @@ -2,6 +2,10 @@ $(wildcard libs/libpng/*.c) \ $(wildcard libs/libjpeg/*.c) \ $(wildcard libs/imago2/*.c) \ - $(wildcard libs/vmath/*.c) + $(wildcard libs/vmath/*.c) \ + $(wildcard libs/drawtext/*.c) -incdir += -Ilibs/imago2 -Ilibs/zlib -Ilibs/libpng -Ilibs/libjpeg -Ilibs/vmath +ccsrc += $(wildcard libs/goatkit/*.cc) + +incdir += -Ilibs -Ilibs/imago2 -Ilibs/zlib -Ilibs/libpng -Ilibs/libjpeg \ + -Ilibs/vmath -Ilibs/drawtext diff -r 661bf09db398 -r 64e15874f3bd libs/drawtext/drawtext_impl.h --- a/libs/drawtext/drawtext_impl.h Thu Sep 24 07:09:37 2015 +0300 +++ b/libs/drawtext/drawtext_impl.h Sat Sep 26 02:56:07 2015 +0300 @@ -1,6 +1,6 @@ /* libdrawtext - a simple library for fast text rendering in OpenGL -Copyright (C) 2011-2012 John Tsiombikas +Copyright (C) 2011-2015 John Tsiombikas This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -62,7 +62,7 @@ #define fperror(str) \ - fprintf(stderr, "%s: %s: %s\n", __FUNCTION__, (str), strerror(errno)) + fprintf(stderr, "%s: %s: %s\n", __func__, (str), strerror(errno)) int dtx_gl_init(void); diff -r 661bf09db398 -r 64e15874f3bd libs/goatkit/theme.cc --- a/libs/goatkit/theme.cc Thu Sep 24 07:09:37 2015 +0300 +++ b/libs/goatkit/theme.cc Sat Sep 26 02:56:07 2015 +0300 @@ -1,6 +1,6 @@ /* GoatKit - a themable/animated widget toolkit for games -Copyright (C) 2014 John Tsiombikas +Copyright (C) 2014-2015 John Tsiombikas This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by @@ -21,12 +21,15 @@ #include #include #include +#include #include "theme.h" #include "widget.h" #ifdef WIN32 #include +#define RTLD_DEFAULT ((void*)0) + static void *dlopen(const char *name, int flags); static void dlclose(void *so); static void *dlsym(void *so, const char *symbol); diff -r 661bf09db398 -r 64e15874f3bd src/glut/assman.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/glut/assman.c Sat Sep 26 02:56:07 2015 +0300 @@ -0,0 +1,28 @@ +#include +#include "assman.h" + +ass_file *ass_fopen(const char *fname, const char *mode) +{ + return (ass_file*)fopen(fname, mode); +} + +void ass_fclose(ass_file *fp) +{ + fclose((FILE*)fp); +} + +long ass_fseek(ass_file *fp, long offs, int whence) +{ + fseek((FILE*)fp, offs, whence); + return ftell((FILE*)fp); +} + +long ass_ftell(ass_file *fp) +{ + return ftell((FILE*)fp); +} + +size_t ass_fread(void *buf, size_t size, size_t count, ass_file *fp) +{ + return fread(buf, size, count, (FILE*)fp); +} diff -r 661bf09db398 -r 64e15874f3bd src/glut/main.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/glut/main.c Sat Sep 26 02:56:07 2015 +0300 @@ -0,0 +1,103 @@ +/* +Stereoscopic tunnel for iOS. +Copyright (C) 2011-2015 John Tsiombikas + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . +*/ + + +#include +#include +#include +#include +#include "sanegl.h" +#include "istereo.h" +#include "sdr.h" + +void disp(void); +void keyb(unsigned char key, int x, int y); +void mouse(int bn, int st, int x, int y); +void motion(int x, int y); + +int main(int argc, char **argv) +{ + glutInit(&argc, argv); + glutInitWindowSize(640, 920); + glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); + glutCreateWindow("test"); + + glutDisplayFunc(disp); + glutIdleFunc(glutPostRedisplay); + glutReshapeFunc(reshape); + glutKeyboardFunc(keyb); + glutMouseFunc(mouse); + glutMotionFunc(motion); + + glewInit(); + + if(init() == -1) { + return 1; + } + + glutMainLoop(); + return 0; +} + +void disp(void) +{ + redraw(); + + glutSwapBuffers(); +} + +extern int stereo; +extern int use_bump; + +void keyb(unsigned char key, int x, int y) +{ + switch(key) { + case 27: + exit(0); + + case 's': + stereo = !stereo; + break; + + case 'b': + use_bump = !use_bump; + break; + + case '`': + { + int xsz = glutGet(GLUT_WINDOW_WIDTH); + int ysz = glutGet(GLUT_WINDOW_HEIGHT); + + glutReshapeWindow(ysz, xsz); + } + break; + + default: + break; + } +} + +void mouse(int bn, int st, int x, int y) +{ + mouse_button(bn - GLUT_LEFT_BUTTON, st == GLUT_DOWN ? 1 : 0, x, y); +} + +void motion(int x, int y) +{ + mouse_motion(x, y); +} diff -r 661bf09db398 -r 64e15874f3bd src/glutmain.c --- a/src/glutmain.c Thu Sep 24 07:09:37 2015 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/* -Stereoscopic tunnel for iOS. -Copyright (C) 2011 John Tsiombikas - -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program. If not, see . -*/ - - -#include -#include -#include -#include -#include "sanegl.h" -#include "istereo.h" -#include "sdr.h" - -void disp(void); -void keyb(unsigned char key, int x, int y); - -int main(int argc, char **argv) -{ - glutInit(&argc, argv); - glutInitWindowSize(640, 920); - glutInitDisplayMode(GLUT_RGB | GLUT_DEPTH | GLUT_DOUBLE); - glutCreateWindow("test"); - - glutDisplayFunc(disp); - glutIdleFunc(glutPostRedisplay); - glutReshapeFunc(reshape); - glutKeyboardFunc(keyb); - - glewInit(); - - if(init() == -1) { - return 1; - } - - glutMainLoop(); - return 0; -} - -void disp(void) -{ - redraw(); - - glutSwapBuffers(); -} - -extern int stereo; -extern int use_bump; - -void keyb(unsigned char key, int x, int y) -{ - switch(key) { - case 27: - exit(0); - - case 's': - stereo = !stereo; - break; - - case 'b': - use_bump = !use_bump; - break; - - case '`': - { - int xsz = glutGet(GLUT_WINDOW_WIDTH); - int ysz = glutGet(GLUT_WINDOW_HEIGHT); - - glutReshapeWindow(ysz, xsz); - } - break; - - default: - break; - } -} diff -r 661bf09db398 -r 64e15874f3bd src/ui.cc --- a/src/ui.cc Thu Sep 24 07:09:37 2015 +0300 +++ b/src/ui.cc Sat Sep 26 02:56:07 2015 +0300 @@ -2,6 +2,7 @@ #include "ui.h" #include "goatkit/goatkit.h" #include "opengl.h" +#include "sanegl.h" #include "sdr.h" static goatkit::Screen scr; @@ -135,4 +136,4 @@ void ui_motion(int x, int y) { scr.sysev_mouse_motion((float)x / (float)width, (float)y / (float)height); -} \ No newline at end of file +} diff -r 661bf09db398 -r 64e15874f3bd src/uitheme.cc --- a/src/uitheme.cc Thu Sep 24 07:09:37 2015 +0300 +++ b/src/uitheme.cc Sat Sep 26 02:56:07 2015 +0300 @@ -2,6 +2,7 @@ #include #include "goatkit/goatkit.h" #include "opengl.h" +#include "sanegl.h" #include "drawtext.h" #include "sdr.h" @@ -26,8 +27,9 @@ static std::map funcmap; -__attribute__ ((used)) -extern "C" WidgetDrawFunc get_widget_func(const char *name) + +extern "C"// __attribute__ ((used)) +WidgetDrawFunc get_widget_func(const char *name) { static bool initialized; @@ -99,4 +101,4 @@ gl_pop_matrix(); gl_matrix_mode(GL_MODELVIEW); gl_pop_matrix(); -} \ No newline at end of file +}