Skip to content

Commit

Permalink
partial update with sdl2, fixed gtk crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jonof committed Feb 20, 2016
1 parent f2d0683 commit 54912c4
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 18 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ ifneq (0,$(RELEASE))
debug=-fomit-frame-pointer -O2
else
# debugging enabled
debug=-ggdb -O0 -Werror
debug=-ggdb -O0
endif

include $(AUDIOLIBROOT)/Makefile.shared
Expand Down Expand Up @@ -215,7 +215,7 @@ all: sw$(EXESUFFIX) build$(EXESUFFIX)

sw$(EXESUFFIX): $(GAMEOBJS) $(ELIB)/$(ENGINELIB) $(AUDIOLIBROOT)/$(JFAUDIOLIB)
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) $(GAMELIBS) -Wl,-Map=$@.map

build$(EXESUFFIX): $(EDITOROBJS) $(ELIB)/$(EDITORLIB) $(ELIB)/$(ENGINELIB)
$(CXX) $(CXXFLAGS) $(OURCXXFLAGS) $(OURCFLAGS) -o $@ $^ $(LIBS) -Wl,-Map=$@.map

Expand Down Expand Up @@ -262,7 +262,7 @@ $(RSRC)/editor_banner.c: $(RSRC)/build.bmp
echo "#include <gdk-pixbuf/gdk-pixdata.h>" > $@
gdk-pixbuf-csource --extern --struct --rle --name=startbanner_pixdata $^ | sed '/pixel_data:/ a (guint8*)' >> $@

# PHONIES
# PHONIES
clean:
ifeq ($(PLATFORM),DARWIN)
cd osx && xcodebuild -target All clean
Expand All @@ -271,7 +271,7 @@ else
$(MAKE) -C $(EROOT) clean
$(MAKE) -C $(AUDIOLIBROOT) clean
endif

veryclean: clean
ifeq ($(PLATFORM),DARWIN)
else
Expand Down
2 changes: 1 addition & 1 deletion src/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,7 +971,7 @@ InitGame(VOID)
// sets numplayers, connecthead, connectpoint2, myconnectindex

if (!firstnet)
initmultiplayers(0, NULL, 0, 0, 0);
initmultiplayers(0, NULL);
else if (initmultiplayersparms(_buildargc - firstnet, &_buildargv[firstnet])) {
buildputs("Waiting for players...\n");
while (initmultiplayerscycle()) {
Expand Down
31 changes: 19 additions & 12 deletions src/startgtk.game.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ static void PopulateForm(int pgs)
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"inputmousecheck")), settings.usemouse);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(startwin,"inputjoycheck")), settings.usejoy);
}

if (pgs & (1<<TAB_GAME)) {
struct grpfile *fg;
int i;
GtkListStore *list;
GtkTreeIter iter;
GtkTreeView *gamelist;

gamelist = GTK_TREE_VIEW(lookup_widget(startwin,"gamelist"));
list = GTK_LIST_STORE(gtk_tree_view_get_model(gamelist));
gtk_list_store_clear(list);
Expand Down Expand Up @@ -206,7 +206,7 @@ static void on_gamelist_selection_changed(GtkTreeSelection *selection, gpointer
GtkTreeIter iter;
GtkTreeModel *model;
struct grpfile *fg;

if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
gtk_tree_model_get(model, &iter, 2, (gpointer)&fg, -1);
strcpy(settings.selectedgrp, fg->name);
Expand All @@ -225,15 +225,15 @@ static gint name_sorter(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpo
{
gchar *as, *bs;
gint r;

gtk_tree_model_get(model, a, 0, &as, -1);
gtk_tree_model_get(model, b, 0, &bs, -1);

r = g_utf8_collate(as,bs);

g_free(as);
g_free(bs);

return r;
}

Expand Down Expand Up @@ -415,7 +415,7 @@ static GtkWidget *create_window(void)
GtkListStore *list = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER);
GtkCellRenderer *cell;
GtkTreeViewColumn *col;

gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(list), 0, name_sorter, NULL, NULL);
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(list), 0, GTK_SORT_ASCENDING);

Expand Down Expand Up @@ -612,11 +612,17 @@ int startwin_open(void)
if (!gtkenabled) return 0;
if (startwin) return 1;

if (!gtk_init_check(NULL, NULL)) {
gtkenabled = 0;
return -1;
}

startwin = create_window();
if (startwin) {
SetPage(TAB_MESSAGES);
gtk_widget_show(startwin);
gtk_main_iteration_do(FALSE);
while (gtk_events_pending())
gtk_main_iteration();
return 0;
}
return -1;
Expand Down Expand Up @@ -694,7 +700,8 @@ int startwin_idle(void *s)
{
if (!gtkenabled) return 0;
//if (!startwin) return 1;
gtk_main_iteration_do (FALSE);
while (gtk_events_pending())
gtk_main_iteration();
return 0;
}

Expand All @@ -719,9 +726,9 @@ int startwin_run(void)
settings.usejoy = UseJoystick;
strncpy(settings.selectedgrp, grpfile, BMAX_PATH);
PopulateForm(-1);

gtk_main();

SetPage(TAB_MESSAGES);
if (retval) {
ScreenMode = settings.fullscreen;
Expand Down

0 comments on commit 54912c4

Please sign in to comment.