EnglishРусский  

   ..

   SRC

   defines.g

   Desktop.g

   Font.g

   Image.g

   Screen.g

   Sound.g

   Sprites.g

Реклама

Инсталлятор CreateInstall
Бесплатные и коммерческие инсталляторы

  1 
  2 define <export> {
  3   FONT_BOLD        = 256
  4   FONT_ITALIC      = 512
  5   FONT_UNDERLINE   = 4
  6   FONT_STRIKEOUT   = 8
  7   FONT_HIGHQUALITY = 16
  8 }
  9 
 10 type Font      <inherit = GAPI_Object>{
 11   str  tName
 12   int  tSize
 13   byte tBold
 14   byte tItalic
 15   byte tUnderline
 16   byte tStrikeOut
 17   byte tHighQuality
 18 }
 19 
 20 operator Font = (Font left right){
 21   left.id           = right.id
 22   left.tBold        = right.tBold
 23   left.tItalic      = right.tItalic
 24   left.tUnderline   = right.tUnderline
 25   left.tStrikeOut   = right.tStrikeOut
 26   left.tHighQuality = right.tHighQuality
 27   return left
 28 }
 29 
 30 property int Font.Handle{
 31   return Font_GetHandle(this.id)
 32 }
 33 method Font.Free(){
 34   Font_Free(this.id)
 35   this.tName        = ""
 36   this.tBold        = $false
 37   this.tItalic      = $false
 38   this.tUnderline   = $false
 39   this.tStrikeOut   = $false
 40   this.tHighQuality = $false
 41 }
 42 property int Font.Exist{
 43   return Font_Exist(this.id)
 44 }
 45 method int Font.Create(str Name, int Size){
 46   this.id = Font_Load(Name.ptr(),Size)
 47   return this.id
 48 }
 49 method int Font.Create(str Name, int Size Flags){
 50   this.id = Font_LoadEx(Name.ptr(),Size,Flags)
 51   return this.id
 52 }
 53 property int Font.Properties{
 54   int p = 0
 55   p = ?(this.tBold,       p ^ $FONT_BOLD,       p)
 56   p = ?(this.tItalic,     p ^ $FONT_ITALIC,     p)
 57   p = ?(this.tUnderline,  p ^ $FONT_UNDERLINE,  p)
 58   p = ?(this.tStrikeOut,  p ^ $FONT_STRIKEOUT,  p)
 59   p = ?(this.tHighQuality,p ^ $FONT_HIGHQUALITY,p)
 60   return p
 61 }
 62 property Font.Properties(int p){
 63   this.tBold        = ?((p & $FONT_BOLD)       ==$FONT_BOLD,       $true,$false)
 64   this.tItalic      = ?((p & $FONT_ITALIC)     ==$FONT_ITALIC,     $true,$false)
 65   this.tUnderline   = ?((p & $FONT_UNDERLINE)  ==$FONT_UNDERLINE,  $true,$false)
 66   this.tStrikeOut   = ?((p & $FONT_STRIKEOUT)  ==$FONT_STRIKEOUT,  $true,$false)
 67   this.tHighQuality = ?((p & $FONT_HIGHQUALITY)==$FONT_HIGHQUALITY,$true,$false)
 68   Font_Free(this.id)
 69   this.id = Font_LoadEx(this.tName.ptr(),this.tSize,this.Properties)
 70 }
 71 property int Font.Bold{
 72   return this.tBold
 73 }
 74 property Font.Bold(int state){
 75   int p
 76   if (this.tBold + state) == 1{
 77     p = this.Properties
 78     p = ?(state,p ^ $FONT_BOLD,p & $FONT_BOLD)
 79     Font_Free(this.id)
 80     this.id = Font_LoadEx(this.tName.ptr(),this.tSize,this.Properties)
 81   }
 82 }
 83 property int Font.Italic{
 84   return this.tItalic
 85 }
 86 property Font.Italic(int state){
 87   int p
 88   if (this.tItalic + state) == 1{
 89     p = this.Properties
 90     p = ?(state,p ^ $FONT_ITALIC,p & $FONT_ITALIC)
 91     Font_Free(this.id)
 92     this.id = Font_LoadEx(this.tName.ptr(),this.tSize,this.Properties)
 93   }
 94 }
 95 property int Font.Underline{
 96   return this.tUnderline
 97 }
 98 property Font.Underline(int state){
 99   int p
100   if (this.Underline + state) == 1{
101     p = this.Properties
102     p = ?(state,p ^ $FONT_UNDERLINE,p & $FONT_UNDERLINE)
103     Font_Free(this.id)
104     this.id = Font_LoadEx(this.tName.ptr(),this.tSize,this.Properties)
105   }
106 }
107 property int Font.StrikeOut{
108   return this.tStrikeOut
109 }
110 property Font.StrikeOut(int state){
111   int p
112   if (this.tStrikeOut + state) == 1{
113     p = this.Properties
114     p = ?(state,p ^ $FONT_STRIKEOUT,p & $FONT_STRIKEOUT)
115     Font_Free(this.id)
116     this.id = Font_LoadEx(this.tName.ptr(),this.tSize,this.Properties)
117   }
118 }
119 property int Font.HighQuality{
120   return this.tHighQuality
121 }
122 property Font.HighQuality(int state){
123   int p
124   if (this.tHighQuality + state) == 1{
125     p = this.Properties
126     p = ?(state,p ^ $FONT_HIGHQUALITY,p & $FONT_HIGHQUALITY)
127     Font_Free(this.id)
128     this.id = Font_LoadEx(this.tName.ptr(),this.tSize,this.Properties)
129   }
130 }
131 
Редактировать