All pastes #148949 Raw Edit

Someone

public text v1 · immutable
#148949 ·published 2006-08-25 13:39 UTC
rendered paste body
/* Free for absolutely any use whatsoever. */

#include <stdio.h>
#include <string.h>
#include <errno.h>
#include "pz.h"

static PzModule *module;
static PzWidget *wid;
static ttk_surface srf;
int ball_x, ball_y;

void draw_ball(ttk_surface srf, int x, int y)
{
ttk_ellipse(srf, x, y, 7, 7, ttk_makecol(0,0,0));
ttk_fillellipse(srf, x, y, 6, 6, ttk_makecol(255,255,255));
} 

void draw_shooutout (PzWidget *wid, ttk_surface srf) 
{
ttk_fillrect(srf, 0, 0, ttk_screen->w, ttk_screen->h, ttk_makecol(0,155,0));
draw_ball(srf, ball_x, ball_y);
}



int event_shooutout (PzEvent *ev) 
{
    switch (ev->type) {
    case PZ_EVENT_BUTTON_UP:
	pz_close_window (ev->wid->win);
	break;
    case PZ_EVENT_DESTROY:
	break;
    }
    return 0;
}

PzWindow *new_shooutout_window()
{
ball_x = (ttk_screen->w)/2;
ball_y = (ttk_screen->h)/2;
    PzWindow *ret;
    ret = pz_new_window ("Penalty Shootout", PZ_WINDOW_NORMAL);
    wid = pz_add_widget (ret, draw_shooutout, event_shooutout);
    return pz_finish_window (ret);
}

void cleanup_shooutout() 
{
    printf ("Bye-bye now...\n");
}

void init_shooutout() 
{
    module = pz_register_module ("shootout", cleanup_shooutout);
    pz_menu_add_action ("/Extras/Demos/Penalty Shootout", new_shooutout_window);
    printf ("Hi! Penalty Shootout loaded, action set.\n");
}

PZ_MOD_INIT (init_shooutout)