diff --git a/stepmania/configure.ac b/stepmania/configure.ac index 895c444333..f8018167c7 100644 --- a/stepmania/configure.ac +++ b/stepmania/configure.ac @@ -45,9 +45,17 @@ fi AM_PATH_SDL -AM_PATH_ALSA(0.9.0, alsa=true ,alsa=0 ) +AM_PATH_ALSA(0.9.0,AC_DEFINE([HAVE_ALSA],1,[Define presence of ALSA]),alsa=false) + +AC_ARG_ENABLE(gtk2,[ --enable-gtk2 enable debug mode [default=yes]], , enable_gtk2=yes) + +if test x$enable_gtk2 = xyes; then + AM_PATH_GTK_2_0(2.0.0,AC_DEFINE([HAVE_GTK],1,[Define presence of GTK]),gtk=false) +fi + AC_CHECK_HEADER(linux/soundcard.h, [AC_DEFINE(HAVE_OSS, 1, [OSS support available])]) -AM_CONDITIONAL(HAVE_ALSA, test x$alsa = xtrue ) +AM_CONDITIONAL(HAVE_ALSA, test x$alsa != xfalse ) +AM_CONDITIONAL(HAVE_GTK, test x$gtk != xfalse ) AM_CONDITIONAL(HAVE_OSS, test x$ac_cv_header_linux_soundcard_h = xyes ) # We could do this more cleanly with an AC_CHECK_FUNCS wrapper. @@ -88,6 +96,8 @@ case $host in esac AM_CONDITIONAL(DARWIN, test x$darwin = xtrue) +CFLAGS="$CFLAGS $GTK_CFLAGS" +CPPFLAGS="$CPPFLAGS $GTK_CFLAGS" # sdl-config puts -L/usr/lib in the library search path, which reorders things # in a way that breaks some configurations. diff --git a/stepmania/src/Makefile.am b/stepmania/src/Makefile.am index b5ab57527f..2680ba05c7 100644 --- a/stepmania/src/Makefile.am +++ b/stepmania/src/Makefile.am @@ -13,7 +13,6 @@ endif AM_CXXFLAGS += -O2 -ISDL-1.2.5/include -ISDL_sound-1.0.0 AM_CFLAGS += -O2 - # This is a little hacky; we use our own version of SDL and SDL_sound, and I don't # want to have to integrate their entire build systems. # Why --disable-alsa --disable-oss? Because SDL and our own @@ -31,6 +30,7 @@ AM_CFLAGS += -O2 # hanging, because... you get the idea.) Setting these switches # keep SDL from trying to grab the soundcard, so we have it all # to ourselves, thus preventing that nasty hang on boot. + SDL-1.2.5/src/.libs/libSDL.a: cd SDL-1.2.5 && ./configure \ --disable-nasm --disable-arts --disable-esd --enable-static --disable-shared --enable-debug --disable-alsa --disable-oss @@ -82,10 +82,8 @@ TitleSubstitution.cpp TitleSubstitution.h Inventory.cpp Inventory.h PlayerNumber LyricsLoader.cpp LyricsLoader.h NoteFieldPositioning.cpp NoteFieldPositioning.h \ PlayerAI.cpp PlayerAI.h Character.cpp Character.h ArrowBackdrop.cpp ArrowBackdrop.h - FileTypes = IniFile.cpp IniFile.h MsdFile.cpp MsdFile.h - StepMania = global.h ScreenDimensions.h StdString.h StepMania.cpp StepMania.h Transitions = Transition.cpp Transition.h @@ -168,22 +166,32 @@ Sound_Null = \ arch/Sound/RageSoundDriver_Null.h Sound = $(Sound_Null) + if HAVE_ALSA Sound += $(Sound_ALSA9) endif + if HAVE_OSS Sound += $(Sound_OSS) endif +Loading = arch/LoadingWindow/LoadingWindow_SDL.cpp \ + arch/LoadingWindow/LoadingWindow_SDL.h \ + arch/LoadingWindow/LoadingWindow_Null.h + +if HAVE_GTK + Loading += arch/LoadingWindow/LoadingWindow_Gtk.cpp \ + arch/LoadingWindow/LoadingWindow_Gtk.h +endif + stepmania_SOURCES = $(Rage) $(DataStructures) $(FileTypes) $(StepMania) $(Transitions) \ $(Actors) $(ActorsInMenus) $(ActorsInGameplay) $(Screens) $(GlobalSingletons) \ $(PCRE) \ + $(Loading) \ arch/arch.cpp \ + arch/arch.h \ arch/InputHandler/InputHandler_SDL.cpp \ arch/InputHandler/InputHandler_SDL.h \ - arch/LoadingWindow/LoadingWindow_SDL.cpp \ - arch/LoadingWindow/LoadingWindow_SDL.h \ - arch/LoadingWindow/LoadingWindow_Null.h \ arch/MovieTexture/MovieTexture.cpp \ $(Sound) \ arch/LowLevelWindow/LowLevelWindow.h \ @@ -196,11 +204,13 @@ stepmania_SOURCES = $(Rage) $(DataStructures) $(FileTypes) $(StepMania) $(Transi # for SDL_image. This is annoying, but it's not a major problem. The # "fix" would be to statically link SDL_image, but that would mean # dealing with its build and libjpeg, png, etc--not worth it. + stepmania_LDADD = \ $(GL_LIBS) \ $(srcdir)/SDL-1.2.5/src/.libs/libSDL.a \ $(srcdir)/SDL_sound-1.0.0/.libs/libSDL_sound.a \ - $(SDL_LIBS) + $(SDL_LIBS) \ + $(GTK_LIBS) INCLUDES = $(SDL_CFLAGS) # -O0 -g diff --git a/stepmania/src/StepMania.cpp b/stepmania/src/StepMania.cpp index 305b595a1c..7f8cce7bbf 100644 --- a/stepmania/src/StepMania.cpp +++ b/stepmania/src/StepMania.cpp @@ -52,7 +52,6 @@ /* This is also a global class; we own it. */ ArchHooks *HOOKS = NULL; - #ifdef WIN32 #ifdef DEBUG @@ -65,6 +64,10 @@ HWND g_hWndMain = NULL; #endif +#ifdef HAVE_GTK +# include +#endif + static bool g_bHasFocus = true; static bool g_bQuitting = false; @@ -433,6 +436,10 @@ int main(int argc, char* argv[]) * Do it after ChangeToDirOfExecutable, so the log ends up in the right place. */ LOG = new RageLog(); +#ifdef HAVE_GTK + gtk_init(&argc,&argv); +#endif + #ifdef DEBUG LOG->ShowConsole(); #endif diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.cpp b/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.cpp new file mode 100644 index 0000000000..f449af05bd --- /dev/null +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.cpp @@ -0,0 +1,30 @@ +#include + +static GtkWidget *label; +static GtkWidget *window; + +void CreateGtkLoadingWindow() { + GtkWidget *vbox; + GtkWidget *loadimage; + + loadimage = gtk_image_new_from_file("loading.xpm"); + label = gtk_label_new(NULL); + gtk_label_set_justify(GTK_LABEL(label),GTK_JUSTIFY_CENTER); + vbox = gtk_vbox_new(FALSE,0); + window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + gtk_container_add(GTK_CONTAINER(window),vbox); + gtk_box_pack_start(GTK_BOX(vbox),loadimage,FALSE,FALSE,10); + gtk_box_pack_start(GTK_BOX(vbox),label,TRUE,TRUE,20); + gtk_widget_show(loadimage); + gtk_widget_show(label); + gtk_widget_show(vbox); + gtk_widget_show(window); +} + +void DestroyGtkLoadingWindow() { + gtk_widget_destroy(window); +} + +void SetGtkLoadingWindowText(const char *s) { + gtk_label_set_text(GTK_LABEL(label),s); +} diff --git a/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.h b/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.h new file mode 100644 index 0000000000..fcad3ef8c7 --- /dev/null +++ b/stepmania/src/arch/LoadingWindow/LoadingWindow_Gtk.h @@ -0,0 +1,22 @@ +#ifndef LOADING_WINDOW_GTK +#define LOADING_WINDOW_GTK + +#include "LoadingWindow_Null.h" + +extern void CreateGtkLoadingWindow(); +extern void DestroyGtkLoadingWindow(); +extern void SetGtkLoadingWindowText(const char *s); + +class LoadingWindow_Gtk : public LoadingWindow { +public: + LoadingWindow_Gtk() { CreateGtkLoadingWindow(); } + ~LoadingWindow_Gtk() { DestroyGtkLoadingWindow(); } + + void SetText(CString str) { SetGtkLoadingWindowText(str.c_str()); } + void Paint() { } +}; + +#undef ARCH_LOADING_WINDOW +#define ARCH_LOADING_WINDOW LoadingWindow_Gtk + +#endif diff --git a/stepmania/src/arch/arch_linux.h b/stepmania/src/arch/arch_linux.h index 692aef6986..6c3b8787b7 100644 --- a/stepmania/src/arch/arch_linux.h +++ b/stepmania/src/arch/arch_linux.h @@ -1,6 +1,8 @@ #ifndef LINUX_ARCH_H #define LINUX_ARCH_H +#include "global.h" + #ifdef HAVE_ALSA # include "Sound/RageSoundDriver_ALSA9.h" #endif @@ -16,6 +18,10 @@ * and fix our code, not have it silently fall back on a broken driver. -glenn */ // #include "Sound/RageSoundDriver_SDL.h" +#ifdef HAVE_GTK +# include "LoadingWindow/LoadingWindow_Gtk.h" +#endif + #endif /* * Copyright (c) 2002 by the person(s) listed below. All rights reserved.