示例#1
0
    virtual void onDraw(SkCanvas* canvas) {

        SkRect r = SkRect::MakeWH(FILTER_WIDTH, FILTER_HEIGHT);
        SkPaint paint;
        paint.setColor(SK_ColorRED);
        canvas->save();
        for (float brightness = -1.0f; brightness <= 1.0f; brightness += 0.2f) {
            SkAutoTUnref<SkImageFilter> dim(make_brightness(-brightness));
            SkAutoTUnref<SkImageFilter> bright(make_brightness(brightness, dim));
            paint.setImageFilter(bright);
            drawClippedRect(canvas, r, paint);
            canvas->translate(FILTER_WIDTH + MARGIN, 0);
        }
        canvas->restore();
        canvas->translate(0, FILTER_HEIGHT + MARGIN);
        {
            SkAutoTUnref<SkImageFilter> brightness(make_brightness(0.9f));
            SkAutoTUnref<SkImageFilter> grayscale(make_grayscale(brightness));
            paint.setImageFilter(grayscale);
            drawClippedRect(canvas, r, paint);
            canvas->translate(FILTER_WIDTH + MARGIN, 0);
        }
        {
            SkAutoTUnref<SkImageFilter> grayscale(make_grayscale());
            SkAutoTUnref<SkImageFilter> brightness(make_brightness(0.9f, grayscale));
            paint.setImageFilter(brightness);
            drawClippedRect(canvas, r, paint);
            canvas->translate(FILTER_WIDTH + MARGIN, 0);
        }
        {
            SkAutoTUnref<SkImageFilter> blue(make_mode_blue());
            SkAutoTUnref<SkImageFilter> brightness(make_brightness(1.0f, blue));
            paint.setImageFilter(brightness);
            drawClippedRect(canvas, r, paint);
            canvas->translate(FILTER_WIDTH + MARGIN, 0);
        }
        {
            SkAutoTUnref<SkImageFilter> brightness(make_brightness(1.0f));
            SkAutoTUnref<SkImageFilter> blue(make_mode_blue(brightness));
            paint.setImageFilter(blue);
            drawClippedRect(canvas, r, paint);
            canvas->translate(FILTER_WIDTH + MARGIN, 0);
        }
        {
            SkAutoTUnref<SkImageFilter> blur(make_blur(3.0f));
            SkAutoTUnref<SkImageFilter> brightness(make_brightness(0.5f, blur));
            paint.setImageFilter(brightness);
            drawClippedRect(canvas, r, paint, 3);
            canvas->translate(FILTER_WIDTH + MARGIN, 0);
        }
        {
            SkAutoTUnref<SkImageFilter> blue(make_mode_blue());
            paint.setImageFilter(blue.get());
            drawClippedRect(canvas, r, paint, 5);
            canvas->translate(FILTER_WIDTH + MARGIN, 0);
        }
    }
示例#2
0
void SLCD::flash(int count, int delayMs) {
	
	for (int i=0 ; i < count; i++) {
		brightness(0);
		delay(delayMs%1000);
		brightness(100);
		delay(delayMs%1000);
	}
	
}
示例#3
0
QPixmap ImageFilter::operator ()(QPixmap sourcePixmap, Filter::FilterType filter, int delta)
{
    QImage origin(sourcePixmap.toImage());

    switch (filter)
    {
    case Filter::Gray_Scale:
        return grayScale(origin);
        break;
    case Filter::Brightness:
        return brightness(origin, delta);
        break;
    case Filter::Temperature:
        return temperature(origin, delta);
        break;
    case Filter::Saturation:
        return saturate(origin, delta);
        break;
    case Filter::Blur:
        return blur(origin);
        break;
    case Filter::Sharpen:
        return sharpen(origin);
        break;
    case Filter::Sepia:
        return sepia(origin);
        break;
    }
}
示例#4
0
void KQtTester::testImageEffects()
{
    QString report = QString("execute %1 times:\n").arg(g_nTimes);

    report += QString("none:\t%1\tms\n").arg(none());
    m_pPainter->translate(g_img.width() + 10, 0);
    report += QString("gray:\t%1\tms\n").arg(gray());
    m_pPainter->translate(g_img.width() + 10, 0);
    report += QString("watermark:\t%1\tms\n").arg(watermark());
    m_pPainter->translate(g_img.width() + 10, 0);
    report += QString("bilevel:\t%1\tms\n").arg(bilevel());

    m_pPainter->resetMatrix();
    m_pPainter->translate(0, g_img.height() + 10);
    report += QString("lightBlue:\t%1\tms\n").arg(lightBlue());
    m_pPainter->translate(g_img.width() + 10, 0);
    report += QString("darkBlue:\t%1\tms\n").arg(darkBlue());

    m_pPainter->resetMatrix();
    m_pPainter->translate(0, (g_img.height() + 10) * 2);
    report += QString("colorKey:\t%1\tms\n").arg(colorKey());
    m_pPainter->translate(g_img.width() + 10, 0);
    report += QString("brightness:\t%1\tms\n").arg(brightness());
    m_pPainter->translate(g_img.width() + 10, 0);
    report += QString("contrast:\t%1\tms\n").arg(contrast());
    m_pPainter->translate(g_img.width() + 10, 0);
    report += QString("brown:\t%1\tms\n").arg(brown());

	drawReport(report);
}
示例#5
0
void gfxengine_t::reset_filters()
{
	/* Remove all filters */
	s_remove_filter(NULL);
	sf1 = df = dsf = acf = NULL;

	/* Set up filter pipeline */
	s_remove_filter(NULL);

	s_add_filter(s_filter_rgba8);
#if 0
	s_filter_t *fi;
	fi = s_add_filter(s_filter_key2alpha);
	fi->args.max = 1;
#endif
	sf1 = s_add_filter(s_filter_scale);
	sf2 = s_add_filter(s_filter_scale);
	acf = s_add_filter(s_filter_cleanalpha);
	bcf = s_add_filter(s_filter_brightness);
	df = s_add_filter(s_filter_dither);
	dsf = s_add_filter(s_filter_displayformat);

	/* Set default parameters */
//	colorkey(0, 0, 0);
	clampcolor(0, 0, 0, 0);
	scalemode(GFX_SCALE_NEAREST);
	dither(0, 0);
	noalpha(0);
	brightness(1.0, 1.0);
	filterflags(0);
}
示例#6
0
文件: custom.cpp 项目: Artox/qtmoko
QTOPIABASE_EXPORT void qpe_setBrightness(int b)
{
  static int previous = 0;
  static int max = qpe_sysBrightnessSteps(); /* get it once */

  if (b < 0)
    b = max;

  /*if (b > 1 && previous == 0) {
    fb_power(true); */
//     sleep(1); /* ugly: let it a little of time to avoid an lcd flash */
  //}

  QFile brightness("/sys/class/backlight/corgi-bl/brightness");
  if(!brightness.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
    qWarning() << "/sys/class/backlight/corgi-bl/brightness not opened";
  } else {
    QTextStream out(&brightness);
    out << QString::number(b);
    brightness.close();
  }

  /*if (b == 0)
    fb_power(false);

  previous = b;*/
}
示例#7
0
//executes 1 command line
void execute_command(char * command_line){
    
    if (command_line[0]=='#') return; //=comments
    
    if (write_to_thread_buffer){
        if (strncmp(command_line, "thread_stop", 11)==0){
            if (mode==MODE_TCP){
                write_to_thread_buffer=0;
                if (debug) printf("Thread stop.\n");
                if (thread_write_index>0) start_thread=1; //remember to start the thread when client closes the TCP/IP connection
            }        
        }else{
            if (debug) printf("Write to thread buffer: %s\n", command_line);
            while (*command_line!=0){
                write_thread_buffer(*command_line); //for TCP/IP we write to the thread buffer
                command_line++;
            }
            write_thread_buffer(';');
        }
    }else{
 
        char * arg = strchr(command_line, ' ');
        char * command =  strtok(command_line, " \r\n");    
        
        if (arg!=NULL) arg++;
        
        if (strcmp(command, "render")==0){
            render(arg);
        }else if (strcmp(command, "rotate")==0){
            rotate(arg);
        }else if (strcmp(command, "delay")==0){
            if (arg!=NULL)	usleep((atoi(arg)+1)*1000);
        }else if (strcmp(command, "brightness")==0){
            brightness(arg);
        }else if (strcmp(command, "rainbow")==0){
            rainbow(arg);
        }else if (strcmp(command, "fill")==0){	
            fill(arg);
        }else if (strcmp(command, "do")==0){
            start_loop(arg);
        }else if (strcmp(command, "loop")==0){
            end_loop(arg);
        }else if (strcmp(command, "thread_start")==0){ //start a new thread that processes code
            if (thread_running==0 && mode==MODE_TCP) init_thread(arg);
        }else if (strcmp(command, "setup")==0){
            setup_ledstring(arg);
        }else if (strcmp(command, "settings")==0){
            print_settings();
        }else if (strcmp(command, "debug")==0){
            if (debug) debug=0;
            else debug=1;
        }else if (strcmp(command, "exit")==0){
            printf("Exiting.\n");
            exit_program=1;
        }else{
            printf("Unknown cmd: %s\n", command_line);
        }
    }
}
示例#8
0
// from http://www.cs.rit.edu/~ncs/color/t_convert.html
FColor HSB::hsbToRgb(const FColor& hsb) {
    auto h = hue(hsb), s = saturation(hsb), b = brightness(hsb);
    float red, green, blue;
    if (s == 0) {
        // achromatic (grey)
        red = green = blue = b;
    } else {
        h *= 6;			// sector 0 to 5
        int i = floor(h);
        auto f = h - i;			// factorial part of h
        auto p = b * (1 - s);
        auto q = b * (1 - s * f);
        auto t = b * (1 - s * (1 - f));

        switch(i) {
            case 0:
                red = b;
                green = t;
                blue = p;
                break;

            case 1:
                red = q;
                green = b;
                blue = p;
                break;

            case 2:
                red = p;
                green = b;
                blue = t;
                break;

            case 3:
                red = p;
                green = q;
                blue = b;
                break;

            case 4:
                red = t;
                green = p;
                blue = b;
                break;

            case 5:
            default:
                red = b;
                green = p;
                blue = q;
                break;
        }
    }

    return FColor(red, green, blue, hsb.alpha());
}
示例#9
0
 void onDraw(const int loops, SkCanvas* canvas) override {
     SkRect r = getFilterRect();
     SkPaint paint;
     paint.setColor(SK_ColorRED);
     for (int i = 0; i < loops; i++) {
         SkAutoTUnref<SkImageFilter> brightness(make_brightness(1.0f));
         paint.setImageFilter(brightness);
         canvas->drawRect(r, paint);
     }
 }
示例#10
0
int Atm_led::brighten( int v ) {
  if ( abs( v ) == 1 ) {
    int br = (int)this->level + v;
    if ( br > toHigh ) 
      br = wrap ? toLow : toHigh;
    if ( br < toLow ) 
      br = wrap ? toHigh : toLow;
    brightness( br );
  }
  return this->level;
}
示例#11
0
void		modify_color(t_scene *scene, t_caster *light, double cos)
{
  int		it;

  if (!light)
    scene->eye->intersection.color.value = 0;
  else
    brightness(scene->eye, light);
  it = 0;
  while (it < 3)
    scene->eye->intersection.color.array[it++] *= cos;
}
示例#12
0
void SLCD::init()
{   
	mySerial.begin(9600);  
                     
	clear();
	print("SerLCD Class", 0, 2);
	brightness(100);
	underlineCursorOff();
	print("initialized", 1, 3);
	
	flash(3, 100) ;
}
示例#13
0
void AnimationRemanence::animate(Framebuffer &leds, CHSV baseColor, const uint8_t step)
{
	uint8_t led_id = 24;

	for(int i=0; i<(LINES+1); ++i) {
		switch(i) {
			case 0:
				baseColor.value = brightness(step, 0);
				leds[led_id] = baseColor;
				break;
			default:
				const uint8_t line = i-1;
				for(uint8_t col=0; col<COLUMNS; ++col) {
					led_id = column_leds[col][line];
					baseColor.value = brightness(map(step, 0, 255, 0, LINES-1),line);
					//baseColor.value = brightness(step,map(line, 0, LINES-1, 0, 255));

					leds[led_id] = baseColor;
				}
		}
	}
}
示例#14
0
void starship::drawModel(bool withoutTexture) {
    // Lazy texture creation - only when neccessary
    if (!texture.created) {
        char name[32] = "resources/s_1024_C.tga";
        loadTexture(name);
    }
    
    // Lazy model creation
    if (!model) {
        char filename[32] = "resources/shipA_OBJ.obj";
        model = glmReadOBJ(filename);
        
        if (!model)
            exit(0);
        
        glmUnitize(model);
        glmFacetNormals(model);
        glmVertexNormals(model, 90);
    }
    
    // If the texture doesn't exists or draw without texture
    if (!texture.created || withoutTexture) {
        brightness(0.75, 0, 0);
        glmDraw(model, GLM_SMOOTH);
        
    // If texture exists and draw with texture
    } else {
        brightness(0.6, 0.6, 0.4);
        glEnable(GL_TEXTURE_2D);
        glBindTexture(GL_TEXTURE_2D, texture.texID);
        glmDraw(model, GLM_SMOOTH | GLM_TEXTURE);
        glDisable(GL_TEXTURE_2D);
    }
    
    brightness();
}
示例#15
0
void Colour::approach(Colour c) {
	if (abs(c.red - red) <= 2 && abs(c.green - green) <= 2 && abs(c.blue - blue) <= 2) {
		red = c.red;
		green = c.green;
		blue = c.blue;

		return;
	}

	if (c.brightness() > brightness()) {
		red = (c.red + red * 2) / 3;
		green = (c.green + green * 2) / 3;
		blue = (c.blue + blue * 2) / 3;
	} else {
		red = (c.red + red * 2) / 3;
		green = (c.green + green * 2) / 3;
		blue = (c.blue + blue * 2) / 3;
	}
}
示例#16
0
int main(
  int argc,
  char *argv[]) {

  double nu, rad;

  /* Check arguments... */
  if (argc < 3)
    ERRMSG("Give parameters: <rad> <nu>");

  /* Read arguments... */
  rad = atof(argv[1]);
  nu = atof(argv[2]);

  /* Compute brightness temperature... */
  printf("%.10g\n", brightness(rad, nu));

  return EXIT_SUCCESS;
}
QVariant S60CameraImageProcessingControl::processingParameter(
    QCameraImageProcessingControl::ProcessingParameter parameter) const
{
    switch (parameter) {
    case QCameraImageProcessingControl::Contrast:
        return QVariant(contrast());
    case QCameraImageProcessingControl::Saturation:
        return QVariant(saturation());
    case QCameraImageProcessingControl::Brightness:
        return QVariant(brightness());
    case QCameraImageProcessingControl::Sharpening:
        return QVariant(sharpeningLevel());
    case QCameraImageProcessingControl::Denoising:
        return QVariant(denoisingLevel());
    case QCameraImageProcessingControl::ColorTemperature:
        return QVariant(manualWhiteBalance());
    default:
        return QVariant();
    }
}
示例#18
0
文件: main.cpp 项目: laCour/sunrise
void reply(DBusMessage *msg, DBusConnection *conn) {
  DBusMessage *reply;
  DBusMessageIter args;

  long t_response = -1;
  double d_response = -1;

  if (dbus_message_is_method_call(msg, DBUS_NAMESPACE, "Sunrise")) { t_response = sunrise(msg); }
  if (dbus_message_is_method_call(msg, DBUS_NAMESPACE, "Sunset")) { t_response = sunset(msg); }
  if (dbus_message_is_method_call(msg, DBUS_NAMESPACE, "Brightness")) { d_response = brightness(msg); }

  reply = dbus_message_new_method_return(msg);
  dbus_message_iter_init_append(reply, &args);

  if (t_response >= 0) { sendT(conn, reply, &args, t_response); }
  if (d_response >= 0) { sendD(conn, reply, &args, d_response); }

  dbus_connection_flush(conn);
  dbus_message_unref(reply);
}
示例#19
0
文件: util.cpp 项目: wmbr/Orbit
NBodySystem initializeSystem(sf::Vector2u size)
{
	NBodySystem system;
	std::vector<Body> bodies;
	for(int i = 0; i < NUM_BODIES; ++i)
	{
		double radius = std::rand() % 12 + 3;
		double x = std::rand() % (size.x/2) + (size.x/4.0);
		double y = std::rand() % (size.y/2) + (size.y/4.0);
		double vx = (std::rand() % 100) / 100.0;
		double vy = (std::rand() % 100) / 100.0;
		sf::Color color;
		do{
			color = sf::Color(rand()%255, rand()%255, rand()%255);
		}while(radius * brightness(color) < 500); //avoid hard to see bodies
		bodies.push_back(Body(radius, Vector(x, y), Vector(vx, vy), color));
	}
	system.setBodies(bodies);
	system.nullifySystemVelocity();
	return system;
}
示例#20
0
/**
 * Returns a color-mapped copy of @a image.  (Or, if @a colors is empty, returns @a image.)
 */
VuoImage VuoImage_mapColors(VuoImage image, VuoList_VuoColor colors, VuoReal filterOpacity)
{
	if (!image)
		return NULL;

	if (!colors)
		return image;

	VuoGlContext glContext = VuoGlContext_use();
	VuoImageRenderer imageRenderer = VuoImageRenderer_make(glContext);
	VuoRetain(imageRenderer);

	static const char * fragmentShaderSource = VUOSHADER_GLSL_SOURCE(120,

		uniform float gradientCount;
		uniform sampler2D image;		// the unfiltered image
		uniform sampler2D gradientStrip;// the gradient strip to map against
		uniform float amount;			// the amount to mix gradient and image
		varying vec4 fragmentTextureCoordinate;

		// https://stackoverflow.com/questions/596216/formula-to-determine-brightness-of-rgb-color
		float brightness(vec3 col)
		{
			// Digital CCIR601 (gives more weight to the green and red components):
			return 0.299*col.r + 0.587*col.g + 0.114*col.b;
		}

		void main(void)
		{
			vec4 orig = texture2D(image, fragmentTextureCoordinate.xy);

			float lum = brightness(orig.rgb);

			float gradientWidth = (1./gradientCount)/2.;
			lum = lum * (1-gradientWidth*2) + gradientWidth;

			vec4 color = texture2D(gradientStrip, vec2(clamp(lum, gradientWidth, 1-gradientWidth), .5));

			gl_FragColor = mix(orig, color, amount) * orig.a;
		}
示例#21
0
double energyValue(int pic[][][], int i, int j,int len1, int len2){
  int energy_x=brightness(pic,i-1,j-1,int len1, int len2)+2*brightness(pic,i,j-1,len1,len2)+brightness(pic,i+1,j-1,len1,len2)-brightness(pic,i-1,j+1,len1,len2)-2*brightness(pic,i,j+1,len1,len2)-brightness(pic,i+1,j+1,len1,len2);
  int energy_y=brightness(pic,i-1,j-1)+2*brightness(pic,i-1,j,len1,len2)+brightness(pic,i-1,j+1,len1,len2)-brightness(pic,i+1,j-1,len1,len2)-2*brightness(pic,i+1,j,len1,len2)-brightness(pic,i+1,j+1,len1,len2);
  return sqrt(energy_x*energy_x+energy_y*energy_y);
}
示例#22
0
 Color withBrightness(double v) { return *this * (v / brightness()); }
示例#23
0
 bool operator<=(const Color& c) const { return brightness() <= c.brightness(); }
示例#24
0
 bool operator>(const Color& c) const { return brightness() > c.brightness(); }
void printColor(Color *c)
{
	printf("(%d, %d, %d) %f\n",
		c->r, c->g, c->b, brightness(c));
	return;
}
示例#26
0
void LED::stepNonLogic()
{
	avg_brightness   += brightness(m_diode->current()) * LINEAR_UPDATE_PERIOD;
	lastUpdatePeriod += LINEAR_UPDATE_PERIOD;
}
示例#27
0
        void SettingsMenu::init()
        {
            if (_initialized) return;
            State::init();

            setModal(true);
            setFullscreen(true);

            // background
            auto background = new UI::Image("art/intrface/prefscrn.frm");
            Point backgroundPos = Point((Game::getInstance()->renderer()->size() - background->size()) / 2);
            int backgroundX = backgroundPos.x();
            int backgroundY = backgroundPos.y();
            background->setPosition(backgroundPos);
            addUI(background);

            auto settings = Game::getInstance()->settings();

            // Switches (big)
            auto combatDifficultySwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+149);
            combatDifficultySwitch->setMaxState(3);
            combatDifficultySwitch->setState(settings->combatDifficulty());
            addUI("combat_difficulty",combatDifficultySwitch);

            auto gameDifficultySwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+71);
            gameDifficultySwitch->setMaxState(3);
            gameDifficultySwitch->setState(settings->gameDifficulty());
            addUI("game_difficulty",gameDifficultySwitch);

            auto violenceLevelSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+227);
            violenceLevelSwitch->setState(settings->violenceLevel());
            addUI("violence_level",violenceLevelSwitch);

            auto targetHighlightSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+309);
            targetHighlightSwitch->setMaxState(3);
            targetHighlightSwitch->setState(settings->targetHighlight());
            addUI("target_highlight",targetHighlightSwitch);

            auto combatLooksSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::BIG_SWITCH, backgroundX+76, backgroundY+387);
            combatLooksSwitch->setMaxState(2);
            combatLooksSwitch->setState(settings->combatLooks());
            addUI("combat_looks",combatLooksSwitch);

            // Switches (small)
            auto combatMessagesSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74);
            combatMessagesSwitch->setState(settings->combatMessages());
            addUI("combat_messages",combatMessagesSwitch);

            auto combatTauntsSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66);
            combatTauntsSwitch->setState(settings->combatTaunts());
            addUI("combat_taunts",combatTauntsSwitch);

            auto languageFilterSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*2);
            languageFilterSwitch->setState(settings->languageFilter());
            addUI("language_filter",languageFilterSwitch);

            auto runningSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*3);
            runningSwitch->setState(settings->running());
            addUI("running",runningSwitch);

            auto subtitlesSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*4);
            subtitlesSwitch->setState(settings->subtitles());
            addUI("subtitles",subtitlesSwitch);

            auto itemHightlightSwitch = new UI::MultistateImageButton(UI::MultistateImageButton::Type::SMALL_SWITCH, backgroundX+299, backgroundY+74+66*5);
            itemHightlightSwitch->setState(settings->itemHighlight());
            addUI("item_highlight",itemHightlightSwitch);

            // LABELS
            SDL_Color color = {0x90, 0x78, 0x24, 0xff};

            std::string font1_907824ff = "font1.aaf";
            std::string font3_907824ff = "font3.aaf";
            std::string font4_907824ff = "font4.aaf";

            // GAME PREFERENCES
            _addTextArea(_t(MSG_OPTIONS, 100), backgroundX+74, backgroundY+10)->setFont(font4_907824ff, color);

            // COMBAT DIFFICULTY
            auto difficulty = _addTextArea(_t(MSG_OPTIONS, 101), backgroundX+21, backgroundY+48);
            difficulty->setWidth(158);
            difficulty->setHorizontalAlign(UI::TextArea::HorizontalAlign::CENTER);
            difficulty->setFont(font3_907824ff, color);

            // GAME DIFFICULTY
            _addTextArea(difficulty, backgroundX+21, backgroundY+48+77)->setText(_t(MSG_OPTIONS, 102));

            // VIOLENCE LEVEL
            _addTextArea(difficulty, backgroundX+21, backgroundY+48+156)->setText(_t(MSG_OPTIONS, 103));

            // TARGET HIGHLIGHT
            _addTextArea(difficulty, backgroundX+21, backgroundY+128+158)->setText(_t(MSG_OPTIONS, 104));

            // COMBAT LOOKS
            _addTextArea(difficulty, backgroundX+21, backgroundY+128+235)->setText(_t(MSG_OPTIONS, 105));

            // COMBAT MESSAGES
            auto combatMessages = _addTextArea(_t(MSG_OPTIONS, 106), backgroundX+206, backgroundY+49);
            combatMessages->setFont(font3_907824ff, color);

            // COMBAT TAUNTS
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66)->setText(_t(MSG_OPTIONS, 107));

            // LANGUAGE FILTER
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*2)->setText(_t(MSG_OPTIONS, 108));

            // RUNNING
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*3)->setText(_t(MSG_OPTIONS, 109));

            // SUBTITLES
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*4)->setText(_t(MSG_OPTIONS, 110));

            // ITEM HIGHLIGHT
            _addTextArea(combatMessages, backgroundX+206, backgroundY+49+66*5)->setText(_t(MSG_OPTIONS, 111));

            // COMBAT SPEED
            auto combatSpeed = _addTextArea(_t(MSG_OPTIONS, 112), backgroundX+384, backgroundY+19);
            combatSpeed->setFont(font3_907824ff, color);

            // TEXT DELAY
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+95)->setText(_t(MSG_OPTIONS, 113));

            // MASTER AUDIO VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165)->setText(_t(MSG_OPTIONS, 114));

            // MUSIC/MOVIE VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51)->setText(_t(MSG_OPTIONS, 115));

            // SOUND EFFECTS VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*2)->setText(_t(MSG_OPTIONS, 116));

            // SPEECH VOLUME
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*3)->setText(_t(MSG_OPTIONS, 117));

            // BRIGHTNESS LEVEL
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*4)->setText(_t(MSG_OPTIONS, 118));

            // MOUSE SENSITIVITY
            _addTextArea(combatSpeed, backgroundX+384, backgroundY+165+51*5)->setText(_t(MSG_OPTIONS, 119));

            // DEFAULT BUTTON LABEL
            auto label = _addTextArea(combatSpeed, backgroundX+43, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 120));
            label->setFont(font3_907824ff, color);

            // DONE BUTTON LABEL
            label = _addTextArea(combatSpeed, backgroundX+169, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 300));
            label->setFont(font3_907824ff, color);

            // CANCEL BUTTON LABEL
            label = _addTextArea(combatSpeed, backgroundX+283, backgroundY+449);
            label->setText(_t(MSG_OPTIONS, 121));
            label->setFont(font3_907824ff, color);

            // COMBAT DIFFICULTY SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 203), backgroundX+50, backgroundY+81)->setFont(font1_907824ff, color);     // EASY
            _addTextArea(_t(MSG_OPTIONS, 204), backgroundX+81, backgroundY+67)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 205), backgroundX+122, backgroundY+81)->setFont(font1_907824ff, color);    // HARD

            // GAME DIFFICULTY SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 206), backgroundX+45, backgroundY+159)->setFont(font1_907824ff, color);    // WIMPY
            _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+83, backgroundY+145)->setFont(font1_907824ff, color);    // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 208), backgroundX+122, backgroundY+159)->setFont(font1_907824ff, color);   // ROUGH

            // VIOLENCE LEVEL SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 214), backgroundX+48, backgroundY+236)->setFont(font1_907824ff, color);    // NONE
            _addTextArea(_t(MSG_OPTIONS, 215), backgroundX+83, backgroundY+222)->setFont(font1_907824ff, color);    // MINIMUM
            _addTextArea(_t(MSG_OPTIONS, 207), backgroundX+122, backgroundY+236)->setFont(font1_907824ff, color);   // NORMAL
            label = _addTextArea(_t(MSG_OPTIONS, 216).insert(8, " "), backgroundX+122, backgroundY+257);
            label->setFont(font1_907824ff, color);
            label->setWidth(50);
            label->setWordWrap(true); // MAXIMUM BLOOD

            // TARGET HIGHLIGHT SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+59, backgroundY+319)->setFont(font1_907824ff, color);    // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+95, backgroundY+305)->setFont(font1_907824ff, color);    // ON
            label = _addTextArea(_t(MSG_OPTIONS, 213).insert(10, " "), backgroundX+122, backgroundY+319);
            label->setFont(font1_907824ff, color);
            label->setWidth(60);
            label->setWordWrap(true); // TARGETING ONLY

            // COMBAT LOOKS SWITCH LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+59, backgroundY+397)->setFont(font1_907824ff, color);    // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+95, backgroundY+383)->setFont(font1_907824ff, color);    // ON

            // COMBAT MESSAGES SWITCH LABELS
            auto verboseLabel = _addTextArea(_t(MSG_OPTIONS, 211), backgroundX+203, backgroundY+69);         // VERBOSE
            verboseLabel->setFont(font1_907824ff, color);
            verboseLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT);
            verboseLabel->setWidth(100);
            _addTextArea(_t(MSG_OPTIONS, 212), backgroundX+320, backgroundY+69)->setFont(font1_907824ff, color);    // BRIEF

            // COMBAT TAUNTS SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67)->setFont(font1_907824ff, color); // ON

            // LANGUAGE FILTER SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+67+66)->setFont(font1_907824ff, color); // ON

            // RUNNING SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64)->setText(_t(MSG_OPTIONS, 209)); // NORMAL
            _addTextArea(_t(MSG_OPTIONS, 219), backgroundX+320, backgroundY+69+67+66+64)->setFont(font1_907824ff, color); // ALWAYS

            // SUBTITLES SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+66+65)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+66+67+66+65)->setFont(font1_907824ff, color); // OFF

            // ITEM HIGHLIGHT SWITCH LABELS
            _addTextArea(verboseLabel, backgroundX+203, backgroundY+69+67+66+64+65+68)->setText(_t(MSG_OPTIONS, 202)); // OFF
            _addTextArea(_t(MSG_OPTIONS, 201), backgroundX+320, backgroundY+69+64+67+66+65+68)->setFont(font1_907824ff, color); // ON

            // AFFECT PLAYER SPEECH
            _addTextArea(_t(MSG_OPTIONS, 122), backgroundX+405, backgroundY+72)->setFont(font1_907824ff, color);

            // COMBAT SPEED SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+38)->setFont(font1_907824ff, color);      // NORMAL
            auto fastestLabel = _addTextArea(_t(MSG_OPTIONS, 210), backgroundX+524, backgroundY+38);           // FASTEST
            fastestLabel->setFont(font1_907824ff, color);
            fastestLabel->setHorizontalAlign(UI::TextArea::HorizontalAlign::RIGHT);
            fastestLabel->setWidth(100);

            // TEXT DELAY SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 217), backgroundX+384, backgroundY+113)->setFont(font1_907824ff, color);     // SLOW
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+484, backgroundY+113)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+113)->setText(_t(MSG_OPTIONS, 218));       // FASTER

            // MASTER AUDIO VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184)->setFont(font1_907824ff, color);     // OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184)->setFont(font1_907824ff, color);     // QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184)->setFont(font1_907824ff, color);     // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184)->setText(_t(MSG_OPTIONS, 222));       // LOUD

            // MUSIC/MOVIE VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51)->setFont(font1_907824ff, color);  // OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51)->setFont(font1_907824ff, color);  // QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51)->setFont(font1_907824ff, color);  // NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51)->setText(_t(MSG_OPTIONS, 222));    // LOUD

            // SOUND EFFECTS SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*2)->setFont(font1_907824ff, color);// OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51*2)->setFont(font1_907824ff, color);// QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51*2)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*2)->setText(_t(MSG_OPTIONS, 222));  // LOUD

            // SPEECH VOLUME SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 202), backgroundX+384, backgroundY+184+51*3)->setFont(font1_907824ff, color);// OFF
            _addTextArea(_t(MSG_OPTIONS, 221), backgroundX+452, backgroundY+184+51*3)->setFont(font1_907824ff, color);// QUIET
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+521, backgroundY+184+51*3)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*3)->setText(_t(MSG_OPTIONS, 222));  // LOUD

            // BRIGHTNESS LEVEL SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*4)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*4)->setText(_t(MSG_OPTIONS, 223));  // BRIGHTER

            // MOUSE SENSITIVITY SLIDER LABELS
            _addTextArea(_t(MSG_OPTIONS, 209), backgroundX+384, backgroundY+184+51*5)->setFont(font1_907824ff, color);// NORMAL
            _addTextArea(fastestLabel, backgroundX+524, backgroundY+184+51*5)->setText(_t(MSG_OPTIONS, 218));  // FASTER

            // BUTTONS

            // button: Default
            auto defaultButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+23, backgroundY+450);
            defaultButton->mouseClickHandler().add(std::bind(&SettingsMenu::onDefaultButtonClick, this, std::placeholders::_1));
            addUI(defaultButton);

            // button: Done
            auto doneButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+148, backgroundY+450);
            doneButton->mouseClickHandler().add([this](Event::Event* event){ this->doSave(); });
            addUI(doneButton);

            // button: Cancel
            auto cancelButton = new UI::ImageButton(UI::ImageButton::Type::SMALL_RED_CIRCLE, backgroundX+263, backgroundY+450);
            cancelButton->mouseClickHandler().add([this](Event::Event* event){ this->doCancel(); });
            addUI(cancelButton);

            // button: Affect player speed
            auto affectPlayerSpeedCheckBox = new UI::ImageButton(UI::ImageButton::Type::CHECKBOX, backgroundX+383, backgroundY+68);
            affectPlayerSpeedCheckBox->setChecked(settings->playerSpeedup());
            addUI("player_speedup", affectPlayerSpeedCheckBox);

            // SLIDERS
            // COMBAT SPEED SLIDER
            auto combatSpeedSlider = new UI::Slider(backgroundX+384, backgroundY+50);
            combatSpeedSlider->setMinValue(0.0);
            combatSpeedSlider->setMaxValue(50.0);
            combatSpeedSlider->setValue(settings->combatSpeed());
            addUI("combat_speed",combatSpeedSlider);

            // TEXT DELAY SLIDER
            auto textDelaySlider = new UI::Slider(backgroundX+384, backgroundY+125);
            textDelaySlider->setValue(settings->textDelay());
            addUI("text_delay",textDelaySlider);

            // MASTER AUDIO VOLUME SLIDER
            auto masterAudioVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196);
            masterAudioVolumeSlider->setValue(settings->masterVolume());
            addUI("master_volume", masterAudioVolumeSlider);

            // MUSIC VOLUME SLIDER
            auto musicVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51);
            musicVolumeSlider->setValue(settings->musicVolume());
            addUI("music_volume", musicVolumeSlider);
            musicVolumeSlider->changeHandler().add([=](Event::Event* evt)
            {
                Game::getInstance()->mixer()->setMusicVolume(musicVolumeSlider->value());
            });

            // SOUND EFFECTS VOLUME SLIDER
            auto soundEffectsVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*2);
            soundEffectsVolumeSlider->setValue(settings->sfxVolume());
            addUI("sfx_volume", soundEffectsVolumeSlider);

            // SPEECH VOLUME SLIDER
            auto speechVolumeSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*3);
            speechVolumeSlider->setValue(settings->voiceVolume());
            addUI("voice_volume", speechVolumeSlider);

            // BRIGHTNESS LEVEL SLIDER
            auto brightnessLevelSlider = new UI::Slider(backgroundX+384, backgroundY+196+51*4);
            brightnessLevelSlider->setValue(settings->brightness());
            addUI("brightness", brightnessLevelSlider);

            // MOUSE SENSITIVITY SLIDER
            auto mouseSensitivitySlider = new UI::Slider(backgroundX+384, backgroundY+196+51*5);
            mouseSensitivitySlider->setValue(settings->mouseSensitivity());
            addUI("mouse_sensitivity",mouseSensitivitySlider);
        }