~swag/armagetronad/0.2.9-sty+ct+ap-fork

« back to all changes in this revision

Viewing changes to src/render/rFont.cpp

  • Committer: SwagTron
  • Date: 2019-03-03 20:57:16 UTC
  • Revision ID: swagtron-20190303205716-nk32wtrusb3tum54
As far as I am aware, compiling 2.9 sty+ct+ap was incredibly difficult and impossible without using older versions merged with the latest revision (thanks to Nelg's help). Created a proper win32 folder, a readme file, and made it simple to compile for windows.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
#include "rScreen.h"
30
30
#include "tConfiguration.h"
31
31
#include "tColor.h"
32
 
#include "eFloor.h"
33
32
#include <ctype.h>
34
33
 
35
34
#ifndef DEDICATED
196
195
 
197
196
// **************************************************
198
197
 
199
 
static REAL sr_bigFontThresholdWidth  = 0;
200
 
static REAL sr_bigFontThresholdHeight = 0;
 
198
static REAL sr_bigFontThresholdWidth  = 12;
 
199
static REAL sr_bigFontThresholdHeight = 24;
201
200
 
202
 
static tConfItem< REAL > sr_bigFontThresholdWidthConf(  "FONT_BIG_THRESHOLD_WIDTH", sr_bigFontThresholdWidth );
203
 
static tConfItem< REAL > sr_bigFontThresholdHeightConf( "FONT_BIG_THRESHOLD_HEIGHT", sr_bigFontThresholdHeight );
 
201
static tSettingItem< REAL > sr_bigFontThresholdWidthConf(  "FONT_BIG_THRESHOLD_WIDTH", sr_bigFontThresholdWidth );
 
202
static tSettingItem< REAL > sr_bigFontThresholdHeightConf( "FONT_BIG_THRESHOLD_HEIGHT", sr_bigFontThresholdHeight );
204
203
 
205
204
static REAL sr_smallFontThresholdWidth  = 5;
206
205
static REAL sr_smallFontThresholdHeight = 8;
207
206
 
208
 
static tConfItem< REAL > sr_smallFontThresholdWidthConf(  "FONT_SMALL_THRESHOLD_WIDTH", sr_smallFontThresholdWidth );
209
 
static tConfItem< REAL > sr_smallFontThresholdHeightConf( "FONT_SMALL_THRESHOLD_HEIGHT", sr_smallFontThresholdHeight );
 
207
static tSettingItem< REAL > sr_smallFontThresholdWidthConf(  "FONT_SMALL_THRESHOLD_WIDTH", sr_smallFontThresholdWidth );
 
208
static tSettingItem< REAL > sr_smallFontThresholdHeightConf( "FONT_SMALL_THRESHOLD_HEIGHT", sr_smallFontThresholdHeight );
210
209
 
211
210
rTextField::rTextField(REAL Left,REAL Top,
212
211
                       REAL Cwidth,REAL Cheight,
268
267
#endif
269
268
}
270
269
 
271
 
static bool sr_renderBrightBackground = false;
272
 
static tConfItem<bool> rbb("TEXT_BRIGHT_BACKGROUND",sr_renderBrightBackground);
273
 
 
274
 
static bool sr_renderBrighenText = true;
275
 
static tConfItem<bool> rbt("TEXT_BRIGHTEN",sr_renderBrighenText);
276
 
 
277
270
void rTextField::FlushLine(int len,bool newline){
278
271
#ifndef DEDICATED
279
272
    // reload textures if alpha blending changed
298
291
    if (sr_glOut)
299
292
    {
300
293
        // render bright background
301
 
        //this is kind of ugly
302
 
        if ( color_.IsDark() && sr_renderBrightBackground)
 
294
        if ( color_.IsDark() )
303
295
        {
304
296
            RenderEnd(true);
305
297
            glDisable(GL_TEXTURE_2D);
332
324
            glEnable(GL_TEXTURE_2D);
333
325
        }
334
326
 
335
 
        //Text too dark lets brighten it
336
 
        if ( color_.IsDark() && sr_renderBrighenText)
337
 
        {
338
 
            se_MakeColorValid(r,g,b,1.0f);
339
 
        }
340
 
 
341
327
 
342
328
        if ( len > 0 )
343
329
        {
495
481
            }
496
482
            else
497
483
            {
498
 
                // found! extract colors
 
484
                // found! extract colors
499
485
                tString colorStr(c);
500
486
                color = tColor(colorStr.ToLower());
501
487
            }
503
489
            // advance
504
490
            if ( colorMode == COLOR_USE )
505
491
            {
506
 
                c += 8;
 
492
                c += 8;
507
493
                cursorPos -= 8;
508
494
            }
509
495
            else
511
497
                // write color code out
512
498
                for(int i = 7; i >= 0; --i)
513
499
                    WriteChar(*(c++));
514
 
            }
 
500
            }
515
501
 
516
502
            FlushLine(false);
517
503
            cursorPos++;
518
504
            color_ = color;
519
505
        }
520
 
        else
 
506
        else
521
507
        {
522
508
            // normal operation: add char
523
 
            WriteChar(*(c++));
 
509
            WriteChar(*(c++));
524
510
        }
525
511
    }
526
512