Old 2nd June 2004, 23:21   #1
PulseDriver
w3 addict
(Major Dude)
 
PulseDriver's Avatar
 
Join Date: May 2004
Location: Norway
Posts: 1,806
Ok, about color themes

Ok, I have a little problem if I am going to make color themes. As I run all -128/127 and 0-255 controls with knobs, I need some hint on how to make the pointer separate from the knob, and I can't just run the pointer, as everytime you want to adjust the volume, you have to put the mouse pointer inside where the pointer graphics ignites.

I can make an image so you get what I mean.



The script...

I'll try to shorten out the vital parts, as I run most of the functions in one script for making communications between them easier (like adjusting the volume makes the songticker show the volume percentage)

code:


#include <std.mi>

#ifndef PI
#define PI 3.1415926536
#endif

Function UpdateKnob(float v, Layer thisKnob);
Function KnobRelease(int x, int y, int thisFlag, Layer thisKnob, Map thisMap);
Function knobMove(int x, int y, int thisFlag, Layer thisKnob, Map thisMap);
Function RotateKnob(float newVal, Layer thisKnob);
Function KnobInit(Layer thisKnob);
Function KnobRotateDegree(double r, Layer thisKnob);
Function KnobRotate(double r, Layer thisKnob);
Function SongTickerUpdate(String DisplayText, int

Global Map VolumeMap;
Global Slider HiddenVolume;
Global Double KnobR;
Global Int CurrVolume, VolFrames, VolumeFlag;
Global Layer Volume;
Global Boolean ValueChanging;
Global Float VolumeLevel;
Global Double VolumeRotate;

System.onScriptLoaded() {

MainContainer = getContainer("main");
MainLayout = MainContainer.getLayout("player");

Volume = MainLayout.findObject("volume.knob");
HiddenVolume = MainLayout.findObject("volume.hidden");

ValueChanging = false;
VolumeMap = new Map;
VolumeMap.loadMap("volume.map");


KnobInit(Volume);

VolumeFlag = 0;
float u = System.getVolume();
u = u / 255;

RotateKnob(u, Volume);
}

HiddenVolume.onPostedPosition(int p) {
if (!ValueChanging) {
Float f = System.GetVolume();
f = f / 255;
RotateKnob(f, Volume);
}
}

System.onVolumeChanged(int NewVol){
int v = System.getVolume();
float k = v / 255;
int p = k * 100;
if(MutePressed){
if(MuteSwitch){
SongTickerUpdate("Mute: On", 1, 2000);
}
else{
SongTickerUpdate("Mute: Off", 1, 2000);
}
}
else{
SongTickerUpdate("Volume: " + System.integerToString(p) + "%", 1, 2000);
MuteState.setXMLParam("image", "main.hud.mute.off");
}
MutePressed = false;
}

Volume.fx_onGetPixelR(double r, double d, double x, double y) {
return r + VolumeRotate;
}

Volume.onMouseMove(int x, int y) {
KnobMove(x, y, VolumeFlag, Volume, VolumeMap);
}

Volume.onLeftButtonUp(int x, int y){
KnobRelease(x, y, VolumeFlag, Volume, VolumeMap);
}

Volume.onLeftButtonDown(int x, int y) {
ValueChanging = true;
}

System.onScriptUnloading() {
delete VolumeMap;
}

KnobMove(int x, int y, int thisFlag, Layer thisKnob, Map thisMap){
if (ValueChanging) {
x = x - thisKnob.getLeft();
y = y - thisKnob.getTop();
if (thisMap.inRegion(x, y)) {
float v = thisMap.getValue(x, y);
if (!thisFlag) {
UpdateKnob(v, thisKnob);
if (v > 245) {
thisFlag = 2;
UpdateKnob(255, thisKnob);
}
if (v < 10) {
thisFlag = 1;
UpdateKnob(0, thisKnob);
}
}
else {
if ((thisFlag == 2) && (v > 120) && (v < 252)) thisFlag = 0;
if ((thisFlag == 1) && (v < 120) && (v > 2)) thisFlag = 0;
}
}
}
}

KnobRelease(int x, int y, int thisFlag, Layer thisKnob, Map thisMap){
if (ValueChanging) {
x = x - thisKnob.getLeft();
y = y - thisKnob.getTop();
if (thisMap.inRegion(x, y)) {
float v = thisMap.getValue(x, y);
if (!thisFlag) {
UpdateKnob(v, thisKnob);
if (v > 245) {
thisFlag = 2;
UpdateKnob(255, thisKnob);
}
if (v < 10) {
thisFlag = 1;
UpdateKnob(0, thisKnob);
}
}
else {
if ((thisFlag == 2) && (v > 120) && (v < 252)) thisFlag = 0;
if ((thisFlag == 1) && (v < 120) && (v > 2)) thisFlag = 0;
}
}
ValueChanging = false;
}
}

UpdateKnob(float v, Layer thisKnob){
if(thisKnob == Volume){
if (v >= 0) {
float k = v / 255;
RotateKnob(k, thisKnob);
HiddenVolume.setPosition(v);
}
}
}

RotateKnob(float newVal, Layer thisKnob){
newVal = newVal * 270;
KnobRotateDegree(-newVal, thisKnob);
}

KnobInit(Layer thisKnob) {
thisKnob.fx_setGridSize(10,10);
thisKnob.fx_setBgFx(0);
thisKnob.fx_setWrap(0);
thisKnob.fx_setBilinear(1);
thisKnob.fx_setRect(0);
thisKnob.fx_setClear(0);
thisKnob.fx_setLocalized(1);
thisKnob.fx_setRealtime(0);
thisKnob.fx_setEnabled(1);
}

KnobRotateDegree(double r, Layer thisKnob) {
KnobRotate(r * PI / 180.0, thisKnob);
}

KnobRotate(double r, Layer thisKnob){
if(thisKnob == Volume){
VolumeRotate = r;
Volume.fx_update();
}
}




Hope you can help me, I am not sure i want to run double layers on the volume knob, just to have said that, meaing, I don't want one single knob rotating, and then the positioin rotate up that again. That would steal too much resource than needed. I think.

09 F9 11 01 9D 74 E8 5B D8 41 56 C3 63 56 81 C0
PulseDriver is offline   Reply With Quote
Old 2nd June 2004, 23:38   #2
PulseDriver
w3 addict
(Major Dude)
 
PulseDriver's Avatar
 
Join Date: May 2004
Location: Norway
Posts: 1,806
If anyone can tell me how to make the knob to be the reader, don't move and make the pointer rotate, in ghostmode I would be happy.

09 F9 11 01 9D 74 E8 5B D8 41 56 C3 63 56 81 C0
PulseDriver is offline   Reply With Quote
Old 3rd June 2004, 05:30   #3
frisbeemonkey
Major Dude
 
frisbeemonkey's Avatar
 
Join Date: Jun 2002
Posts: 851
See attached. Basically, just separate them into two layers, then send KnobRelease and KnobMove the additional layer and make sure that your existing ones rotate the correct layer. Lemme know if you have any questions.

Hope this helps,
FrisbeeMonkey
Attached Images
File Type: jpg rotatemarker.jpg (40.0 KB, 139 views)
frisbeemonkey is offline   Reply With Quote
Old 3rd June 2004, 06:37   #4
PulseDriver
w3 addict
(Major Dude)
 
PulseDriver's Avatar
 
Join Date: May 2004
Location: Norway
Posts: 1,806
Ah, I see now, I'll try to do that.

09 F9 11 01 9D 74 E8 5B D8 41 56 C3 63 56 81 C0
PulseDriver is offline   Reply With Quote
Old 3rd June 2004, 06:43   #5
matt_69
Sunshine
(Major Dude)
 
matt_69's Avatar
 
Join Date: Jan 2003
Location: Brisvegas, Australia
Posts: 1,248
OMG...FRISBEE UR BACK!!!

matt_69 is offline   Reply With Quote
Old 3rd June 2004, 07:40   #6
PulseDriver
w3 addict
(Major Dude)
 
PulseDriver's Avatar
 
Join Date: May 2004
Location: Norway
Posts: 1,806
Yes.. he's my knight in shining armor.. um.. nm that I am a guy for crying out loud, and definitivly not gay, well, he's a really great guy? That's not gay? Ok. Then he's great!

09 F9 11 01 9D 74 E8 5B D8 41 56 C3 63 56 81 C0
PulseDriver is offline   Reply With Quote
Old 3rd June 2004, 08:07   #7
matt_69
Sunshine
(Major Dude)
 
matt_69's Avatar
 
Join Date: Jan 2003
Location: Brisvegas, Australia
Posts: 1,248
its been like 8 months since he was last on here..been a long time thats all.

-matt

matt_69 is offline   Reply With Quote
Old 3rd June 2004, 08:25   #8
PulseDriver
w3 addict
(Major Dude)
 
PulseDriver's Avatar
 
Join Date: May 2004
Location: Norway
Posts: 1,806
Well, I didn't mean YOU were gay, I was just making a simple joke based on me, hehe.

Yes, I know it's been a while.

09 F9 11 01 9D 74 E8 5B D8 41 56 C3 63 56 81 C0
PulseDriver is offline   Reply With Quote
Old 3rd June 2004, 08:47   #9
PulseDriver
w3 addict
(Major Dude)
 
PulseDriver's Avatar
 
Join Date: May 2004
Location: Norway
Posts: 1,806
Well I tried this

Ok, now I have separated the layer with the knob and the layer with the pointer. What I tried to do were to add the events to the knob, and call the layer with the pointer, but it seemed to always move the knob, even if I called the pointer in the events.. (I have made all the volume functions of your to be usable by any knob) but however, I must be forgetting something.

I can't seem to make anything else than the layer being clicked up to rotate, and another strange thing happended as well. I were allowed to use an undefined identifier. I added the call for the pointer, but I didn't init any variable with that name in the beginning, but the maki compiler didn't say anything lol.

I'll post my script as is originally was here.. as an attachment. It's the original names on this, not the one I tried to alter.
Attached Files
File Type: m pulsedriver.m (15.5 KB, 143 views)

09 F9 11 01 9D 74 E8 5B D8 41 56 C3 63 56 81 C0
PulseDriver is offline   Reply With Quote
Old 4th June 2004, 06:37   #10
frisbeemonkey
Major Dude
 
frisbeemonkey's Avatar
 
Join Date: Jun 2002
Posts: 851
Haha, hey Matt, it's been awhile. Seems like you've improved quite a bit since I was last active here, good going.

Anyways, before Matt and I reminisce all over your thread, know that I haven't touched MAKI in forever. Rather than me just spout of some "sagely" advice that used to work a year ago, I'll whip up a little mock up that does what you are asking for. This way you'll get advice/suggestions that I know work, and I'll get to use the new std.mi and compiler. Everybody wins. I'll drop by later with the results.
frisbeemonkey is offline   Reply With Quote
Old 4th June 2004, 11:03   #11
carlosp
Major Dude
 
carlosp's Avatar
 
Join Date: Nov 2002
Location: Hamburg, Germany
Posts: 1,311
you seem to be a talented guy to me, like your script even if it is like a puzzle and you used a lot of pieces from other scripts but since it works it doesnt mean something. like what you did so far. your only problem is you speak to much sometimes
carlosp is offline   Reply With Quote
Old 4th June 2004, 11:47   #12
PulseDriver
w3 addict
(Major Dude)
 
PulseDriver's Avatar
 
Join Date: May 2004
Location: Norway
Posts: 1,806
Well, I found out how to do that thing. I had to make the Knob (without the pointer) a layer which, had the onMouseMove, onLeftButtonDown and onLeftButtonUp, and I made the functions call the Pointer (without the knob) to rotate, so basically, when I press and drag on the knob, the pointer is the actual layer that moves

09 F9 11 01 9D 74 E8 5B D8 41 56 C3 63 56 81 C0
PulseDriver is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Skinning and Design > Modern Skins

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump