Changeset 1829 in orxonox.OLD for orxonox/branches/bensch
- Timestamp:
- Apr 15, 2004, 2:14:40 AM (21 years ago)
- Location:
- orxonox/branches/bensch
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/bensch/Makefile.am
r1817 r1829 2 2 AM_LDFLAGS=`pkg-config --libs gtk+-2.0` 3 3 4 bin_PROGRAMS=orxonox 5 orxonox_ SOURCES=orxonox_gui.c orxonox_gui_video.c orxonox_gui_audio.c orxonox_gui_exec.c orxonox_gui_file.c\4 bin_PROGRAMS=orxonox_gui 5 orxonox_gui_SOURCES=orxonox_gui.c orxonox_gui_video.c orxonox_gui_audio.c orxonox_gui_exec.c orxonox_gui_file.c\ 6 6 aclocal.m4 7 7 -
orxonox/branches/bensch/Makefile.in
r1817 r1829 15 15 @SET_MAKE@ 16 16 17 SOURCES = $(orxonox_ SOURCES)17 SOURCES = $(orxonox_gui_SOURCES) 18 18 19 19 srcdir = @srcdir@ … … 38 38 POST_UNINSTALL = : 39 39 host_triplet = @host@ 40 bin_PROGRAMS = orxonox $(EXEEXT)40 bin_PROGRAMS = orxonox_gui$(EXEEXT) 41 41 DIST_COMMON = README $(am__configure_deps) $(orxonox_TEXINFOS) \ 42 42 $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ … … 59 59 binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) 60 60 PROGRAMS = $(bin_PROGRAMS) 61 am_orxonox_ OBJECTS = orxonox_gui.$(OBJEXT) orxonox_gui_video.$(OBJEXT) \62 orxonox_gui_ audio.$(OBJEXT) orxonox_gui_exec.$(OBJEXT) \63 orxonox_gui_ file.$(OBJEXT)64 orxonox_ OBJECTS = $(am_orxonox_OBJECTS)65 orxonox_ LDADD = $(LDADD)61 am_orxonox_gui_OBJECTS = orxonox_gui.$(OBJEXT) \ 62 orxonox_gui_video.$(OBJEXT) orxonox_gui_audio.$(OBJEXT) \ 63 orxonox_gui_exec.$(OBJEXT) orxonox_gui_file.$(OBJEXT) 64 orxonox_gui_OBJECTS = $(am_orxonox_gui_OBJECTS) 65 orxonox_gui_LDADD = $(LDADD) 66 66 DEFAULT_INCLUDES = -I. -I$(srcdir) -I. 67 67 depcomp = $(SHELL) $(top_srcdir)/depcomp … … 76 76 CCLD = $(CC) 77 77 LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 78 SOURCES = $(orxonox_ SOURCES)79 DIST_SOURCES = $(orxonox_ SOURCES)78 SOURCES = $(orxonox_gui_SOURCES) 79 DIST_SOURCES = $(orxonox_gui_SOURCES) 80 80 INFO_DEPS = $(srcdir)/orxonox.info 81 81 am__TEXINFO_TEX_DIR = $(srcdir) … … 187 187 AM_CFLAGS = `pkg-config --cflags gtk+-2.0` 188 188 AM_LDFLAGS = `pkg-config --libs gtk+-2.0` 189 orxonox_ SOURCES = orxonox_gui.c orxonox_gui_video.c orxonox_gui_audio.c orxonox_gui_exec.c orxonox_gui_file.c\189 orxonox_gui_SOURCES = orxonox_gui.c orxonox_gui_video.c orxonox_gui_audio.c orxonox_gui_exec.c orxonox_gui_file.c\ 190 190 aclocal.m4 191 191 … … 287 287 clean-binPROGRAMS: 288 288 -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) 289 orxonox $(EXEEXT): $(orxonox_OBJECTS) $(orxonox_DEPENDENCIES)290 @rm -f orxonox $(EXEEXT)291 $(LINK) $(orxonox_ LDFLAGS) $(orxonox_OBJECTS) $(orxonox_LDADD) $(LIBS)289 orxonox_gui$(EXEEXT): $(orxonox_gui_OBJECTS) $(orxonox_gui_DEPENDENCIES) 290 @rm -f orxonox_gui$(EXEEXT) 291 $(LINK) $(orxonox_gui_LDFLAGS) $(orxonox_gui_OBJECTS) $(orxonox_gui_LDADD) $(LIBS) 292 292 293 293 mostlyclean-compile: -
orxonox/branches/bensch/orxonox_gui.c
r1820 r1829 3 3 #include "orxonox_gui_audio.h" 4 4 int verbose = 1; 5 6 7 gint delete_event ( GtkWidget *widget, GdkEvent *event, gpointer data )8 {9 return FALSE;10 }11 12 5 13 6 int main( int argc, char *argv[] ) … … 18 11 GtkWidget *hbox_view_exec; 19 12 struct settings *orxonox_settings; 13 20 14 int option_count = 7; /* important: look that this is greater than options in 'struct settings' */ 21 15 … … 25 19 26 20 orxonox_gui_file_default (orxonox_settings); 21 orxonox_gui_file_load ("~/.orxonox.conf", orxonox_settings); 27 22 28 23 … … 32 27 gtk_window_set_title ( GTK_WINDOW (window), "orxonox"); 33 28 g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL); 34 g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK ( gtk_main_quit), NULL);29 g_signal_connect (G_OBJECT (window), "destroy", G_CALLBACK (orxonox_gui_quit), orxonox_settings); 35 30 gtk_container_set_border_width (GTK_CONTAINER (window), 5); 36 31 -
orxonox/branches/bensch/orxonox_gui.h
r1822 r1829 8 8 #include <gtk/gtk.h> 9 9 #include "orxonox_gui_exec.h" 10 11 gint delete_event ( GtkWidget *widget, GdkEvent *event, gpointer data );12 10 13 11 struct settings -
orxonox/branches/bensch/orxonox_gui_exec.c
r1823 r1829 2 2 GtkWidget *exec_flags_label; 3 3 struct settings *exec_orxonox_settings; 4 5 gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data) 6 { 7 if (exec_orxonox_settings->exec_save_settings) 8 orxonox_gui_file_save("~/.orxonox.conf", exec_orxonox_settings); 9 gtk_main_quit(); 10 return FALSE; 11 } 12 4 13 5 14 void exec_check_button_change(GtkWidget *widget, int* data) … … 83 92 84 93 quit_button = gtk_button_new_with_label ("quit"); 85 g_signal_connect(GTK_BUTTON(quit_button), "clicked", G_CALLBACK( gtk_main_quit), NULL);94 g_signal_connect(GTK_BUTTON(quit_button), "clicked", G_CALLBACK(orxonox_gui_quit), NULL); 86 95 gtk_box_pack_start(GTK_BOX (orxonox_gui_exec_vbox), quit_button, FALSE, FALSE, 5); 87 96 -
orxonox/branches/bensch/orxonox_gui_exec.h
r1822 r1829 2 2 #define _ORXONOX_GUI_EXEC_H 3 3 #include "orxonox_gui.h" 4 5 gint orxonox_gui_quit ( GtkWidget *widget, GdkEvent *event, gpointer data); 4 6 5 7 void exec_check_button_change(GtkWidget *widget, int* data); -
orxonox/branches/bensch/orxonox_gui_file.c
r1817 r1829 1 #include <stdio.h>2 #include <stdlib.h>3 1 #include <sys/stat.h> 4 2 #include "orxonox_gui_file.h" … … 22 20 return; 23 21 } 22 23 void orxonox_gui_file_save (char *config_file, struct settings *orxonox_settings) 24 { 25 FILE *IOFILE; 26 char local_config_file[1000]; 27 28 sprintf(local_config_file,"%s", config_file); 29 if (!strncmp (local_config_file,"~/", 2)) 30 { 31 char buffer[100]; 32 char *homedir = getenv("HOME"); 33 sprintf(buffer, local_config_file); 34 sprintf (local_config_file,"%s/%s", homedir,buffer+2); 35 } 36 37 IOFILE = fopen( local_config_file, "w"); 38 if (verbose >= 1) 39 printf ("Saving settings to %s\n", local_config_file); 40 41 fprintf (IOFILE, "%s\n", "Configuration file of orxonox (do not edit if ou do not know what you are doing)"); 42 fprintf (IOFILE, "orxonox_settings->video_fullscreen = %i\n", orxonox_settings->video_fullscreen); 43 fprintf (IOFILE, "orxonox_settings->video_wireframe = %i\n", orxonox_settings->video_wireframe); 44 45 fprintf (IOFILE, "orxonox_settings->audio_enable_sound = %i\n", orxonox_settings->audio_enable_sound); 46 fprintf (IOFILE, "orxonox_settings->audio_music_volume = %i\n", orxonox_settings->audio_music_volume); 47 fprintf (IOFILE, "orxonox_settings->audio_effects_volume = %i\n", orxonox_settings->audio_effects_volume); 48 49 fprintf (IOFILE, "orxonox_settings->exec_save_settings = %i\n", orxonox_settings->exec_save_settings); 50 fprintf (IOFILE, "orxonox_settings->exec_show_menu = %i\n", orxonox_settings->exec_show_menu); 51 52 fprintf (IOFILE, "orxonox_settings->verbose = %i\n", verbose); 53 54 fclose( IOFILE ); 55 return; 56 } 57 58 void orxonox_gui_file_load (char *config_file, struct settings *orxonox_settings) 59 { 60 FILE *IOFILE; 61 char variable[100]; 62 char equals[5]; 63 char value[100]; 64 char buffer[100]; 65 char local_config_file[1000]; 66 67 sprintf(local_config_file,"%s", config_file); 68 if (!strncmp (config_file, "~/", 2)) 69 { 70 char *homedir = getenv("HOME"); 71 sprintf(buffer, local_config_file); 72 sprintf (local_config_file,"%s/%s", homedir, buffer+2); 73 } 74 75 76 IOFILE = fopen(local_config_file, "r"); 77 if (verbose >= 1) 78 printf ("Loading settings from '%s'\n", local_config_file); 79 80 fscanf (IOFILE, "Configuration file of orxonox (do not edit if ou do not know what you are doing)"); 81 while (fscanf (IOFILE,"%s %s %s", variable, equals, value) != EOF) 82 { 83 if ( !strcmp (variable, "orxonox_settings->video_fullscreen")) 84 { 85 orxonox_settings->video_fullscreen = atoi (value); 86 } 87 else if ( !strcmp (variable, "orxonox_settings->video_wireframe")) 88 { 89 orxonox_settings->video_wireframe = atoi (value); 90 } 91 92 else if ( !strcmp (variable, "orxonox_settings->audio_enable_sound")) 93 { 94 orxonox_settings->audio_enable_sound = atoi (value); 95 } 96 else if ( !strcmp (variable, "orxonox_settings->audio_music_volume")) 97 { 98 orxonox_settings->audio_music_volume = atoi (value); 99 } 100 else if ( !strcmp (variable, "orxonox_settings->audio_effects_volume")) 101 { 102 orxonox_settings->audio_effects_volume = atoi (value); 103 } 104 105 else if ( !strcmp (variable, "orxonox_settings->exec_save_settings")) 106 { 107 orxonox_settings->exec_save_settings = atoi (value); 108 } 109 else if ( !strcmp (variable, "orxonox_settings->exec_show_menu")) 110 { 111 orxonox_settings->exec_show_menu = atoi (value); 112 } 113 114 else if ( !strcmp (variable, "orxonox_settings->verbose")) 115 { 116 verbose = atoi (value); 117 } 118 119 } 120 fclose( IOFILE ); 121 return; 122 } 123 -
orxonox/branches/bensch/orxonox_gui_file.h
r1817 r1829 4 4 #include "orxonox_gui.h" 5 5 6 struct settings orxonox_gui_file_save (char *filename);7 struct settings orxonox_gui_file_load (char *filename);6 void orxonox_gui_file_save (char *config_file, struct settings *orxonox_settings); 7 void orxonox_gui_file_load (char *config_file, struct settings *orxonox_settings); 8 8 void orxonox_gui_file_default (struct settings *orxonox_settings); 9 9
Note: See TracChangeset
for help on using the changeset viewer.