#include #include "pz.h" #include #include #include #include static PzModule *module; static TWindow *window; static TWidget *wid; static int w, h, bpp; static char hello[100]; //hello world static char menu[100]; void draw_module (PzWidget *wid, ttk_surface srf) { h=ttk_screen->h; //just do all of those w=ttk_screen->w; sys = (wid->x + wid->w)/2; ttk_color fg = ttk_ap_getx("window.fg")->color; sprintf(hello,"HELLO WORLD I'M A LIVE AND PETER ROCKS!"); //sprintf rightbefore ttk text, doesnt have to go here but i like to put it before the ttk text ttk_text (srf,ttk_textfont, (sys)-(ttk_text_width(ttk_textfont,hello)/2), 50, ttk_makecol(0,0,255),hello); //displays the text centered sprintf(menu,"press menu to quit"); } static int event_helloworld (PzEvent *e) { int ret = TTK_EV_CLICK; switch(e->type) { case PZ_EVENT_SCROLL: //scroll function TTK_SCROLLMOD( e->arg, 10); if( e->arg > 0){break;} //forward scroll else {break;} //backwards scroll case PZ_EVENT_BUTTON_DOWN: // or "case PZ_EVENT_BUTTON_UP:" switch (e->arg) { case PZ_BUTTON_ACTION: //center / action button break; case PZ_BUTTON_MENU: //menu button pz_close_window(wi->win) break; case PZ_BUTTON_PLAY: //play button break; case PZ_BUTTON_NEXT: //forward button break; case PZ_BUTTON_PREVIOUS: //previous button break; case PZ_BUTTON_HOLD : break; /*hold if used BUTTON_DOWN reacts imediatly if BUTTON_UP reacts when hold is released*/ default: ret = TTK_EV_UNUSED; //do nothing if not buttons pressed } break; case PZ_EVENT_TIMER: //timer function break; default: ret = TTK_EV_UNUSED; //do nothing break; } return ret; } PzWindow *new_helloworld_window() { window = pz_new_window ("MODULENAME", PZ_WINDOW_NORMAL); wid = pz_add_widget(window, draw_module, event_module); return pz_finish_window (window); } void cleanup_helloworld() { } void init_helloworld() { w =ttk_screen->w; //gets screen width h =ttk_screen->h; //gets screen hieght bpp =ttk_screen->bpp; //gets colour depth module = pz_register_module ("helloworld", cleanup_helloworld); pz_menu_add_action ("/Extras/Games/Module", new_helloworld_window); } PZ_MOD_INIT (init_helloworld)