Space page : une première version.
This commit is contained in:
parent
39cf432f6a
commit
3d22188d0e
Binary file not shown.
After Width: | Height: | Size: 24 KiB |
6
Makefile
6
Makefile
|
@ -7,7 +7,7 @@ SHELL = /bin/sh
|
||||||
|
|
||||||
|
|
||||||
CC=gcc
|
CC=gcc
|
||||||
CFLAGS=`pkg-config --cflags gtk4 --libs gtk4`
|
CFLAGS=`pkg-config --cflags gtk4 --libs gtk4` # --libs gl` # --libs glib-2.0
|
||||||
WARNINGS = -Wall
|
WARNINGS = -Wall
|
||||||
DEBUG = -ggdb -fno-omit-frame-pointer
|
DEBUG = -ggdb -fno-omit-frame-pointer
|
||||||
OPTIMIZE = -O2
|
OPTIMIZE = -O2
|
||||||
|
@ -28,7 +28,9 @@ run: exec.o
|
||||||
./exec.o
|
./exec.o
|
||||||
|
|
||||||
|
|
||||||
|
# /!\ erreur fatale: GL/glu.h <?>
|
||||||
|
# gcc -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -g -Wall -Wextra
|
||||||
|
# -std=c99 -lm *.c -o formattage `pkg-config --cflags --libs glib-2.0`
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
18
cold.h
18
cold.h
|
@ -17,3 +17,21 @@ GtkWidget *get_results_page_new();
|
||||||
GtkWidget *get_discuss_page_new();
|
GtkWidget *get_discuss_page_new();
|
||||||
GtkWidget *get_help_page_new();
|
GtkWidget *get_help_page_new();
|
||||||
|
|
||||||
|
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
||||||
|
|
||||||
|
/*
|
||||||
|
Dans : space_page_new() doivent être déclarées
|
||||||
|
et organisées de façon aussi ergonomique que possible :
|
||||||
|
|
||||||
|
- les commandes de mouvement (run/stop, slow down/speed up, step by step, do/undo/redo)
|
||||||
|
et le buffer qui montre où on en est dans le temps de simulation
|
||||||
|
(un seul bouton pour toutes ces commandes ?)
|
||||||
|
|
||||||
|
- les commandes qui modifient l'orientation (X,Y,Z) de l'espace, le zoom, la perspective
|
||||||
|
|
||||||
|
- les commandes qui modifient les apparences des grilles et des flèches
|
||||||
|
|
||||||
|
- les commandes qui modifient les apparences des objets et des situations d'intérêt
|
||||||
|
(+/- transparents, colorés, etc.)
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
64
hot.c
64
hot.c
|
@ -1,6 +1,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <gtk-4.0/gtk/gtk.h>
|
#include <gtk-4.0/gtk/gtk.h>
|
||||||
#include "hot.h"
|
//#include "gg/graphics.h"
|
||||||
|
//#include "hot.h"
|
||||||
#include "warm.h"
|
#include "warm.h"
|
||||||
#include "cold.h"
|
#include "cold.h"
|
||||||
|
|
||||||
|
@ -8,7 +9,7 @@ GtkWidget *get_space_page_new(){
|
||||||
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
// https://docs.gtk.org/gtk4/visual_index.html < widgets gallery
|
||||||
|
|
||||||
GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new());
|
GtkScrolledWindow *scrolled = GTK_SCROLLED_WINDOW(gtk_scrolled_window_new());
|
||||||
gtk_scrolled_window_set_min_content_width (scrolled, 600);
|
gtk_scrolled_window_set_min_content_width (scrolled, 628); // ad hoc ...
|
||||||
gtk_scrolled_window_set_min_content_height (scrolled, 600);
|
gtk_scrolled_window_set_min_content_height (scrolled, 600);
|
||||||
// GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000);
|
// GtkAdjustment *width = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000);
|
||||||
// GtkAdjustment *height = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000);
|
// GtkAdjustment *height = gtk_adjustment_new (600, 300, 1000, 1, 1, 1000);
|
||||||
|
@ -19,12 +20,14 @@ GtkWidget *get_space_page_new(){
|
||||||
|
|
||||||
GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
GtkBox *controls_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
|
||||||
gtk_box_append (controls_box, gtk_button_new_with_label ("RUN / STOP"));
|
gtk_box_append (controls_box, gtk_button_new_with_label ("RUN / STOP"));
|
||||||
gtk_box_append (controls_box, gtk_button_new_with_label ("slow down / speed up"));
|
// GtkLevelBar *slow_speed = GTK_LEVEL_BAR (gtk_level_bar_new ()); // or __new_for_interval(0,100);
|
||||||
|
// gtk_level_bar_set_mode (slow_speed, GTK_LEVEL_BAR_MODE_CONTINUOUS); //_DISCRETE
|
||||||
|
gtk_box_append (controls_box, gtk_button_new_with_label ("slow down / speed up")); // GTK_WIDGET(slow_speed));
|
||||||
gtk_box_append (controls_box, gtk_button_new_with_label ("step by step"));
|
gtk_box_append (controls_box, gtk_button_new_with_label ("step by step"));
|
||||||
// GtkLevelBar *buffer = GTK_LEVEL_BAR (gtk_level_bar_new ());
|
GtkProgressBar *buffer = GTK_PROGRESS_BAR (gtk_progress_bar_new ());
|
||||||
// GtkWidget *buffer = gtk_level_bar_new_for_interval (0, 100000);
|
gtk_progress_bar_set_text (buffer, "<<-- BUFFER -->>");
|
||||||
// gtk_level_bar_set_mode (buffer, GTK_LEVEL_BAR_MODE_CONTINUOUS); //_DISCRETE
|
gtk_progress_bar_set_show_text (buffer, TRUE);
|
||||||
gtk_box_append (controls_box, gtk_button_new_with_label ("---- buffer ----"));
|
gtk_box_append (controls_box, GTK_WIDGET(buffer));//gtk_button_new_with_label ("---- buffer ----"));
|
||||||
|
|
||||||
GtkBox *XYZ_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2
|
GtkBox *XYZ_box = GTK_BOX(gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2)); // spacing = 2
|
||||||
// GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier
|
// GtkWidget *scale_X = gtk_scale_button_new (0, 360, 10, NULL); < à étudier
|
||||||
|
@ -54,50 +57,3 @@ GtkWidget *get_space_page_new(){
|
||||||
return space_grid;
|
return space_grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
gg/draw.c: * Draws the current buffer to a gl_area
|
|
||||||
gg/draw.c: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/init.c: * Initializes the buffer of a gl_area
|
|
||||||
gg/init.c: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/init.c: * Initializes the shaders of a gl_area and link them to a program
|
|
||||||
gg/init.c: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/graphics.c: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/graphics.c: * Shutdowns a gl_area
|
|
||||||
gg/graphics.c: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/GtkGLArea.c: void *gl_area;
|
|
||||||
gg/GtkGLArea.c: gtk_widget_queue_draw((GtkWidget*)(stack_index[i].gl_area));
|
|
||||||
gg/GtkGLArea.c: GtkWidget *gl_area;
|
|
||||||
gg/GtkGLArea.c: gl_area = GTK_WIDGET(gtk_gl_area_new());
|
|
||||||
gg/GtkGLArea.c: assert(gl_area);
|
|
||||||
gg/GtkGLArea.c: //gtk_widget_set_size_request(gl_area, 1000, 1000);
|
|
||||||
gg/GtkGLArea.c: gtk_gl_area_set_auto_render(GTK_GL_AREA(gl_area), true);
|
|
||||||
gg/GtkGLArea.c: gtk_widget_set_hexpand(gl_area, TRUE);
|
|
||||||
gg/GtkGLArea.c: gtk_widget_set_vexpand(gl_area, TRUE);
|
|
||||||
gg/GtkGLArea.c: //gtk_widget_set_halign(gl_area, GTK_ALIGN_CENTER);
|
|
||||||
gg/GtkGLArea.c: //gtk_widget_set_valign(gl_area, GTK_ALIGN_CENTER);
|
|
||||||
gg/GtkGLArea.c: g_signal_connect(GTK_GL_AREA(gl_area),
|
|
||||||
gg/GtkGLArea.c: g_signal_connect(gl_area,
|
|
||||||
gg/GtkGLArea.c: g_signal_connect(gl_area,
|
|
||||||
gg/GtkGLArea.c: stack_index[stack_index_size-1].gl_area = (void*)gl_area;
|
|
||||||
gg/GtkGLArea.c: gtk_box_append(GTK_BOX(target_widget), gl_area);
|
|
||||||
gg/GtkGLArea.c: gtk_widget_show(GTK_WIDGET(gl_area));
|
|
||||||
gg/events.c: if(gtk_gl_area_get_error(area) != NULL) {
|
|
||||||
gg/events.c: gtk_gl_area_make_current(GTK_GL_AREA(widget));
|
|
||||||
gg/events.c: if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
|
|
||||||
gg/events.c: gtk_gl_area_set_auto_render(GTK_GL_AREA(widget), true);
|
|
||||||
gg/events.c: gtk_gl_area_make_current(GTK_GL_AREA(widget));
|
|
||||||
gg/events.c: if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
|
|
||||||
gg/graphics.h: * Structure describing a gl_area and its parameters, used to create a table
|
|
||||||
gg/graphics.h: * of Gem-graph client current gl_areas
|
|
||||||
gg/graphics.h: * Dynamic array of ptrs to dynamically allocated gl_area_entry
|
|
||||||
gg/graphics.h: * Initializes a gl_area
|
|
||||||
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/graphics.h: * Draws the current buffer to a gl_area
|
|
||||||
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/graphics.h: * Shutdowns a gl_area
|
|
||||||
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/graphics.h: * Initializes the shaders of a gl_area and link them to a program
|
|
||||||
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
|
||||||
gg/graphics.h: * Initializes the buffer of a gl_area
|
|
||||||
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
|
||||||
*/
|
|
||||||
|
|
59
hot.h
59
hot.h
|
@ -4,3 +4,62 @@
|
||||||
#include "cold.h"
|
#include "cold.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* Comment afficher l'image produite par l'actuel gem-graph-client (2024-04-30)
|
||||||
|
dans la GLArea de la space_page que je viens de créer ?
|
||||||
|
Comment la connecter aux widgets qui la modifieront ?
|
||||||
|
<>
|
||||||
|
|
||||||
|
|
||||||
|
#include "gg/graphics.h" provoque une erreur fatale:
|
||||||
|
GL/glu.h : Aucun fichier ou dossier de ce type
|
||||||
|
> Je dois modifier mon Makefile +/- charger cette bibliothèque ?
|
||||||
|
|
||||||
|
|
||||||
|
Ci-dessous les fichiers de gem-graph-client listés par : $grep -r "gl_area" :
|
||||||
|
|
||||||
|
gg/draw.c: * Draws the current buffer to a gl_area
|
||||||
|
gg/draw.c: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/init.c: * Initializes the buffer of a gl_area
|
||||||
|
gg/init.c: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/init.c: * Initializes the shaders of a gl_area and link them to a program
|
||||||
|
gg/init.c: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/graphics.c: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/graphics.c: * Shutdowns a gl_area
|
||||||
|
gg/graphics.c: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/GtkGLArea.c: void *gl_area;
|
||||||
|
gg/GtkGLArea.c: gtk_widget_queue_draw((GtkWidget*)(stack_index[i].gl_area));
|
||||||
|
gg/GtkGLArea.c: GtkWidget *gl_area;
|
||||||
|
gg/GtkGLArea.c: gl_area = GTK_WIDGET(gtk_gl_area_new());
|
||||||
|
gg/GtkGLArea.c: assert(gl_area);
|
||||||
|
gg/GtkGLArea.c: //gtk_widget_set_size_request(gl_area, 1000, 1000);
|
||||||
|
gg/GtkGLArea.c: gtk_gl_area_set_auto_render(GTK_GL_AREA(gl_area), true);
|
||||||
|
gg/GtkGLArea.c: gtk_widget_set_hexpand(gl_area, TRUE);
|
||||||
|
gg/GtkGLArea.c: gtk_widget_set_vexpand(gl_area, TRUE);
|
||||||
|
gg/GtkGLArea.c: //gtk_widget_set_halign(gl_area, GTK_ALIGN_CENTER);
|
||||||
|
gg/GtkGLArea.c: //gtk_widget_set_valign(gl_area, GTK_ALIGN_CENTER);
|
||||||
|
gg/GtkGLArea.c: g_signal_connect(GTK_GL_AREA(gl_area),
|
||||||
|
gg/GtkGLArea.c: g_signal_connect(gl_area,
|
||||||
|
gg/GtkGLArea.c: g_signal_connect(gl_area,
|
||||||
|
gg/GtkGLArea.c: stack_index[stack_index_size-1].gl_area = (void*)gl_area;
|
||||||
|
gg/GtkGLArea.c: gtk_box_append(GTK_BOX(target_widget), gl_area);
|
||||||
|
gg/GtkGLArea.c: gtk_widget_show(GTK_WIDGET(gl_area));
|
||||||
|
gg/events.c: if(gtk_gl_area_get_error(area) != NULL) {
|
||||||
|
gg/events.c: gtk_gl_area_make_current(GTK_GL_AREA(widget));
|
||||||
|
gg/events.c: if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
|
||||||
|
gg/events.c: gtk_gl_area_set_auto_render(GTK_GL_AREA(widget), true);
|
||||||
|
gg/events.c: gtk_gl_area_make_current(GTK_GL_AREA(widget));
|
||||||
|
gg/events.c: if(gtk_gl_area_get_error(GTK_GL_AREA(widget)) != NULL) {
|
||||||
|
gg/graphics.h: * Structure describing a gl_area and its parameters, used to create a table
|
||||||
|
gg/graphics.h: * of Gem-graph client current gl_areas
|
||||||
|
gg/graphics.h: * Dynamic array of ptrs to dynamically allocated gl_area_entry
|
||||||
|
gg/graphics.h: * Initializes a gl_area
|
||||||
|
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/graphics.h: * Draws the current buffer to a gl_area
|
||||||
|
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/graphics.h: * Shutdowns a gl_area
|
||||||
|
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/graphics.h: * Initializes the shaders of a gl_area and link them to a program
|
||||||
|
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
||||||
|
gg/graphics.h: * Initializes the buffer of a gl_area
|
||||||
|
gg/graphics.h: * @param gl_area, ptr to the gl_area widget
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue