hello zacs7. You'll see I decided to stick with GLUT for now while I figure out the screen manager. Thanks for the alternative idea, i'm just getting the hang of the #ifndef stuff, so this is good timing.
Just as a last thought - after that last post I had a go with doing a mega global static version (the "hit-it-with-a-hammer" approach):
main.c
Code:
#include "drawing.h"
#include "screenManager.h"
ScreenManager sm2;
int main (int argc, char * argv[]) {
screenManagerInit(&(sm2));
init(argc, argv);
draw();
return 0;
}
and tried this in the display callback function, in drawing.c:
Code:
void display() {
glClear(GL_COLOR_BUFFER_BIT);
grid();
sm2.draw(&(sm2), "rect");
glFlush();
}
and this in the mouse callback, also in drawing.c:
Code:
void mouse(int button, int state, int x, int y) {
if (button == GLUT_LEFT && state == GLUT_DOWN) {
int n = sm2.numberOfObjects;
printf("\n\nstruct sm2 no. of objects = %d", n);
sm2.print(&(sm2)); // prints database
}
}
They all worked fine, so it looks like I have a choice. Thanks for the help