About animated knob again

I m playing around animated knobs.
Here is an example.

http://www.freewebs.com/mergeaudio/knob.exe

Seems, the knob response is not so rapid as needed ((
Any ideas?
Thanks.

alex, I’m a bit reluctant to just run an untrusted exe, and your link looks a bit dodgy to me. Can you post your source code or explain the problem?

Sorry, Jules. Knob.cpp contains a bunch of png binary data as an array. Its about 3500 lines of code. This exe is a self extracting zip with 2 files Knob.h and Knob.c , which can be immediately attached to the project.
But if you are in a doubt, I ll try to explain.
Actual work in
void KNOB::mouseDrag (const MouseEvent & e )
method



#include "KNOB.h"



//==============================================================================
KNOB::KNOB ()
    : internalCachedImage1 (0)
	, xFrame(0), yFrame (0),wFrame (60) , hFrame(60)

{
    internalCachedImage1 = ImageCache::getFromMemory (knob_stitched_png, knob_stitched_pngSize);

    //[UserPreSize]
    //[/UserPreSize]

    setSize (60, 60);
	setRepaintsOnMouseActivity (true);

    //[Constructor] You can add your own custom stuff here..
    //[/Constructor]
}

KNOB::~KNOB()
{
    //[Destructor_pre]. You can add your own custom destruction code here..
    //[/Destructor_pre]

    ImageCache::release (internalCachedImage1);

    //[Destructor]. You can add your own custom destruction code here..
    //[/Destructor]
}

//==============================================================================
void KNOB::paint (Graphics& g)
{
    //[UserPrePaint] Add your own custom painting code here..
    //[/UserPrePaint]g.setColour (Colours::black);
    g.drawImage (internalCachedImage1,
                 0, 0 ,60 ,60,
                 xFrame, yFrame, wFrame, hFrame);

    //[UserPaint] Add your own custom painting code here..
    //[/UserPaint]
}

void KNOB::resized()
{
    //[UserResized] Add your own custom resize handling here..
    //[/UserResized]
}
void KNOB::mouseDrag (const MouseEvent & e )
{
	repaint();
	int ytmp = e.getMouseDownY();

	if ( ytmp < e.y ) 
	{ 
		if ( yFrame < (3780 - 60) ) 
		{yFrame= yFrame + 60 ; }
		else 
		{ yFrame= yFrame;}

       // repaint();
	}

		 
	
	if  ( ytmp > e.y )
	{ 
		if ( yFrame > 0 ) 
		{yFrame= yFrame - 60 ;}
		else 
		{yFrame = yFrame ; }

	//	 repaint();
	}



}




//[MiscUserCode] You can add your own definitions of your custom methods or any other code here...
//[/MiscUserCode]


//==============================================================================
#if 0
/*  -- Jucer information section --

    This is where the Jucer puts all of its metadata, so don't change anything in here!

BEGIN_JUCER_METADATA

<JUCER_COMPONENT documentType="Component" className="KNOB" componentName="" parentClasses="public Component"
                 constructorParams="" variableInitialisers="" snapPixels="8" snapActive="1"
                 snapShown="1" overlayOpacity="0.330000013" fixedSize="1" initialWidth="60"
                 initialHeight="60">
  <BACKGROUND backgroundColour="ffffff">
    <IMAGE pos="0 0 60 3780" resource="knob_stitched_png" opacity="1" mode="0"/>
  </BACKGROUND>
</JUCER_COMPONENT>

END_JUCER_METADATA
*/
#endif

//==============================================================================
// Binary resources - be careful not to edit any of these sections!

// JUCER_RESOURCE: knob_stitched_png, 221316, "\knob_stitched.png"
static const unsigned char resource_KNOB_knob_stitched_png[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,60,0,0,14,196,8,6,0,0,0,147,2,57,91,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,
156,24,0,0,0,4,103,65,77,65,0,0,177,142,124,251,81,147,0,0,0,32,99,72,82,77,0,0,122,37,0,0,128,131,0,0,249,255,0,0,128,233,0,0,117,48,0,0,234,96,0,0,58,152,0,0,23,111,146,95,197,70,0,3,95,250,73,68,65,
84,120,218,98,252,255,255,63,195,72,2,0,1,196,196,48,194,0,64,0,141,56,15,3,4,208,136,243,48,64,0,49,128,242,48,62,76,109,208,208,208,128,110,135,203,153,51,103,98,10,10,10,116,244,244,244,120,152,152,
152,24,24,25,25,105,230,63,128,0,98,36,228,41,106,90,14,2,234,234,234,12,219, .......................................................

Looks fine to me, apart from your rather bizarre way of using the mouse position. What’s the problem?

The problem is :
Knob rotation (moving the xFrame/yFrame window along entire png ) actually is not related with mouse movement. (sometimes its faster, sometimes – slower)
Probably its my rather bizarre way of using the mouse position.
What way is correct?

Yes, it’s definitely your bizarre mouse routine, which just looks like gibberish to me…

A better approach would be to use a custom-drawn Slider object - i.e. use a normal slider with a custom look and feel that draws the knob.

thank you very much.