aboutsummaryrefslogtreecommitdiff
path: root/Src/Wasabi/Lib/com/glowobject.m
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Wasabi/Lib/com/glowobject.m
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Wasabi/Lib/com/glowobject.m')
-rw-r--r--Src/Wasabi/Lib/com/glowobject.m176
1 files changed, 176 insertions, 0 deletions
diff --git a/Src/Wasabi/Lib/com/glowobject.m b/Src/Wasabi/Lib/com/glowobject.m
new file mode 100644
index 00000000..1d4eff3a
--- /dev/null
+++ b/Src/Wasabi/Lib/com/glowobject.m
@@ -0,0 +1,176 @@
+/**
+ * glowobject.m
+ *
+ * @package com.winamp.maki.lib.community.glowobject
+ * @author mpdeimos
+ * @date 18/10/01
+ * @version 1.0
+ */
+
+
+#ifndef included
+#error This script can only be compiled as a #include
+#endif
+
+#define GLOW_TYPE_HOLD 0
+#define GLOW_TYPE_FLASH 1
+#define GLOW_TYPE_BOUNCE 2
+
+Class GuiObject GlowLayer;
+// {
+ Member GuiObject GlowLayer.trigger;
+// }
+
+Class GuiObject GlowObject;
+// {
+ Member float GlowObject.fadeInSpeed;
+ Member float GlowObject.fadeOutSpeed;
+ Member int GlowObject.glowType;
+ Member boolean GlowObject.glowing;
+
+ Member GuiObject GlowObject.glow;
+
+ /**
+ * constructor
+ *
+ * @param GuiObject that will be used to trigger the glow on mouse entering it's region
+ * @param the glowing object
+ * @ret GlowObject object
+ */
+ Function GlowObject GlowObject_construct(GlowObject trigger, GlowLayer glow);
+
+ /**
+ * sets fade in time
+ *
+ * @param GlowObject to act on
+ * @param milliseconds till the glow is at alpha 255
+ */
+ Function GlowObject_setFadeInSpeed(GlowObject go, float ms);
+
+ /**
+ * sets fade out time
+ *
+ * @param GlowObject to act on
+ * @param milliseconds till the glow is at alpha 0
+ */
+ Function GlowObject_setFadeOutSpeed(GlowObject go, float ms);
+
+ /**
+ * sets the glowtype used by this glow button.
+ *
+ * @param GlowObject to act on
+ * @param glowType defined via GLOW_TYPE_*
+ */
+ Function GlowObject_setGlowType(GlowObject go, int glowType);
+
+
+ /*
+ * IMPLEMENTATION
+ */
+
+ GlowObject GlowObject_construct(GlowObject trigger, GlowLayer glow)
+ {
+ if (trigger == null)
+ {
+ debug("trigger");
+ }
+ if (glow == NULL)
+ {
+ debug("glow");
+ }
+
+ GlowObject go = trigger;
+ go.fadeInSpeed = 0.3;
+ go.fadeOutSpeed = 0.5;
+ go.glow = glow;
+ go.glowType = GLOW_TYPE_HOLD;
+ go.glowing = false;
+ glow.trigger = trigger;
+ return go;
+ }
+
+ GlowObject_setFadeInSpeed(GlowObject go, float ms)
+ {
+ go.fadeInSpeed = ms;
+ }
+
+ GlowObject_setFadeOutSpeed(GlowObject go, float ms)
+ {
+ go.fadeOutSpeed = ms;
+ }
+
+ GlowObject_setGlowType(GlowObject go, int glowType)
+ {
+ go.glowType = glowType;
+ }
+
+ GlowObject.onEnterArea ()
+ {
+ GlowObject.glowing = true;
+ GlowObject.glow.cancelTarget();
+ GlowObject.glow.setTargetA(255);
+ GlowObject.glow.setTargetSpeed(GlowObject.fadeInSpeed);
+ GlowObject.glow.gotoTarget();
+ }
+
+ GlowObject.onLeaveArea ()
+ {
+ GlowObject.glowing = false;
+ if (GlowObject.glowType != GLOW_TYPE_FLASH)
+ {
+ GlowObject.glow.cancelTarget();
+ GlowObject.glow.setTargetA(0);
+ GlowObject.glow.setTargetSpeed(GlowObject.fadeOutSpeed);
+ GlowObject.glow.gotoTarget();
+ }
+ }
+
+ GlowLayer.onTargetReached ()
+ {
+ GlowObject go = GlowLayer.trigger;
+ if (go.glowType == GLOW_TYPE_HOLD)
+ {
+ return;
+ }
+ else if (go.glowType == GLOW_TYPE_FLASH)
+ {
+ if (GlowLayer.getAlpha() == 255)
+ {
+ GlowLayer.cancelTarget();
+ GlowLayer.setTargetA(0);
+ GlowLayer.setTargetSpeed(GlowObject.fadeOutSpeed);
+ GlowLayer.gotoTarget();
+ }
+ }
+ else if (go.glowType == GLOW_TYPE_BOUNCE)
+ {
+ if (GlowLayer.getAlpha() == 255)
+ {
+ GlowLayer.cancelTarget();
+ GlowLayer.setTargetA(0);
+ GlowLayer.setTargetSpeed(GlowObject.fadeOutSpeed);
+ GlowLayer.gotoTarget();
+ }
+ else if (GlowLayer.getAlpha() == 0 && go.glowing)
+ {
+ GlowLayer.cancelTarget();
+ GlowLayer.setTargetA(255);
+ GlowLayer.setTargetSpeed(GlowObject.fadeInSpeed);
+ GlowLayer.gotoTarget();
+ }
+ }
+ }
+
+ GlowObject.onSetVisible (Boolean onoff)
+ {
+ if (onoff)
+ {
+ GlowObject.glow.show();
+ }
+ else
+ {
+ GlowObject.glow.hide();
+ }
+
+ }
+// }