/* * Gem-graph OpenGL experiments * * Desc: Base header * * Copyright (C) 2023 Arthur Menges * Copyright (C) 2023 Adrien Bourmault * * This file is part of Gem-graph. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero 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 Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ /******************************************************************************/ /* */ /* E coli by David S. Goodsell (2009) */ /* --- */ /* Knowing that only a dynamic model can explain this phenomenon, */ /* let's let this beautiful freeze frame be our guide. */ /* */ /******************************************************************************/ #pragma once #include #include #include #include #include #include #include #include #include #include #include #include //#define G_APPLICATION_DEFAULT_FLAGS 0 #define W 1920 #define H 960 #define W_IMAGE W - 320 #define H_IMAGE H - 126 #define H_STYLES_PANE 30 #define W_IMAGE_LOCAL W / 16 #define H_IMAGE_LOCAL H / 16 //GtkWidget *get_selected_rules_vpaned_new(); //void activate (GtkApplication *app, gpointer user_data); // Graphical axis enum { X_AXIS, Y_AXIS, Z_AXIS, N_AXIS }; // Gem-graph modes enum { HOME_MODE, RUN_MODE, EDIT_MODE, PRESENTATION_MODE, N_MODE }; /* * Structure describing an arrow */ struct arrow_t { uint load; uint site; uint x; uint y; uint z; }; /* * Read a file from filename into a provided buffer * * @param filename, file name * contents, target ptr * * @return void */ static inline char *read_file(char *filename) { int fd; int filesize; char *contents; fd = open(filename, O_RDONLY); if(fd < 0) { printf("Couldn't read file: %s\n",filename); return NULL; } filesize = lseek(fd, 0, SEEK_END) + 1 ; contents = g_malloc(filesize * sizeof(char)); assert (contents); lseek(fd, 0, SEEK_SET); read(fd,contents,filesize); contents[filesize-1] = '\0'; close(fd); return contents; } /* I'm standing on Earth (any planet or star or spinning spheroid, in fact) * and looking towards its North pole * * X - X = EAST - WEST = rouge - cyan * Y - Y = ZENITH - NADIR = vert - magenta * Z - Z = NORTH - SOUTH = bleu - jaune */ #define EAST 0 // + x rouge #define WEST 1 // - x cyan #define ZENITH 2 // + y vert #define NADIR 3 // - y magenta #define SOUTH 4 // + z bleu #define NORTH 5 // - z jaune