#include #include #include #include #include #include #include "ui.h" // Ui stuff ui_button buttons[] = { { /* pos */ { { 0.5, 0.5, 0.0 }, { -50.0, -25.0, 0.0 } }, /* size */ { 100.0, 50.0, 0.0 }, /* onclick */ NULL, /* text */ "Test :)" } }; void display(void) { // Clear screen glClearColor(0.0, 0.0, 0.0, 1.0); // Dark theme :) glClear(GL_COLOR_BUFFER_BIT); // Draw buttons for(ui_button* b = buttons; b < buttons + sizeof buttons / sizeof(ui_button); b += 1) { ui_button_draw(b); } int err = glGetError(); if(err != 0) { printf("opengl error %d: %s\n", err, gluErrorString(err)); } glutSwapBuffers(); glFlush(); } void mouseEvent(int button, int state, int x, int y) { } int main(int argc, char** argv) { /* initialize glut and window */ glutInit(&argc, argv); glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB); glutInitWindowSize(800, 500); glutInitWindowPosition(450, 450); /* create window and set callbacks */ glutCreateWindow("World of Cow"); glutDisplayFunc(display); glutMouseFunc(mouseEvent); /* set projection and camera */ glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluOrtho2D(0.0, 800.0, 0.0, 500.0); glutMainLoop(); return 0; }