Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
100
Src/Wasabi/Lib/com/AutoRepeatButton.m
Normal file
100
Src/Wasabi/Lib/com/AutoRepeatButton.m
Normal file
|
@ -0,0 +1,100 @@
|
|||
//--------------------------------------------------------------------------------------------------
|
||||
// AutoRepeatButton.m Orginal Code By Will Fisher, Concept By Eric Moore, Rewritten By Will Fisher
|
||||
//
|
||||
// Use like this:
|
||||
// #include </lib/AutoRepeatButton.m>
|
||||
// Global AutoRepeatButton MyButton, MyOtherButton;
|
||||
//
|
||||
// Fill in the buttons function into MyButton.OnLeftClick() as normal.
|
||||
//
|
||||
// Use AutoRepeat_ClickType to find the type of call to MyButton.onLeftClick() where
|
||||
// AutoRepeat_ClickType==1 is the first call to onLeftClick
|
||||
// AutoRepeat_ClickType==2 is a subsequent call to onLeftClick
|
||||
// AutoRepeat_ClickType==0 is an erronious call to onLeftClick, you should usually ignore
|
||||
// MyButton.onLeftClick() in this case
|
||||
// See other functions below:
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Function AutoRepeat_Load(); // ALWAYS call this in System.OnScriptLoaded()
|
||||
Function AutoRepeat_Unload(); // ALWAYS call this in System.OnScriptUnloading()
|
||||
Function AutoRepeat_Stop(); // stop the current button from autorepeating
|
||||
|
||||
Function Button AutoRepeat_GetCurrentButton(); /* returns the currently autorepeating button,
|
||||
returns NULL if no button is autorepeating */
|
||||
|
||||
Function AutoRepeat_SetInitalDelay(int millis); /* set this for the first delay when the button is
|
||||
pressed, defaults to 800ms (no need to use this
|
||||
unless other delay is required) */
|
||||
|
||||
Function AutoRepeat_SetRepeatDelay(int millis); /* set this for the subsequent delay, defaults to
|
||||
80ms (no need to use this unless other delay is
|
||||
required) */
|
||||
|
||||
Function Int AutoRepeat_GetInitalDelay(); // get the first delay length in millisecs
|
||||
Function Int AutoRepeat_GetRepeatDelay(); // get the subsequent delay in millisecs
|
||||
|
||||
Class Button AutoRepeatButton;
|
||||
|
||||
Global Timer _autorepeatTimer;
|
||||
Global Int _InitialDelay;
|
||||
Global Int _RepeatDelay;
|
||||
Global Int AutoRepeat_ClickType;
|
||||
Global Button _Latched;
|
||||
|
||||
AutoRepeatButton.onLeftButtonDown(int x, int y) {
|
||||
_Latched = AutoRepeatButton;
|
||||
AutoRepeat_ClickType = 1; // first click
|
||||
AutoRepeatButton.leftClick();
|
||||
AutoRepeat_ClickType = 0; // no click
|
||||
_autorepeatTimer.setDelay(_InitialDelay);
|
||||
_autorepeatTimer.start();
|
||||
}
|
||||
|
||||
AutoRepeatButton.onLeftButtonUp(int x, int y) {
|
||||
_AutoRepeatTimer.Stop();
|
||||
_Latched = NULL;
|
||||
}
|
||||
|
||||
_AutoRepeatTimer.onTimer() {
|
||||
if(_autorepeatTimer.getDelay() != _RepeatDelay) _autorepeatTimer.setDelay(_RepeatDelay);
|
||||
AutoRepeat_ClickType = 2; // AutoRepeat
|
||||
_Latched.LeftClick();
|
||||
AutoRepeat_ClickType = 0; // no click
|
||||
}
|
||||
|
||||
AutoRepeat_Load() {
|
||||
_autoRepeatTimer = new Timer;
|
||||
_InitialDelay = 800;
|
||||
_RepeatDelay = 80;
|
||||
AutoRepeat_ClickType = 0;
|
||||
}
|
||||
|
||||
AutoRepeat_Unload() {
|
||||
delete _autoRepeatTimer;
|
||||
}
|
||||
|
||||
AutoRepeat_SetInitalDelay(int millis) {
|
||||
_InitialDelay = millis;
|
||||
}
|
||||
|
||||
|
||||
AutoRepeat_SetRepeatDelay(int millis) {
|
||||
_RepeatDelay = millis;
|
||||
}
|
||||
|
||||
AutoRepeat_GetInitalDelay() {
|
||||
return _InitialDelay;
|
||||
}
|
||||
|
||||
AutoRepeat_GetRepeatDelay() {
|
||||
return _repeatDelay;
|
||||
}
|
||||
|
||||
AutoRepeat_Stop() {
|
||||
_autorepeatTimer.stop();
|
||||
_Latched = NULL;
|
||||
}
|
||||
|
||||
AutoRepeat_GetCurrentButton() {
|
||||
return _Latched;
|
||||
}
|
84
Src/Wasabi/Lib/com/centerlayer.m
Normal file
84
Src/Wasabi/Lib/com/centerlayer.m
Normal file
|
@ -0,0 +1,84 @@
|
|||
// ----------------------------------------------------------------------
|
||||
// centerlayer.m
|
||||
// ----------------------------------------------------------------------
|
||||
// by Brennan
|
||||
// Use like this :
|
||||
// #define CENTER_VAR MyVar
|
||||
// Global MyVar;
|
||||
// #include "centerlayer.h"
|
||||
// Group l = ;
|
||||
// MyVar = l.getObject("something");
|
||||
// _MyVarInit(Layer MyVar, Group l, int centerx, int centery);
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
Global GuiObject _##CENTER_VAR##Layer;
|
||||
Global Group _##CENTER_VAR##Group; // parent Layout to center in
|
||||
Global Int _##CENTER_VAR##centerx; // should we center x?
|
||||
Global Int _##CENTER_VAR##centery; // should we center y?
|
||||
Global Int _##CENTER_VAR##addx = 0;
|
||||
Global Int _##CENTER_VAR##addy = 0;
|
||||
Global Int _##CENTER_VAR##addh = 0;
|
||||
Global Int _##CENTER_VAR##addw = 0;
|
||||
|
||||
Function _##CENTER_VAR##Init(GuiObject _layer, Group parentLayout, int centerx, int centery);
|
||||
Function _##CENTER_VAR##handleResize();
|
||||
Function _##CENTER_VAR##setXSpace(int val);
|
||||
Function _##CENTER_VAR##setYSpace(int val);
|
||||
Function _##CENTER_VAR##setWSpace(int val);
|
||||
Function _##CENTER_VAR##setHSpace(int val);
|
||||
Function _##CENTER_VAR##sizeError(boolean iserror);
|
||||
|
||||
_##CENTER_VAR##Init(GuiObject _layer, Group parentLayout, int centerx, int centery) {
|
||||
_##CENTER_VAR##Layer = _layer;
|
||||
_##CENTER_VAR##Group = parentLayout;
|
||||
_##CENTER_VAR##centerx = centerx;
|
||||
_##CENTER_VAR##centery = centery;
|
||||
_##CENTER_VAR##handleResize();
|
||||
}
|
||||
|
||||
_##CENTER_VAR##setXSpace(int val)
|
||||
{
|
||||
_##CENTER_VAR##addx = val;
|
||||
}
|
||||
|
||||
_##CENTER_VAR##setYSpace(int val)
|
||||
{
|
||||
_##CENTER_VAR##addy = val;
|
||||
}
|
||||
_##CENTER_VAR##setHSpace(int val)
|
||||
{
|
||||
_##CENTER_VAR##addh = val;
|
||||
}
|
||||
_##CENTER_VAR##setWSpace(int val)
|
||||
{
|
||||
_##CENTER_VAR##addw = val;
|
||||
}
|
||||
|
||||
_##CENTER_VAR##handleResize() {
|
||||
int myw = _##CENTER_VAR##Group.getWidth();
|
||||
int myh = _##CENTER_VAR##Group.getHeight();
|
||||
|
||||
int layerw = _##CENTER_VAR##Layer.getWidth();
|
||||
int layerh = _##CENTER_VAR##Layer.getHeight();
|
||||
|
||||
int x = _##CENTER_VAR##Layer.getLeft();
|
||||
int y = _##CENTER_VAR##Layer.getTop();
|
||||
|
||||
if (_##CENTER_VAR##centerx) _##CENTER_VAR##Layer.setXmlParam("x", integerToString((myw - layerw)/2 + _##CENTER_VAR##addx + _##CENTER_VAR##addw));
|
||||
if (_##CENTER_VAR##centery) _##CENTER_VAR##Layer.setXmlParam("y", integerToString((myh - layerh)/2 + _##CENTER_VAR##addy + _##CENTER_VAR##addh));
|
||||
|
||||
if (myw < layerw + 2*_##CENTER_VAR##addx - _##CENTER_VAR##addw || myh < layerh + _##CENTER_VAR##addy - _##CENTER_VAR##addh)
|
||||
{
|
||||
_##CENTER_VAR##sizeError(TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
_##CENTER_VAR##sizeError(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
_##CENTER_VAR##sizeError(boolean iserror) {}
|
||||
|
||||
_##CENTER_VAR##Group.onResize(int x, int y, int w, int h) {
|
||||
_##CENTER_VAR##handleResize();
|
||||
}
|
118
Src/Wasabi/Lib/com/customseek.m
Normal file
118
Src/Wasabi/Lib/com/customseek.m
Normal file
|
@ -0,0 +1,118 @@
|
|||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// customseek.m
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Use like this :
|
||||
// #define CUSTOM_SEEK_VAR MyVar
|
||||
// #include "customseek.m"
|
||||
//
|
||||
//
|
||||
// What you need :
|
||||
// _MyVarInit(Layer seeksurface, Layer seekghost, Map seekmap);
|
||||
// _MyVarShutdown();
|
||||
//
|
||||
|
||||
|
||||
|
||||
Global Layer _##CUSTOM_SEEK_VAR##Surface;
|
||||
Global Layer _##CUSTOM_SEEK_VAR##Ghost;
|
||||
Global Map _##CUSTOM_SEEK_VAR##Map;
|
||||
Global Int _##CUSTOM_SEEK_VAR##Clicked;
|
||||
Global Timer _##CUSTOM_SEEK_VAR##Timer;
|
||||
Global Int _##CUSTOM_SEEK_VAR##CurPos;
|
||||
|
||||
Function _##CUSTOM_SEEK_VAR##Init(Layer s, Layer g, Map m);
|
||||
Function _##CUSTOM_SEEK_VAR##Update(int newpos);
|
||||
Function _##CUSTOM_SEEK_VAR##UpdateXY(int x, int y);
|
||||
Function _##CUSTOM_SEEK_VAR##SeekTo(int x, int y);
|
||||
Function _##CUSTOM_SEEK_VAR##Shutdown();
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Init(Layer s, Layer g, Map m) {
|
||||
_##CUSTOM_SEEK_VAR##Surface = s;
|
||||
_##CUSTOM_SEEK_VAR##Ghost = g;
|
||||
_##CUSTOM_SEEK_VAR##Map = m;
|
||||
_##CUSTOM_SEEK_VAR##Update(0);
|
||||
_##CUSTOM_SEEK_VAR##Timer = new Timer;
|
||||
_##CUSTOM_SEEK_VAR##Timer.setDelay(500);
|
||||
_##CUSTOM_SEEK_VAR##Timer.start();
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Shutdown() {
|
||||
delete _##CUSTOM_SEEK_VAR##Timer;
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Surface.onLeftButtonDown(int x, int y) {
|
||||
if (getPlayItemLength() <= 0) return;
|
||||
if (Strleft(getPlayItemString(), 4) == "http") return;
|
||||
_##CUSTOM_SEEK_VAR##Clicked = 1;
|
||||
_##CUSTOM_SEEK_VAR##UpdateXY(x, y);
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Surface.onMouseMove(int x, int y) {
|
||||
if (_##CUSTOM_SEEK_VAR##Clicked) {
|
||||
if (getPlayItemLength() == 0) {
|
||||
_##CUSTOM_SEEK_VAR##Clicked = 0;
|
||||
return;
|
||||
}
|
||||
_##CUSTOM_SEEK_VAR##UpdateXY(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Surface.onLeftButtonUp(int x, int y) {
|
||||
if (!_##CUSTOM_SEEK_VAR##Clicked) return;
|
||||
_##CUSTOM_SEEK_VAR##Clicked = 0;
|
||||
_##CUSTOM_SEEK_VAR##SeekTo(x, y);
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##SeekTo(int x, int y) {
|
||||
int n = _##CUSTOM_SEEK_VAR##Map.getValue(x, y);
|
||||
seekTo(getPlayItemLength() * (n / 255));
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##UpdateXY(int x, int y) {
|
||||
int n = _##CUSTOM_SEEK_VAR##Map.getValue(x, y);
|
||||
Region r = new Region;
|
||||
r.loadFromMap(_##CUSTOM_SEEK_VAR##Map, n, 1);
|
||||
r.offset(-_##CUSTOM_SEEK_VAR##Ghost.getLeft(), -_##CUSTOM_SEEK_VAR##Ghost.getTop());
|
||||
_##CUSTOM_SEEK_VAR##Ghost.setRegion(r);
|
||||
#ifdef CUSTOM_SEEK_CALLBACK
|
||||
int n = _##CUSTOM_SEEK_VAR##Map.getValue(x, y);
|
||||
_##CUSTOM_SEEK_VAR##OnUpdate(r, getPlayItemLength() * (n / 255));
|
||||
#endif
|
||||
delete r;
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Update(int newpos) {
|
||||
float p;
|
||||
int l = getPlayItemLength();
|
||||
if (l == 0) p = 0;
|
||||
else p = newpos / l * 255;
|
||||
Region r = new Region;
|
||||
r.loadFromMap(_##CUSTOM_SEEK_VAR##Map, p, 1);
|
||||
_##CUSTOM_SEEK_VAR##CurPos = p;
|
||||
r.offset(-_##CUSTOM_SEEK_VAR##Ghost.getLeft(), -_##CUSTOM_SEEK_VAR##Ghost.getTop());
|
||||
_##CUSTOM_SEEK_VAR##Ghost.setRegion(r);
|
||||
#ifdef CUSTOM_SEEK_CALLBACK
|
||||
_##CUSTOM_SEEK_VAR##OnUpdate(r, newpos);
|
||||
#endif
|
||||
delete r;
|
||||
}
|
||||
|
||||
_##CUSTOM_SEEK_VAR##Timer.onTimer() {
|
||||
if (_##CUSTOM_SEEK_VAR##Clicked) return;
|
||||
int l = getPlayItemLength();
|
||||
if (l > 0) {
|
||||
int p = getPosition() / l * 255;
|
||||
if (p != _##CUSTOM_SEEK_VAR##CurPos) {
|
||||
_##CUSTOM_SEEK_VAR##Update(getPosition());
|
||||
}
|
||||
} else {
|
||||
if (_##CUSTOM_SEEK_VAR##CurPos != 0)
|
||||
_##CUSTOM_SEEK_VAR##Update(0);
|
||||
_##CUSTOM_SEEK_VAR##CurPos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
52
Src/Wasabi/Lib/com/debug.m
Normal file
52
Src/Wasabi/Lib/com/debug.m
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*---------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
Filename: debug.m
|
||||
Version: 1.2
|
||||
|
||||
Type: maki/attrib loader
|
||||
Date: 29. Aug. 2006 - 23:43
|
||||
Author: Martin Poehlmann aka Deimos
|
||||
E-Mail: martin@skinconsortium.com
|
||||
Internet: www.skinconsortium.com
|
||||
www.martin.deimos.de.vu
|
||||
-----------------------------------------------------
|
||||
---------------------------------------------------*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG
|
||||
#define debugString //
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
#define DEBUG_PREFIX "["+ FILE_NAME +": " + getTimeStamp() + "] " +
|
||||
|
||||
Function String getTimeStamp();
|
||||
String getTimeStamp()
|
||||
{
|
||||
int msc = getTimeOfDay();
|
||||
int h = msc / 1000 / 3600;
|
||||
msc -= h * 1000 * 3600;
|
||||
int m = msc / 1000 / 60;
|
||||
msc -= m * 1000 * 60;
|
||||
int s = msc / 1000;
|
||||
msc -= s * 1000;
|
||||
string zeros = "";
|
||||
if (msc < 100)
|
||||
{
|
||||
zeros += "0";
|
||||
}
|
||||
if (msc < 10)
|
||||
{
|
||||
zeros += "0";
|
||||
}
|
||||
return integerToString(h)+":"+integerToString(m)+":"+integerToString(s)+"."+zeros+integerToString(msc);
|
||||
}
|
||||
|
||||
#define D_WTF 9
|
||||
#define D_NWTF 9
|
||||
|
||||
#endif
|
99
Src/Wasabi/Lib/com/dispatch_ifc.m
Normal file
99
Src/Wasabi/Lib/com/dispatch_ifc.m
Normal file
|
@ -0,0 +1,99 @@
|
|||
/**
|
||||
* dispatch_ifc.m
|
||||
*
|
||||
* defines a function interface for dispatchable messaging
|
||||
* define DISPATCH before loading if you are a message reciever
|
||||
*
|
||||
* @author mpdeimos
|
||||
* @date 2008/10/25
|
||||
* @version 0.1
|
||||
*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
Function initDispatcher(); // Call this function on startup to set the parent layout as dispatcher
|
||||
Function setDispatcher(GuiObject dispatcher); // Call this function instead if you want to define a custom
|
||||
|
||||
#ifndef DISPATCH
|
||||
// Sends a message to the parent layout
|
||||
Function int sendMessage(int message, int i0, int i1, int i2, String s0, String s1, GuiObject obj);
|
||||
Function int sendMessageI(int message, int i0);
|
||||
Function int sendMessageI2(int message, int i0, int i1);
|
||||
Function int sendMessageS(int message, String s0);
|
||||
Function int sendMessageO(int message, GuiObject obj);
|
||||
Function int sendMessageV(int message);
|
||||
#endif
|
||||
|
||||
#ifdef DISPATCH
|
||||
// Recieves Messages
|
||||
Function int onMessage(int message, int i0, int i1, int i2, String s0, String s1, GuiObject obj);
|
||||
int onMessage(int message, int i0, int i1, int i2, String s0, String s1, GuiObject obj) {} // STUB! Implement this in your code
|
||||
#endif
|
||||
|
||||
|
||||
///
|
||||
/// IMPLEMENTATION
|
||||
///
|
||||
|
||||
|
||||
Global GuiObject dispatcher;
|
||||
|
||||
initDispatcher()
|
||||
{
|
||||
dispatcher = getScriptGroup().getParentLayout();
|
||||
}
|
||||
|
||||
setDispatcher(GuiObject go)
|
||||
{
|
||||
dispatcher = go;
|
||||
}
|
||||
|
||||
|
||||
#ifndef DISPATCH
|
||||
|
||||
int sendMessage(int message, int i0, int i1, int i2, String s0, String s1, GuiObject obj)
|
||||
{
|
||||
return dispatcher.onAction (s0, s1, message, i0, i1, i2, obj);
|
||||
}
|
||||
|
||||
int sendMessageI(int message, int i0)
|
||||
{
|
||||
GuiObject obj = NULL;
|
||||
return sendMessage(message, i0, i1, 0, "", "", obj);
|
||||
}
|
||||
|
||||
int sendMessageI2(int message, int i0, int i1)
|
||||
{
|
||||
GuiObject obj = NULL;
|
||||
return sendMessage(message, i0, 0, 0, "", "", obj);
|
||||
}
|
||||
|
||||
int sendMessageS(int message, String s0)
|
||||
{
|
||||
GuiObject obj = NULL;
|
||||
return sendMessage(message, 0, 0, 0, s0, "", obj);
|
||||
}
|
||||
|
||||
int sendMessageO(int message, GuiObject obj)
|
||||
{
|
||||
return sendMessage(message, 0, 0, 0, "", "", obj);
|
||||
}
|
||||
|
||||
int sendMessageV(int messagej)
|
||||
{
|
||||
GuiObject obj = NULL;
|
||||
return sendMessage(message, 0, 0, 0, "", "", obj);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef DISPATCH
|
||||
|
||||
dispatcher.onAction(String action, String param, Int message, int y, int p1, int p2, GuiObject source)
|
||||
{
|
||||
return onMessage(message, y, p1, p2, action, param, source);
|
||||
}
|
||||
|
||||
#endif
|
67
Src/Wasabi/Lib/com/dragvolume.m
Normal file
67
Src/Wasabi/Lib/com/dragvolume.m
Normal file
|
@ -0,0 +1,67 @@
|
|||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// dragvolume.m
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Use like this :
|
||||
// #define DRAG_VOLUME_VAR MyVar
|
||||
// #include "dragvolume.m"
|
||||
//
|
||||
//
|
||||
// _MyVarInit(AnimatedLayer l); // init dragvolume
|
||||
// _MyVarSetMaxDistance(Int nPixels); // set 100% pixel distance
|
||||
//
|
||||
|
||||
|
||||
|
||||
Global AnimatedLayer _##DRAG_VOLUME_VAR##AnimLayer;
|
||||
Global Int _##DRAG_VOLUME_VAR##Clicked;
|
||||
Global Int _##DRAG_VOLUME_VAR##Y;
|
||||
Global Int _##DRAG_VOLUME_VAR##V;
|
||||
Global Int _##DRAG_VOLUME_VAR##Max;
|
||||
|
||||
Function _##DRAG_VOLUME_VAR##Init(AnimatedLayer l);
|
||||
Function _##DRAG_VOLUME_VAR##Update(int vol);
|
||||
Function _##DRAG_VOLUME_VAR##SetMaxDistance(int pixels);
|
||||
Function _##DRAG_VOLUME_VAR##UpdateY(int y);
|
||||
|
||||
_##DRAG_VOLUME_VAR##Init(AnimatedLayer l) {
|
||||
_##DRAG_VOLUME_VAR##AnimLayer = l;
|
||||
_##DRAG_VOLUME_VAR##Update(getVolume());
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##AnimLayer.onLeftButtonDown(int x, int y) {
|
||||
_##DRAG_VOLUME_VAR##Clicked = 1;
|
||||
_##DRAG_VOLUME_VAR##Y = y;
|
||||
_##DRAG_VOLUME_VAR##V = getVolume();
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##AnimLayer.onMouseMove(int x, int y) {
|
||||
if (_##DRAG_VOLUME_VAR##Clicked) {
|
||||
_##DRAG_VOLUME_VAR##updateY(y);
|
||||
}
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##AnimLayer.onLeftButtonUp(int x, int y) {
|
||||
_##DRAG_VOLUME_VAR##Clicked = 0;
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##SetMaxDistance(int npix) {
|
||||
_##DRAG_VOLUME_VAR##Max = npix;
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##UpdateY(int y) {
|
||||
float p = (_##DRAG_VOLUME_VAR##Y - y) / _##DRAG_VOLUME_VAR##Max;
|
||||
SetVolume(_##DRAG_VOLUME_VAR##V + p * 255); // range is checked
|
||||
}
|
||||
|
||||
_##DRAG_VOLUME_VAR##Update(int vol) {
|
||||
float p = vol / 255;
|
||||
_##DRAG_VOLUME_VAR##AnimLayer.gotoFrame(p * (_##DRAG_VOLUME_VAR##AnimLayer.getLength()-1));
|
||||
}
|
||||
|
||||
#ifndef _##DRAG_VOLUME_VAR##NOSYSTEMHOOK
|
||||
System.onVolumeChanged(int newvol) {
|
||||
_##DRAG_VOLUME_VAR##Update(newvol);
|
||||
}
|
||||
#endif
|
173
Src/Wasabi/Lib/com/fillbar.m
Normal file
173
Src/Wasabi/Lib/com/fillbar.m
Normal file
|
@ -0,0 +1,173 @@
|
|||
/**
|
||||
* fillbar.m
|
||||
*
|
||||
* Manages custom fillbars.
|
||||
*
|
||||
* @package com.winamp.maki.lib.community.fillbar
|
||||
* @author mpdeimos
|
||||
* @date 08/10/01
|
||||
* @version 1.0
|
||||
*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
Class Layer FillBar;
|
||||
// {
|
||||
Member Map FillBar.fillmap;
|
||||
Member int FillBar.pos;
|
||||
Member boolean Fillbar.reverse;
|
||||
|
||||
// User dragging stuff
|
||||
Member boolean Fillbar.dragable;
|
||||
Member boolean Fillbar.dragging;
|
||||
|
||||
/**
|
||||
* constructor
|
||||
*
|
||||
* @param layer that should be handled like a fillbar
|
||||
* @param bitmapID that should be used as region map
|
||||
* @ret FillBar object
|
||||
*/
|
||||
Function FillBar FillBar_construct(Layer l, String bitmapID);
|
||||
Function FillBar_setMap(FillBar fb, String bitmapID);
|
||||
|
||||
/**
|
||||
* destructor, always call on script unloading
|
||||
*
|
||||
*/
|
||||
Function FillBar_destruct(FillBar fb);
|
||||
|
||||
/**
|
||||
* sets the region
|
||||
*
|
||||
* @param fillbar to act on
|
||||
* @param threshold of the map to generate a region
|
||||
*/
|
||||
Function FillBar_setPosition(FillBar fb, int threshold);
|
||||
|
||||
/**
|
||||
* called each time the users drags the fillbar
|
||||
*
|
||||
* @param The dragged FillBar
|
||||
* @param The alue the FillBar was dragged to.
|
||||
* @ret FALSE if you do not want to allow dragging.
|
||||
*/
|
||||
Function boolean FillBar_onDrag(FillBar fb, int pos);
|
||||
|
||||
/*
|
||||
* called each time the users ends dragging the fillbar
|
||||
*
|
||||
* @param The dragged FillBar
|
||||
* @param The alue the FillBar was dragged to.
|
||||
* @ret FALSE if you do not want to allow dragging.
|
||||
*/
|
||||
Function boolean FillBar_onEndDrag(FillBar fb, int pos);
|
||||
|
||||
|
||||
/*
|
||||
* IMPLEMENTATION
|
||||
*/
|
||||
|
||||
FillBar FillBar_construct(Layer l, String bitmapID)
|
||||
{
|
||||
FillBar fb = l;
|
||||
fb.reverse = TRUE;
|
||||
fb.fillmap = new Map;
|
||||
fb.fillmap.loadMap(bitmapID);
|
||||
return fb;
|
||||
}
|
||||
|
||||
FillBar_setMap(Fillbar fb, String bitmapID)
|
||||
{
|
||||
if (fb.fillmap != NULL)
|
||||
{
|
||||
delete fb.fillmap;
|
||||
}
|
||||
|
||||
fb.fillmap = new Map;
|
||||
fb.fillmap.loadMap(bitmapID);
|
||||
}
|
||||
|
||||
FillBar_destruct(FillBar fb)
|
||||
{
|
||||
Map tmp = fb.fillmap;
|
||||
delete tmp;
|
||||
}
|
||||
|
||||
FillBar_setPosition(FillBar fb, int threshold)
|
||||
{
|
||||
fb.pos = threshold;
|
||||
fb.setRegionFromMap(fb.fillmap, threshold, fb.reverse);
|
||||
}
|
||||
|
||||
|
||||
// User dragging handles
|
||||
|
||||
FillBar.onLeftButtonDown (int x, int y)
|
||||
{
|
||||
if (!FillBar.dragable)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Fillbar.dragging = TRUE;
|
||||
}
|
||||
|
||||
FillBar.onMouseMove (int x, int y)
|
||||
{
|
||||
if (!FillBar.dragable || !Fillbar.dragging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int mouseLeft = x - FillBar.getLeft();
|
||||
int mouseTop = y - Fillbar.getTop();
|
||||
|
||||
if (!FillBar.fillMap.inRegion(mouseLeft, mouseTop))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int position = FillBar.fillMap.getValue(mouseLeft, mouseTop);
|
||||
|
||||
int update = FillBar_onDrag(FillBar, position);
|
||||
|
||||
if (update)
|
||||
{
|
||||
FillBar_setPosition(FillBar, position);
|
||||
}
|
||||
}
|
||||
|
||||
Fillbar.onLeftButtonUp (int x, int y)
|
||||
{
|
||||
if (!FillBar.dragable || !Fillbar.dragging)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int mouseLeft = x - FillBar.getLeft();
|
||||
int mouseTop = y - Fillbar.getTop();
|
||||
|
||||
int position = FillBar.fillMap.getValue(mouseLeft, mouseTop);
|
||||
|
||||
if (!FillBar.fillMap.inRegion(mouseLeft, mouseTop))
|
||||
{
|
||||
position = fb.pos;
|
||||
}
|
||||
|
||||
int update = FillBar_onEndDrag(FillBar, position);
|
||||
|
||||
if (update)
|
||||
{
|
||||
FillBar_setPosition(FillBar, position);
|
||||
}
|
||||
|
||||
Fillbar.dragging = FALSE;
|
||||
}
|
||||
|
||||
// Callback Stubs
|
||||
boolean FillBar_onDrag(Fillbar fb, int pos) { return TRUE; }
|
||||
boolean FillBar_onEndDrag(Fillbar fb, int pos) { return TRUE; }
|
||||
// }
|
111
Src/Wasabi/Lib/com/glow.m
Normal file
111
Src/Wasabi/Lib/com/glow.m
Normal file
|
@ -0,0 +1,111 @@
|
|||
/*---------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
Filename: glow.m
|
||||
Version: 1.0
|
||||
|
||||
Type: maki/glow class
|
||||
Date: 16. Jun. 2007 - 23:13
|
||||
Author: Martin Poehlmann aka Deimos
|
||||
E-Mail: martin@skinconsortium.com
|
||||
Internet: www.skinconsortium.com
|
||||
www.martin.deimos.de.vu
|
||||
|
||||
Usage: 1: #include glow.m
|
||||
2: #define GLOW_OBJECT MyGlow
|
||||
3: call _MyGlow_GlowInit (someObj, otherObj)
|
||||
to init the objects.
|
||||
You can also call _MyGlow_GlowInit (NULL, otherObj)
|
||||
and load a bunch of GuiObjects in _MyGlow_GlowTrigger
|
||||
or load up to 5 objects via _MyGlow_addTarget(obj);
|
||||
|
||||
-----------------------------------------------------
|
||||
---------------------------------------------------*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
#ifndef GLOW_OBJECT
|
||||
#error GLOW_OBJECT not defined!
|
||||
#endif
|
||||
|
||||
Class GuiObject _##GLOW_OBJECT##_GlowTrigger;
|
||||
Global _##GLOW_OBJECT##_GlowTrigger _##GLOW_OBJECT##_trigger0, _##GLOW_OBJECT##_trigger1, _##GLOW_OBJECT##_trigger2, _##GLOW_OBJECT##_trigger3, _##GLOW_OBJECT##_trigger4, _##GLOW_OBJECT##_trigger5;
|
||||
Global GuiObject _##GLOW_OBJECT##_glow;
|
||||
Global float _##GLOW_OBJECT##_fdoutspeed;
|
||||
Global boolean _##GLOW_OBJECT##_mouseDown;
|
||||
|
||||
Function _##GLOW_OBJECT##_GlowInit (GuiObject triggerObject, GuiObject glowObject, float fdoutspeed);
|
||||
Function _##GLOW_OBJECT##_addTrigger (GuiObject triggerObject);
|
||||
|
||||
_##GLOW_OBJECT##_GlowInit (GuiObject triggerObject, GuiObject glowObject, float fdoutspeed)
|
||||
{
|
||||
if (triggerObject) _##GLOW_OBJECT##_trigger0 = triggerObject;
|
||||
if (glowObject) _##GLOW_OBJECT##_glow = glowObject;
|
||||
|
||||
_##GLOW_OBJECT##_fdoutspeed = fdoutspeed;
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_addTrigger(GuiObject triggerObject)
|
||||
{
|
||||
if (triggerObject)
|
||||
{
|
||||
if (!_##GLOW_OBJECT##_trigger1)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger1 = triggerObject;
|
||||
return;
|
||||
}
|
||||
if (!_##GLOW_OBJECT##_trigger2)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger2 = triggerObject;
|
||||
return;
|
||||
}
|
||||
if (!_##GLOW_OBJECT##_trigger3)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger3 = triggerObject;
|
||||
return;
|
||||
}
|
||||
if (!_##GLOW_OBJECT##_trigger4)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger4 = triggerObject;
|
||||
return;
|
||||
}
|
||||
if (!_##GLOW_OBJECT##_trigger5)
|
||||
{
|
||||
_##GLOW_OBJECT##_trigger5 = triggerObject;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_GlowTrigger.onEnterArea ()
|
||||
{
|
||||
_##GLOW_OBJECT##_glow.cancelTarget();
|
||||
_##GLOW_OBJECT##_glow.setAlpha(255);
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_GlowTrigger.onLeftButtonDown (int x, int y)
|
||||
{
|
||||
_##GLOW_OBJECT##_mouseDown = 1;
|
||||
_##GLOW_OBJECT##_glow.cancelTarget();
|
||||
_##GLOW_OBJECT##_glow.setAlpha(0);
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_GlowTrigger.onLeftButtonUp (int x, int y)
|
||||
{
|
||||
_##GLOW_OBJECT##_mouseDown = 0;
|
||||
_##GLOW_OBJECT##_glow.cancelTarget();
|
||||
if (_##GLOW_OBJECT##_GlowTrigger.isMouseOverRect()) _##GLOW_OBJECT##_glow.setAlpha(255);
|
||||
}
|
||||
|
||||
_##GLOW_OBJECT##_GlowTrigger.onLeaveArea ()
|
||||
{
|
||||
if (_##GLOW_OBJECT##_mouseDown) return;
|
||||
_##GLOW_OBJECT##_glow.cancelTarget();
|
||||
_##GLOW_OBJECT##_glow.setTargetA(0);
|
||||
_##GLOW_OBJECT##_glow.setTargetX(_##GLOW_OBJECT##_glow.getGuiX());
|
||||
_##GLOW_OBJECT##_glow.setTargetSpeed(_##GLOW_OBJECT##_fdoutspeed);
|
||||
_##GLOW_OBJECT##_glow.gotoTarget();
|
||||
}
|
||||
|
||||
#undef GLOW_OBJECT
|
176
Src/Wasabi/Lib/com/glowobject.m
Normal file
176
Src/Wasabi/Lib/com/glowobject.m
Normal file
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
||||
// }
|
108
Src/Wasabi/Lib/com/rotationlayer.m
Normal file
108
Src/Wasabi/Lib/com/rotationlayer.m
Normal file
|
@ -0,0 +1,108 @@
|
|||
//----------------------------------------------------------------------------------------
|
||||
//
|
||||
// rotationlayer.m
|
||||
//
|
||||
//----------------------------------------------------------------------------------------
|
||||
// Use like this :
|
||||
// #define ROTATION_LAYER_VAR MyVar
|
||||
// #include "rotationlayer.m"
|
||||
//
|
||||
// _MyVarInit(Group parentgroup, String layername); // init rotationlayer
|
||||
// _MyVarRotateDegree(double r); // in degrees
|
||||
// _MyVarRotate(double r); // in radians
|
||||
// double _MyVarGetRotationDegree(); // in degrees
|
||||
// double _MyVarGetRotation(); // in radians
|
||||
//
|
||||
|
||||
#ifndef PI
|
||||
#define PI 3.1415926536
|
||||
#endif
|
||||
|
||||
Global Double _##ROTATION_LAYER_VAR##R;
|
||||
Global Layer _##ROTATION_LAYER_VAR##Layer;
|
||||
|
||||
Function _##ROTATION_LAYER_VAR##Init(Group parentgroup, String layername);
|
||||
Function _##ROTATION_LAYER_VAR##RotateDegree(double r);
|
||||
Function _##ROTATION_LAYER_VAR##Rotate(double r);
|
||||
Function double _##ROTATION_LAYER_VAR##GetRotationDegree();
|
||||
Function double _##ROTATION_LAYER_VAR##GetRotation();
|
||||
|
||||
_##ROTATION_LAYER_VAR##RotateDegree(double r) {
|
||||
_##ROTATION_LAYER_VAR##Rotate(r * PI / 180.0);
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VAR##Rotate(double r) {
|
||||
_##ROTATION_LAYER_VAR##R = r;
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_update();
|
||||
}
|
||||
|
||||
double _##ROTATION_LAYER_VAR##GetRotationDegree() {
|
||||
return _##ROTATION_LAYER_VAR##R * 180 / PI;
|
||||
}
|
||||
|
||||
double _##ROTATION_LAYER_VAR##GetRotation() {
|
||||
return _##ROTATION_LAYER_VAR##R;
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VAR##Init(Group parentgroup, String layername) {
|
||||
_##ROTATION_LAYER_VAR##Layer = parentgroup.getObject(layername);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setGridSize(1,1);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setBgFx(0);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setWrap(1);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setBilinear(1);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setRect(0);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setClear(0);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setLocalized(1);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setRealtime(0);
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_setEnabled(1);
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VAR##Layer.fx_onGetPixelR(double r, double d, double x, double y) {
|
||||
return r + _##ROTATION_LAYER_VAR##R;
|
||||
}
|
||||
|
||||
//--------------------II-----------------
|
||||
Global Double _##ROTATION_LAYER_VARII##R;
|
||||
Global Layer _##ROTATION_LAYER_VARII##Layer;
|
||||
|
||||
Function _##ROTATION_LAYER_VARII##Init(Group parentgroup, String layername);
|
||||
Function _##ROTATION_LAYER_VARII##RotateDegree(double r);
|
||||
Function _##ROTATION_LAYER_VARII##Rotate(double r);
|
||||
Function double _##ROTATION_LAYER_VARII##GetRotationDegree();
|
||||
Function double _##ROTATION_LAYER_VARII##GetRotation();
|
||||
|
||||
_##ROTATION_LAYER_VARII##RotateDegree(double r) {
|
||||
_##ROTATION_LAYER_VARII##Rotate(r * PI / 180.0);
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VARII##Rotate(double r) {
|
||||
_##ROTATION_LAYER_VARII##R = r;
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_update();
|
||||
}
|
||||
|
||||
double _##ROTATION_LAYER_VARII##GetRotationDegree() {
|
||||
return _##ROTATION_LAYER_VARII##R * 180 / PI;
|
||||
}
|
||||
|
||||
double _##ROTATION_LAYER_VARII##GetRotation() {
|
||||
return _##ROTATION_LAYER_VARII##R;
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VARII##Init(Group parentgroup, String layername) {
|
||||
_##ROTATION_LAYER_VARII##Layer = parentgroup.getObject(layername);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setGridSize(1,1);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setBgFx(0);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setWrap(1);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setBilinear(1);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setRect(0);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setClear(0);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setLocalized(1);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setRealtime(0);
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_setEnabled(1);
|
||||
|
||||
}
|
||||
|
||||
_##ROTATION_LAYER_VARII##Layer.fx_onGetPixelR(double r, double d, double x, double y) {
|
||||
return r + _##ROTATION_LAYER_VAR##R;
|
||||
}
|
||||
|
104
Src/Wasabi/Lib/com/songinfo.m
Normal file
104
Src/Wasabi/Lib/com/songinfo.m
Normal file
|
@ -0,0 +1,104 @@
|
|||
/*---------------------------------------------------
|
||||
-----------------------------------------------------
|
||||
Filename: songinfo.m
|
||||
Version: 1.0
|
||||
|
||||
Type: maki/songinfo loading
|
||||
Date: 09. Sept. 2008 - 10:02
|
||||
Author: Martin Poehlmann aka Deimos
|
||||
E-Mail: martin@skinconsortium.com
|
||||
Internet: www.skinconsortium.com
|
||||
-----------------------------------------------------
|
||||
---------------------------------------------------*/
|
||||
|
||||
/**
|
||||
* This library is still in testing phase
|
||||
*/
|
||||
|
||||
#ifndef included
|
||||
#error This script can only be compiled as a #include
|
||||
#endif
|
||||
|
||||
// use this function to reload songinfo (usually do this on system.onTitleChange())
|
||||
Function songinfo_reload();
|
||||
|
||||
// use this vars to get song information (is faster than function calls)
|
||||
Global String songinfo_title;
|
||||
Global String songinfo_artist;
|
||||
Global String songinfo_album;
|
||||
Global String songinfo_location; // url or path on your hd
|
||||
Global String songinfo_displayTitle;
|
||||
|
||||
Global String songinfo_streamTitle; // similar to display title
|
||||
Global String songinfo_streamName; // name of current stream (station title)
|
||||
Global String songinfo_streamURL;
|
||||
Global String songinfo_streamAlbumArt; // _full_ URL to an image on the web, like http://images.play.it/amg/album/cov200/drh200/h238/h23853pph7b.jpg
|
||||
|
||||
Global Boolean songinfo_isStream; // true if current song is a stream
|
||||
|
||||
Global Int songinfo_streamType; // use in conjunction with the values below
|
||||
#define SONGINFO_STREAMTYPE_SHOUTCAST 2
|
||||
#define SONGINFO_STREAMTYPE_AOLRADIO 3
|
||||
#define SONGINFO_STREAMTYPE_CBSRADIO 4
|
||||
#define SONGINFO_STREAMTYPE_SHOUTCAST2 5
|
||||
#define SONGINFO_STREAMTYPE_NOSTREAM 0
|
||||
#define SONGINFO_STREAMTYPE_UNKNOWN 666
|
||||
|
||||
/////////////////////////////////////
|
||||
// IMPLEMENTATION // DO NOT MODIFY //
|
||||
/////////////////////////////////////
|
||||
|
||||
songinfo_reload()
|
||||
{
|
||||
// Fill vars with data
|
||||
songinfo_location = System.getPlayItemString();
|
||||
songinfo_displayTitle = System.getPlayItemDisplayTitle();
|
||||
|
||||
String metaPrefix = ""; // used for streams
|
||||
|
||||
// Check for a stream
|
||||
songinfo_streamType = stringToInteger(getPlayItemMetaDataString("streamtype"));
|
||||
songinfo_isStream = (songinfo_streamType > 0);
|
||||
if (songinfo_isStream) // STREAM!
|
||||
{
|
||||
if (!(songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST
|
||||
|| songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO
|
||||
|| songinfo_streamType == SONGINFO_STREAMTYPE_CBSRADIO
|
||||
|| songinfo_streamType == SONGINFO_STREAMTYPE_SHOUTCAST2))
|
||||
{
|
||||
songinfo_streamType = SONGINFO_STREAMTYPE_UNKNOWN;
|
||||
}
|
||||
|
||||
// read stream metadata
|
||||
songinfo_streamName = getPlayItemMetaDataString("streamname");
|
||||
songinfo_streamTitle = getPlayItemMetaDataString("streamtitle");
|
||||
songinfo_streamURL = getPlayItemMetaDataString("streamurl");
|
||||
|
||||
if (songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO)
|
||||
{
|
||||
metaPrefix = "uvox/";
|
||||
}
|
||||
else if (songinfo_streamType == SONGINFO_STREAMTYPE_CBSRADIO)
|
||||
{
|
||||
metaPrefix = "cbs/";
|
||||
}
|
||||
|
||||
songinfo_streamAlbumArt = getPlayItemMetaDataString(metaPrefix + "albumart");
|
||||
if (songinfo_streamType == SONGINFO_STREAMTYPE_AOLRADIO)
|
||||
{
|
||||
songinfo_streamAlbumArt = "http://broadband-albumart.music.aol.com/scan/" + songinfo_streamAlbumArt;
|
||||
}
|
||||
}
|
||||
else //NO STREAM!
|
||||
{
|
||||
// resetting stream specific values
|
||||
songinfo_streamName = "";
|
||||
songinfo_streamTitle = "";
|
||||
songinfo_streamURL = "";
|
||||
songinfo_streamAlbumArt = "";
|
||||
}
|
||||
|
||||
songinfo_title = getPlayItemMetaDataString(metaPrefix + "title");
|
||||
songinfo_artist = getPlayItemMetaDataString(metaPrefix + "artist");
|
||||
songinfo_album = getPlayItemMetaDataString(metaPrefix + "album");
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue