if(!(tex_logo = get_tex2d("data/ml_logo_old.png"))) {
return -1;
}
+ glBindTexture(GL_TEXTURE_2D, tex_logo);
glUseProgram(sdr_foo);
gl_begin(GL_QUADS);
gl_texcoord2f(0, 1);
void demo_display(void)
{
- struct demoscreen *scr;
+ dsys_update();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-
- scr = dsys_act_scr;
- while(scr) {
- if(scr->update) {
- scr->update(dsys_time);
- }
- scr->draw();
- scr = scr->next;
- }
+ dsys_draw();
}
void demo_reshape(int x, int y)
glViewport(0, 0, x, y);
- for(i=0; i<dsys_num_screens; i++) {
- if(dsys_screens[i]->reshape) {
- dsys_screens[i]->reshape(x, y);
+ for(i=0; i<dsys.num_screens; i++) {
+ if(dsys.screens[i]->reshape) {
+ dsys.screens[i]->reshape(x, y);
}
}
}
switch(key) {
case ' ':
- if(dsys_running) {
+ if(dsys.running) {
dsys_stop();
} else {
dsys_run();
} else if(key >= KEY_F1 && key <= KEY_F12) {
int idx = key - KEY_F1;
- if(idx < dsys_num_screens) {
- dsys_run_screen(dsys_screens[idx]);
+ if(idx < dsys.num_screens) {
+ dsys_run_screen(dsys.screens[idx]);
}
} else {
- struct demoscreen *scr = dsys_act_scr;
- while(scr) {
- if(scr->keyboard) {
- scr->keyboard(key, pressed);
- }
- scr = scr->next;
+ int i;
+ for(i=0; i<dsys.num_act; i++) {
+ struct demoscreen *scr = dsys.act[i];
+ if(scr->keyboard) scr->keyboard(key, pressed);
}
}
}
void demo_mouse(int bn, int pressed, int x, int y)
{
- struct demoscreen *scr = dsys_act_scr;
- while(scr) {
- if(scr->mouse) {
- scr->mouse(bn, pressed, x, y);
- }
- scr = scr->next;
+ int i;
+ for(i=0; i<dsys.num_act; i++) {
+ struct demoscreen *scr = dsys.act[i];
+ if(scr->mouse) scr->mouse(bn, pressed, x, y);
}
}
void demo_motion(int x, int y)
{
- struct demoscreen *scr = dsys_act_scr;
- while(scr) {
- if(scr->motion) {
- scr->motion(x, y);
- }
- scr = scr->next;
+ int i;
+ for(i=0; i<dsys.num_act; i++) {
+ struct demoscreen *scr = dsys.act[i];
+ if(scr->motion) scr->motion(x, y);
}
}