//-------------------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------------------- void sObject::create(int sprite_id) { m_sprite_id = sprite_id; PA_CreateSprite(0, m_sprite_id, m_sprite, OBJ_SIZE_16X16, 1, m_palette_index, m_x-m_w, m_y-m_h); if(m_dead) begin_animation(1); else begin_animation(0); }
void sObject::die() { m_dead = true; begin_animation(1); }
/* * Return GtkWidget of the popup that the caller can get more control such as, * connecting some signal handlers to this widget. */ static GtkWidget* notify_new( const gchar *_caption_text, const gchar *body_text, GtkWidget* parent, GCallback click_cb, gpointer click_cb_data) { GtkWidget *win = gtk_window_new(GTK_WINDOW_POPUP); GtkWidget *context, *body, *frame; gchar *context_text = context_text = g_markup_escape_text(body_text, strlen(body_text)); gchar *caption_text = g_strdup(_caption_text); GtkWidget *imageNotify; GtkWidget *labelNotify; GtkWidget *labelCaption; GtkWidget *button; Win *w; body = gtk_vbox_new(FALSE, 2); context = gtk_hbox_new(FALSE, 0); //gtk_table_new(2, 2, TRUE); /* * load the content */ labelNotify = gtk_label_new(NULL); labelCaption = gtk_label_new(NULL); gtk_label_set_markup(GTK_LABEL(labelNotify), context_text); gtk_label_set_markup(GTK_LABEL(labelCaption), caption_text); if (icon_pixbuf) { imageNotify = gtk_image_new_from_pixbuf(icon_pixbuf); gtk_box_pack_start( GTK_BOX(context), imageNotify, FALSE, FALSE, 5); } gtk_box_pack_start(GTK_BOX(context), labelCaption, TRUE, TRUE, 0); gtk_container_add(GTK_CONTAINER(body), context); gtk_label_set_line_wrap(GTK_LABEL(labelNotify), TRUE); gtk_label_set_justify(GTK_LABEL(labelNotify), GTK_JUSTIFY_LEFT); gtk_misc_set_alignment(GTK_MISC(labelNotify), 0.0, 0.5); gtk_misc_set_padding(GTK_MISC(labelNotify), 25, 0); gtk_box_pack_start(GTK_BOX(body), labelNotify, TRUE, TRUE, 0); button = gtk_button_new(); gtk_container_add(GTK_CONTAINER(win), button); frame = gtk_frame_new(NULL); gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN); gtk_container_set_border_width(GTK_CONTAINER(frame),0); gtk_container_add(GTK_CONTAINER(button), frame); gtk_window_set_default_size(GTK_WINDOW(win), win->allocation.width, NHEIGHT); gtk_container_add(GTK_CONTAINER(frame), body); if (click_cb) g_signal_connect( G_OBJECT(button), "clicked", click_cb, click_cb_data); w = begin_animation(win, body); g_free(context_text); w->parent = parent; w->parent_handler_id = !parent ? 0 : g_signal_connect_swapped( G_OBJECT(parent), "destroy", G_CALLBACK(gtk_widget_destroy), win); g_signal_connect(G_OBJECT(win), "destroy", G_CALLBACK(destroy_win), w); return win; }