File: EmFont.h

package info (click to toggle)
pinball 0.3.20201218-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 8,452 kB
  • sloc: cpp: 15,230; makefile: 840; sh: 381; xml: 24
file content (64 lines) | stat: -rw-r--r-- 1,720 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
/***************************************************************************
                          EmFont.h  -  description
                             -------------------
    begin                : Mon Jul 23 2001
    copyright            : (C) 2001 by Henrik Enqvist
    email                : henqvist@excite.com
 ***************************************************************************/

#ifndef EMFONT_H
#define EMFONT_H

//#define EM_FONT_X_2 17
//#define EM_FONT_Y_2 13

#ifndef PRIVATE_H
#error Must include Private.h before EmFont.h
#endif

#if EM_USE_SDL
#define EM_FONTSIZE_X 0.06f*EM_RIGHT
#define EM_FONTSIZE_Y 0.08f*EM_UP
#endif

#if EM_USE_ALLEGRO
#define EM_FONTSIZE_X 0.03f
#define EM_FONTSIZE_Y 0.04f
#endif

#include "TextureUtil.h"

class Config;

/** A singleton utility for fonts. */
class EmFont {
 public:
  ~EmFont();
  /** Get singleton object. */
  static EmFont * getInstance();
  void loadFont(const char * fileName);
  /** If row is negative the row will be counted from bottom of screen. */
  void printRow(const char * buffer, float row);
  /** If row is negative the row will be counted from bottom of screen. */
  void printRowCenter(const char * buffer, float row);
 protected:
#if EM_USE_SDL
  /** With OpenGL -1,1 is upper left. 1,-1 is lower right. */
  void print(const char * buffer, float x, float y);
#endif
#if EM_USE_ALLEGRO
  /** With allegro 0,0 is upper lefter. The screen size determines the lower right. */
  void print(const char * buffer, int x, int y);
#endif
  EmFont();
 private:
  //EmImage * m_Font;
  EmTexture * m_Texture;
  int m_iSize;
  float m_fFontSizeX;
  float m_fFontSizeY;
  Config * p_Config;
  static EmFont * p_EmFont;
};

#endif // EMFONT_H