All pastes #146542 Raw Edit

code

public c v1 · immutable
#146542 ·published 2006-08-23 18:03 UTC
rendered paste body
#include <stdio.h>#include <string.h>#include <errno.h>#include "pz.h"static PzModule *circle;int x, y;void draw_circle (PzWidget *wid, ttk_surface srf) {ttk_fillellipse(srf, x, y, 6, 6, ttk_makecol(255,0,0));}int event_circle (PzEvent *ev) {    switch (ev->type) {   case PZ_EVENT_BUTTON_DOWN:			switch (ev->arg) {				case PZ_BUTTON_MENU:					move_up();				break;				case PZ_BUTTON_PLAY:					move_down();					break;				case PZ_BUTTON_NEXT:					move_left();					break;				case PZ_BUTTON_PREVIOUS:					move_right();					break;			}			break;	case PZ_EVENT_DESTROY:	//ttk_free_surface (image);	//free (text);	break;    }    return 0;}int move_up(int y){y-=5;}int move_down(int y){y+=5;}int move_left(int x){x+=5;}int move_right(int x){x-=5;}PzWindow *new_circle_window(){    PzWindow *ret;    x = 25;    y=10;    ret = pz_new_window ("Circle", PZ_WINDOW_NORMAL);    pz_add_widget (ret, draw_circle, event_circle);    return pz_finish_window (ret);}void cleanup_circle() {    printf ("Bye-bye now...\n");}void init_circle() {    circle = pz_register_module ("circle", cleanup_circle);    pz_menu_add_action ("/Extras/Games/Circle", new_circle_window);}PZ_MOD_INIT (init_circle)