Skip to main content

Button

### 70102 ul.ui.button
# w,h, type, params...
bn0 0;
new.button.custom(bn0, 650,80,1, 120,100, nebula.ui.bn.fire,2, 0);
tb0:=1; while(tb0) { tb0:=ui.event(bn0);
if (tb0==ui.event.button.push) {
};
if (tb0==ui.event.button.pop) {
};
};
### 11880 nebula.ui.button
# pid, w,h, param

pid p0;
param p3;

if (r0) {
w:=p1;
h:=p2;
};

draw(r0, 11881);

type r8;
type:=param;

# events [

_ @1010;
_ @sys.ul.ui;

pressed r4;

tb0 l7;
tb0:=1;
while(tb0) {
tb0:=ui.event(pid);
if (tb0==ui.event.button.push) {
pressed:=1;
};
if (tb0==ui.event.button.pop) {
pressed:=0;
};
};

# events ]

t+=dt;
### 11881 nebula.ui.button.draw

pressed r4;

if (pressed,
color(u0, 0.5,1,0.0,1),
color(u0, 0.0,0.8,0.2,0.5));

param p3;

q w/8;

if (param==0) {
triangle(u0, 6, 0,h/2, w-q,h, w-q,0);
};
if (param==1) {
triangle(u0, 6, w,h/2, q,h, q,0);
};
if (param==2) {
triangle(u0, 6, 0,0, w/2,h, w,0);
};

new.vg.button (old)

### 70108 ul.ui.vg.button
# w,h, type, params...
# [event.id, xid].
bn0 0;
if (r0) {
new.vg.button(bn0, 0,0,1, 100,100, 0, 0);
};