2016-01-07 16:26:59 +01:00
|
|
|
#define MEMSIZE 4096*10
|
|
|
|
|
|
|
|
#include "../lib/io.h"
|
|
|
|
#include "../lib/list_box.h"
|
|
|
|
#include "../lib/gui.h"
|
2020-04-13 16:47:37 +02:00
|
|
|
#include "../lib/fs.h"
|
2016-01-07 16:26:59 +01:00
|
|
|
|
|
|
|
struct _object
|
|
|
|
{
|
|
|
|
int x,y,w,h,id;
|
|
|
|
};
|
|
|
|
|
2020-04-13 16:47:37 +02:00
|
|
|
_object butv = { 20, 20, 100, 20, 10};
|
|
|
|
_object buta = {150, 20, 100, 20, 20};
|
2016-01-07 16:26:59 +01:00
|
|
|
|
|
|
|
char vegetables[] =
|
2020-04-13 16:47:37 +02:00
|
|
|
"Onion
|
2016-01-07 16:26:59 +01:00
|
|
|
Melon
|
|
|
|
Tomato
|
|
|
|
Squash
|
|
|
|
Salad";
|
|
|
|
|
|
|
|
char animals[] =
|
2020-04-13 16:47:37 +02:00
|
|
|
"Cat
|
2016-01-07 16:26:59 +01:00
|
|
|
Dog
|
|
|
|
Pig
|
|
|
|
Cow
|
|
|
|
Goat
|
|
|
|
Rabbit";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2020-04-13 16:47:37 +02:00
|
|
|
dword menu_id=0, click_id;
|
2016-01-07 16:26:59 +01:00
|
|
|
proc_info Form;
|
2020-04-13 16:47:37 +02:00
|
|
|
byte current_animal=1, current_veg=3;
|
2016-01-07 16:26:59 +01:00
|
|
|
int id;
|
|
|
|
|
|
|
|
loop() switch(WaitEvent())
|
|
|
|
{
|
|
|
|
case evButton:
|
|
|
|
id=GetButtonID();
|
|
|
|
if (id==1) ExitProcess();
|
|
|
|
if (id==butv.id) {
|
2020-04-13 16:47:37 +02:00
|
|
|
menu_id = butv.id;
|
|
|
|
open_lmenu(Form.left+3 + butv.x, Form.top+skin_height + butv.y + butv.h,
|
|
|
|
MENU_ALIGN_TOP_LEFT, current_veg, #vegetables);
|
2016-01-07 16:26:59 +01:00
|
|
|
}
|
|
|
|
if (id==buta.id) {
|
2020-04-13 16:47:37 +02:00
|
|
|
menu_id = buta.id;
|
|
|
|
open_lmenu(Form.left+5 + buta.x + buta.w, Form.top+skin_height + buta.y + buta.h,
|
|
|
|
MENU_ALIGN_TOP_RIGHT, current_animal, #animals);
|
2016-01-07 16:26:59 +01:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evKey:
|
|
|
|
GetKeys();
|
|
|
|
break;
|
|
|
|
|
|
|
|
case evReDraw:
|
2020-04-13 16:47:37 +02:00
|
|
|
if (click_id = get_menu_click()) {
|
|
|
|
if (menu_id == butv.id) current_veg = click_id;
|
|
|
|
if (menu_id == buta.id) current_animal = click_id;
|
|
|
|
menu_id = 0;
|
2016-01-07 16:26:59 +01:00
|
|
|
}
|
2016-11-23 12:37:13 +01:00
|
|
|
DefineAndDrawWindow(215,100,350,300,0x34,0xFFFFFF,"Window header",0);
|
2016-01-07 16:26:59 +01:00
|
|
|
GetProcessInfo(#Form, SelfInfo);
|
|
|
|
WriteText(10,110,0x80,0,#param);
|
|
|
|
DrawCaptButton(butv.x, butv.y, butv.w, butv.h, butv.id, 0xCCCccc, 0x000000, "Vegetables");
|
|
|
|
DrawCaptButton(buta.x, buta.y, buta.w, buta.h, buta.id, 0xCCCccc, 0x000000, "Aminal");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|