Skip to content
Snippets Groups Projects
Select Git revision
  • 64ff48c55c9ef2e050bc4d6a39e1bef374c4d08c
  • 2022ws default protected
  • MPeth-2022ws-patch-01682
  • 2021ws
  • 2020ws
  • 2019ws
  • 2019ss
  • 2018ws
  • 2017ws
  • 2017ss
  • 2016ws
  • 2016ss
  • 2015ss
13 results

pgslides.sty

Blame
  • Forked from Peter Gerwinski / es
    Source project has a limited visibility.
    wurf-02.c NaN GiB
    #include <gtk/gtk.h>
    
    #define WIDTH 1024
    #define HEIGHT 768
    
    double x = 137;
    double y = 255;
    
    static void draw (GtkDrawingArea *drawing_area, cairo_t *c,
                      int width, int height, gpointer user_data)
    {
      GdkRGBA blue = { 0.0, 0.5, 1.0, 1.0 };
    
      gdk_cairo_set_source_rgba (c, &blue);
      cairo_arc (c, x, y, 10, 0, 2 * G_PI);
      cairo_fill (c);
    }
    
    gboolean timer (GtkWidget *widget)
    {
      x += 3;
      y += 2;
      gtk_widget_queue_draw (widget);
      g_timeout_add (50, (GSourceFunc) timer, widget);
      return FALSE;
    }
    
    static void activate (GtkApplication *app, gpointer user_data)
    {
      GtkWidget *window = gtk_application_window_new (app);
      gtk_window_set_title (GTK_WINDOW (window), "Hello");
    
      GtkWidget *vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 5);
      gtk_window_set_child (GTK_WINDOW (window), vbox);
    
      GtkWidget *drawing_area = gtk_drawing_area_new ();
      gtk_widget_set_size_request (drawing_area, WIDTH, HEIGHT);
      gtk_drawing_area_set_draw_func (GTK_DRAWING_AREA (drawing_area), draw, NULL, NULL);
      gtk_box_append (GTK_BOX (vbox), drawing_area);
    
      GtkWidget *quit_button = gtk_button_new_with_label ("Quit");
      g_signal_connect_swapped (quit_button, "clicked", G_CALLBACK (gtk_window_destroy), window);
      gtk_box_append (GTK_BOX (vbox), quit_button);
    
      g_timeout_add (50, (GSourceFunc) timer, drawing_area);
    
      gtk_window_present (GTK_WINDOW (window));
    }
    
    int main (int argc, char **argv)
    {
      GtkApplication *app = gtk_application_new ("de.hs-bochum.cvh.hp.hello-gtk", G_APPLICATION_DEFAULT_FLAGS);
      g_signal_connect (app, "activate", G_CALLBACK (activate), NULL);
      int status = g_application_run (G_APPLICATION (app), argc, argv);
      g_object_unref (app);
      return status;
    }