コード例 #1
0
void OptionsDialog::_buildFrameAudio()
{
#ifdef _SOUNDMANAGER_H_
	Scrollbar* sc;
	Checkbox* c;
	int y = 0;
	
	mFrameAudio->mSortable = false;
	
	new Label(mFrameAudio, "", rect(0,y), "Volume");
	sc = new Scrollbar(mFrameAudio, "vol", rect(95, y, 150, 20), HORIZONTAL, MAX_VOLUME, 10, 0, NULL);
		sc->SetValue( config.GetParamInt("sound", "volume") );
	y += 25;
	
	c = new Checkbox(mFrameAudio, "", rect(0,y), "Enable Voice Chat", 0);
		c->SetState( 0 );
		c->mHoverText = "Haha, you wish";
	y += 25;
#endif
}
コード例 #2
0
/*
	Imports an avy:// url, breaks it up, configures the current settings to match,
	and then stores the original to be replaced later when saved back to Avatar Favorites
*/
void AvatarCreator::ImportUrl(string url)
{
    url = url.substr(6); //cut off avy://

    vString v;
    explode(&v, &url, ".");

    if (v.size() < 7) //Invalid Url, TODO: Some error message
        return;

    mBase = v.at(0);
    mHeadFile = mBase + ".head." + v.at(1) + ".png";
    mBodyFile = mBase + ".body." + v.at(3) + ".png";
    mHairFile = mBase + ".hair." + v.at(5) + ".png";
    mHeadColor = hexToColor(v.at(2));
    mBodyColor = hexToColor(v.at(4));
    mHairColor = hexToColor(v.at(6));

    resman->Unload(mHead);
    mHead = resman->LoadImg(DIR_AVA + mHeadFile);
    if (!mHead)
        SetError("Could not load " + mHeadFile);

    resman->Unload(mBody);
    mBody = resman->LoadImg(DIR_AVA + mBodyFile);
    if (!mBody)
        SetError("Could not load " + mBodyFile);

    resman->Unload(mHair);
    mHair = resman->LoadImg(DIR_AVA + mHairFile);
    if (!mHair)
        SetError("Could not load " + mHairFile);


    // A little more gross here, have to adjust each scrollbar to match each color :(

    Scrollbar* s;

    s = (Scrollbar*)mHeadFrame->Get("r");
    s->SetValue(mHeadColor.r);
    s = (Scrollbar*)mHeadFrame->Get("g");
    s->SetValue(mHeadColor.g);
    s = (Scrollbar*)mHeadFrame->Get("b");
    s->SetValue(mHeadColor.b);

    s = (Scrollbar*)mBodyFrame->Get("r");
    s->SetValue(mBodyColor.r);
    s = (Scrollbar*)mBodyFrame->Get("g");
    s->SetValue(mBodyColor.g);
    resman->Unload(mHead);
    mHead = resman->LoadImg(DIR_AVA + mHeadFile);
    if (!mHead)
        SetError("Could not load " + mHeadFile);

    resman->Unload(mBody);
    mBody = resman->LoadImg(DIR_AVA + mBodyFile);
    if (!mBody)
        SetError("Could not load " + mBodyFile);

    resman->Unload(mHair);
    mHair = resman->LoadImg(DIR_AVA + mHairFile);
    if (!mHair)
        SetError("Could not load " + mHairFile);

    s = (Scrollbar*)mBodyFrame->Get("b");
    s->SetValue(mBodyColor.b);

    s = (Scrollbar*)mHairFrame->Get("r");
    s->SetValue(mHairColor.r);
    s = (Scrollbar*)mHairFrame->Get("g");
    s->SetValue(mHairColor.g);
    s = (Scrollbar*)mHairFrame->Get("b");
    s->SetValue(mHairColor.b);

    // Finally, queue an update for the composite image.
    Update();
}