149 lines
4.8 KiB
Plaintext
149 lines
4.8 KiB
Plaintext
/**
|
|
* EDGAR Multicore CPU Gadget
|
|
*/
|
|
|
|
#define DBG_SHOW(_PART, _R, _G, _B) \
|
|
part { name: "dbg_show"_PART; \
|
|
type: RECT; mouse_events: 0; \
|
|
description { state: "default" 0.0; \
|
|
rel1.to: _PART; rel2.to: _PART; \
|
|
color: _R _G _B 50; } }
|
|
|
|
#define SHOW(_PART) DBG_SHOW(_PART, 50, 0, 0)
|
|
|
|
images {
|
|
image: "cpu.png" COMP;
|
|
image: "bar_bg.png" COMP;
|
|
image: "green_on.png" COMP;
|
|
image: "yellow_on.png" COMP;
|
|
image: "red_on.png" COMP;
|
|
}
|
|
|
|
|
|
collections {
|
|
/**
|
|
* API [e/gadget/icon] The group used for the icon of the gadget
|
|
*/
|
|
group { name: "e/gadgets/cpu/icon";
|
|
parts {
|
|
image { "icon";
|
|
desc { "default";
|
|
aspect: 1.0 1.0;
|
|
aspect_preference: BOTH;
|
|
image.normal: "cpu.png";
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* API [e/gadget/main] The main group of the gadget
|
|
*/
|
|
group { name: "e/gadgets/cpu/main";
|
|
data {
|
|
item: "aspect_w" "10";
|
|
item: "aspect_h" "54";
|
|
}
|
|
parts {
|
|
box { "main.box";
|
|
desc { "default";
|
|
box.layout: "horizontal";
|
|
box.min: 1 1;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
group { name: "e/gadgets/cpu/bar";
|
|
script {
|
|
public message(Msg_Type:type, id, ...) {
|
|
if ((type == MSG_FLOAT) && (id == 0)) {
|
|
new Float:val = getfarg(2);
|
|
|
|
if (val > (100 / 7 * 1)) set_state(PART:"led1", "on", 0.0);
|
|
else set_state(PART:"led1", "default", 0.0);
|
|
if (val > (100 / 7 * 2)) set_state(PART:"led2", "on", 0.0);
|
|
else set_state(PART:"led2", "default", 0.0);
|
|
if (val > (100 / 7 * 3)) set_state(PART:"led3", "on", 0.0);
|
|
else set_state(PART:"led3", "default", 0.0);
|
|
if (val > (100 / 7 * 4)) set_state(PART:"led4", "on", 0.0);
|
|
else set_state(PART:"led4", "default", 0.0);
|
|
if (val > (100 / 7 * 5)) set_state(PART:"led5", "on", 0.0);
|
|
else set_state(PART:"led5", "default", 0.0);
|
|
if (val > (100 / 7 * 6)) set_state(PART:"led6", "on", 0.0);
|
|
else set_state(PART:"led6", "default", 0.0);
|
|
|
|
// custom_state(PART:"test_bar", "default", 0.0);
|
|
// set_state_val(PART:"test_bar", STATE_REL1, 0.0, 1.0 - val / 100);
|
|
// set_state(PART:"test_bar", "custom", 0.0);
|
|
}
|
|
}
|
|
}
|
|
parts {
|
|
part { name: "bg";
|
|
desc { "default";
|
|
color: 255 255 255 200;
|
|
aspect: (10 / 54) (10 / 54); aspect_preference: BOTH;
|
|
image.normal: "bar_bg.png";
|
|
}
|
|
part { name: "led1";
|
|
desc { "default"; hid;
|
|
rel1.relative: 0.0 (1.0 / 6 * 5);
|
|
rel2.relative: 1.0 (1.0 / 6 * 6);
|
|
image.normal: "green_on.png";
|
|
}
|
|
desc { "on"; inherit: "default"; vis; }
|
|
}
|
|
part { name: "led2";
|
|
desc { "default"; hid;
|
|
rel1.relative: 0.0 (1.0 / 6 * 4);
|
|
rel2.relative: 1.0 (1.0 / 6 * 5);
|
|
image.normal: "green_on.png";
|
|
}
|
|
desc { "on"; inherit: "default"; vis; }
|
|
}
|
|
part { name: "led3";
|
|
desc { "default"; hid;
|
|
rel1.relative: 0.0 (1.0 / 6 * 3);
|
|
rel2.relative: 1.0 (1.0 / 6 * 4);
|
|
image.normal: "green_on.png";
|
|
}
|
|
desc { "on"; inherit: "default"; vis; }
|
|
}
|
|
part { name: "led4";
|
|
desc { "default"; hid;
|
|
rel1.relative: 0.0 (1.0 / 6 * 2);
|
|
rel2.relative: 1.0 (1.0 / 6 * 3);
|
|
image.normal: "yellow_on.png";
|
|
}
|
|
desc { "on"; inherit: "default"; vis; }
|
|
}
|
|
part { name: "led5";
|
|
desc { "default"; hid;
|
|
rel1.relative: 0.0 (1.0 / 6 * 1);
|
|
rel2.relative: 1.0 (1.0 / 6 * 2);
|
|
image.normal: "yellow_on.png";
|
|
}
|
|
desc { "on"; inherit: "default"; vis; }
|
|
}
|
|
part { name: "led6";
|
|
desc { "default"; hid;
|
|
rel1.relative: 0.0 (1.0 / 6 * 0);
|
|
rel2.relative: 1.0 (1.0 / 6 * 1);
|
|
image.normal: "red_on.png";
|
|
}
|
|
desc { "on"; inherit: "default"; vis; }
|
|
}
|
|
}
|
|
// rect { "test_bar";
|
|
// desc { "default";
|
|
// color: 255 255 255 50;
|
|
// rel1.relative: 0.0 1.0;
|
|
// rel1.to: "bg";
|
|
// rel2.to: "bg";
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
}
|