Commit b62a727d authored by Steven Fuller's avatar Steven Fuller

several week old gtk+ code changes...

parent f4003e54
...@@ -3,11 +3,12 @@ complete: ...@@ -3,11 +3,12 @@ complete:
07/22/01 fix cmap problem at 8bit (Want to change cmaps when going into/from gtk+ menu) 07/22/01 fix cmap problem at 8bit (Want to change cmaps when going into/from gtk+ menu)
07/23/01 New Game 07/23/01 New Game
------------------ ------------------
finished double buffered gtk+ image finish double buffered gtk+ image
Save Game, Load Game Save Game, Load Game
find keyboard way of changing focus find keyboard way of changing focus (and change focus when keyboard accelerator used)
fix sprite snapping
all visuals (loader and drawer code will need to be modified) all visuals (loader and drawer code will need to be modified)
fix sprite snapping
get rid of byteswapping
check bigendianesss check bigendianesss
choose difficulty (with graphics from game if possible) choose difficulty (with graphics from game if possible)
Psyched bar Psyched bar
...@@ -37,12 +38,13 @@ try to speed drawing up ...@@ -37,12 +38,13 @@ try to speed drawing up
play through testing play through testing
update copyrights where needed update copyrights where needed
Documentation Documentation
website (no sourceforge this time)
--------- release one anytime after this point --------- --------- release one anytime after this point ---------
SDL support (for full screen), optional
configure (automake, autoconf, etc?) configure (automake, autoconf, etc?)
website (no sourceforge this time) SDL support (for full screen), optional
finish opengl version
in game menus instead of gtk+ gui in game menus instead of gtk+ gui
finish opengl version
experiement with software interpolation at truecolor modes
level editor level editor
TODO: TODO:
......
...@@ -374,8 +374,10 @@ void PlayLoop(void) ...@@ -374,8 +374,10 @@ void PlayLoop(void)
} while ((Timer-LastTicCount) < Delay); } while ((Timer-LastTicCount) < Delay);
TicCount = (Timer-LastTicCount); TicCount = (Timer-LastTicCount);
/* /*
printf("Timer: %d, Tic = %d\n", Timer, TicCount); if (TicCount > 1)
printf("Timer: %d, Tic = %d\n", Timer, TicCount);
*/ */
gamestate.playtime += TicCount; gamestate.playtime += TicCount;
LastTicCount=Timer; LastTicCount=Timer;
......
...@@ -53,6 +53,22 @@ static int image_focus = 1; ...@@ -53,6 +53,22 @@ static int image_focus = 1;
void Quit(); void Quit();
void RestoreColors()
{
int i;
for (i = 0; i < cmap->size; i++)
gdk_color_change(cmap, &default_colors[i]);
}
void UpdateColors()
{
int i;
for (i = 0; i < cmap->size; i++)
gdk_color_change(cmap, &game_colors[i]);
}
gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) gint delete_event(GtkWidget *widget, GdkEvent *event, gpointer data)
{ {
g_print("delete_event\n"); g_print("delete_event\n");
...@@ -64,61 +80,59 @@ void destroy(GtkWidget *widget, gpointer data) ...@@ -64,61 +80,59 @@ void destroy(GtkWidget *widget, gpointer data)
Quit(NULL); Quit(NULL);
} }
static void menu_file_quit(GtkWidget *w, gpointer data)
{
destroy(w, data);
}
static void menu_file_newgame(GtkWidget *w, gpointer data) static void menu_file_newgame(GtkWidget *w, gpointer data)
{ {
longjmp(ResetJmp, EX_NEWGAME); longjmp(ResetJmp, EX_NEWGAME);
} }
void RestoreColors() static void menu_file_savegame(GtkWidget *w, gpointer data)
{ {
int i;
for (i = 0; i < cmap->size; i++)
gdk_color_change(cmap, &default_colors[i]);
} }
void UpdateColors() static void menu_file_loadgame(GtkWidget *w, gpointer data)
{ {
int i;
for (i = 0; i < cmap->size; i++)
gdk_color_change(cmap, &game_colors[i]);
} }
static void menu_file_quit(GtkWidget *w, gpointer data)
{
destroy(w, data);
}
static void image_focus_in(GtkWidget *widget, GdkEventButton *event, gpointer data) static gboolean image_focus_in(GtkWidget *widget, GdkEventButton *event, gpointer data)
{ {
UpdateColors(); UpdateColors();
image_focus = 1; image_focus = 1;
return FALSE;
} }
static void image_focus_out(GtkWidget *widget, GdkEventButton *event, gpointer data) static gboolean image_focus_out(GtkWidget *widget, GdkEventButton *event, gpointer data)
{ {
RestoreColors(); RestoreColors();
image_focus = 0; image_focus = 0;
return FALSE;
} }
static int KeyPressed; static int KeyPressed;
void keyboard_handler(int key, int press); void keyboard_handler(int key, int press);
static void key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) static gboolean key_press(GtkWidget *widget, GdkEventKey *event, gpointer data)
{ {
/* g_print("press\n"); */ /* g_print("press\n"); */
keyboard_handler(event->keyval, 1); keyboard_handler(event->keyval, 1);
return FALSE;
} }
static void key_release(GtkWidget *widget, GdkEventKey *event, gpointer data) static gboolean key_release(GtkWidget *widget, GdkEventKey *event, gpointer data)
{ {
/* g_print("release\n"); */ /* g_print("release\n"); */
keyboard_handler(event->keyval, 0); keyboard_handler(event->keyval, 0);
KeyPressed = 1; KeyPressed = 1;
return FALSE;
} }
static void draw(GtkWidget *widget, GdkRectangle *area, gpointer user_data) static void draw(GtkWidget *widget, GdkRectangle *area, gpointer user_data)
...@@ -133,7 +147,11 @@ static void draw_default(GtkWidget *widget, gpointer user_data) ...@@ -133,7 +147,11 @@ static void draw_default(GtkWidget *widget, gpointer user_data)
static GtkItemFactoryEntry menu_items[] = { static GtkItemFactoryEntry menu_items[] = {
{ "/_File", NULL, NULL, 0, "<Branch>" }, { "/_File", NULL, NULL, 0, "<Branch>" },
{ "/File/New Game", NULL, menu_file_newgame, 0, NULL }, { "/File/New Game", NULL, menu_file_newgame, 0, NULL },
{ "/File/_", NULL, NULL, 0, "<Separator>" },
{ "/File/Save Game", NULL, menu_file_savegame, 0, NULL },
{ "/File/Load Game", NULL, menu_file_loadgame, 0, NULL },
{ "/File/_", NULL, NULL, 0, "<Separator>" },
{ "/File/Quit", "<control>Q", menu_file_quit, 0, NULL } { "/File/Quit", "<control>Q", menu_file_quit, 0, NULL }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment