rendered paste body#include <stdio.h>#include <string.h>#include <errno.h>#include "pz.h"static PzModule *circle;int x, y, tmp_x, tmp_y;static PzWidget *wid;int circle_dir;void draw_circle (PzWidget *wid, ttk_surface srf) {ttk_fillellipse(srf, x, y, 6, 6, ttk_makecol(255,0,0));}void start_game(){ x = 25; y = 10; circle_dir=1;move_circle();}int event_circle (PzEvent *ev) { if (ttk_button_pressed (PZ_BUTTON_MENU)) {circle_dir=0;} if (ttk_button_pressed (PZ_BUTTON_PLAY)) {circle_dir=1;} if (ttk_button_pressed (PZ_BUTTON_PREVIOUS)) {circle_dir=2;} if (ttk_button_pressed (PZ_BUTTON_NEXT)) {circle_dir=3;} if (ttk_button_pressed (PZ_BUTTON_ACTION)) {start_game();}}int move_circle (){switch (circle_dir){ case 0: y+=5; wid->dirty++; break; case 1: y-=5; wid->dirty++; break; case 2: x-=5; wid->dirty++; break; case 3: x+=5; wid->dirty++; break;}}PzWindow *new_circle_window(){ PzWindow *ret; ret = pz_new_window ("Circle", PZ_WINDOW_NORMAL); wid = 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)