cleaned some gtk2 code

fixed build scripts for building w/ gtk2
This commit is contained in:
punkrockguy318 2009-12-21 10:28:01 +00:00
parent a52255da8d
commit 98096d5b52
4 changed files with 52 additions and 24 deletions

View File

@ -12,7 +12,7 @@ opts.AddVariables(
BoolVariable('NEWPPU', 'Enable new PPU core', 0),
BoolVariable('CREATE_AVI', 'Enable avi creation support (SDL only)', 0),
BoolVariable('LOGO', 'Enable a logoscreen when creating avis (SDL only)', '1'),
BoolVariable('GTK2', 'Enable experimental integrated GTK2 GUI (BROKEN, Devs only!)', 0)
BoolVariable('GTK2', 'Enable experimental integrated GTK2 GUI (BROKEN, SDL Devs only!)', 0)
)
env = Environment(options = opts)
@ -60,6 +60,7 @@ else:
Exit(1)
if env['GTK2']:
# Add compiler and linker flags from pkg-config
env.Append(CPPDEFINES=["_GTK2"])
env.ParseConfig('pkg-config --cflags --libs gtk+-2.0')
### Lua platform defines
@ -112,6 +113,7 @@ else:
conf.env.Append(CPPDEFINES = ['PSS_STYLE=1'])
# parse SDL cflags/libs
env.ParseConfig('sdl-config --cflags --libs')
env.Append(CPPDEFINES=["_S9XLUA_H"])
env = conf.Finish()

View File

@ -13,29 +13,34 @@
extern Config *g_config;
// test rendering
//SDL_Surface* screen = NULL;
//SDL_Surface* hello = NULL;
// we're not using this loop right now since integrated sdl is broken
gint mainLoop(gpointer data)
{
//SDL_UpdateRect(screen, 0, 0, xres, yres);
// TODO: integrate main SDL loop here
// test render
//SDL_BlitSurface (hello, NULL, screen, NULL);
/*
SDL_UpdateRect(screen, 0, 0, xres, yres);
//SDL_Flip( screen );
SDL_BlitSurface (hello, NULL, screen, NULL);
SDL_Flip( screen );
*/
DoFun(0);
return TRUE;
}
// this is not used currently; it is used in rendering sdl in
// the gtk window which is broken
gint configureEvent (GtkWidget* widget, GdkEventConfigure* event)
{
//???
//neccessary for SDL rendering on gtk win (i think?)
//s_screen = SDL_SetVideoMode(event->width, event->height, 0, 0);
return TRUE;
@ -58,11 +63,16 @@ int InitGTKSubsystem(int argc, char** argv)
// event handlers
gtk_widget_add_events(MainWindow, GDK_BUTTON_PRESS_MASK);
gtk_signal_connect(GTK_OBJECT(MainWindow), "configure_event",
GTK_SIGNAL_FUNC(configureEvent), 0);
//gtk_signal_connect(GTK_OBJECT(MainWindow), "configure_event",
// GTK_SIGNAL_FUNC(configureEvent), 0);
// PRG: this code here is the the windowID "hack" to render SDL
// in a GTK window. however, I can't get it to work right now
// so i'm commenting it out and haivng a seperate GTK2 window with
// controls
// 12/21/09
/*
GtkWidget* socket = gtk_socket_new();
gtk_widget_show (socket) ;
gtk_container_add (GTK_CONTAINER(MainWindow), socket);
@ -83,12 +93,10 @@ int InitGTKSubsystem(int argc, char** argv)
// test rendering
//screen = SDL_SetVideoMode(xres, yres, 0, 0);
//hello = SDL_LoadBMP( "hello.bmp" );
*/
// signal handlers
g_signal_connect(G_OBJECT(MainWindow), "delete-event", gtk_main_quit, NULL);
@ -96,10 +104,6 @@ int InitGTKSubsystem(int argc, char** argv)
gtk_widget_show_all(MainWindow);
// TODO: we're not going to want to use gtk_main here so we can control
// the event loop and use SDL events rather than GTK events
//gtk_main();
//SDL_Quit();
return 0;
}

24
src/drivers/sdl/gui.h Normal file
View File

@ -0,0 +1,24 @@
// gui.h
//
// Copyright 2009 Lukas <lukas@LTx3-64>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
// MA 02110-1301, USA.
#ifndef FCEUX_GUI_H
#define FCEUX_GUI_H
int InitGTKSubsystem(int argc, char** argv);
#endif

View File

@ -13,9 +13,7 @@
#include <limits.h>
#include <math.h>
//#define GTK_GUI
#ifdef GTK_GUI
#ifdef _GTK2
#include <gtk/gtk.h>
#include "gui.cpp"
#endif
@ -685,7 +683,7 @@ SDL_GL_LoadLibrary(0);
setHotKeys();
#ifdef GTK_GUI
#ifdef _GTK2
InitGTKSubsystem(argc, argv);
#endif
@ -744,7 +742,7 @@ SDL_GL_LoadLibrary(0);
// loop playing the game
while(GameInfo) {
DoFun(frameskip);
#ifdef GTK_GUI
#ifdef _GTK2
while(gtk_events_pending())
gtk_main_iteration_do(FALSE);
#endif