Difference between revisions of "Crt"

From Lazarus wiki
Jump to navigationJump to search
Line 5: Line 5:
  
  
== Procedures and functions ==
+
== Procedures and Functions ==
  
<nowiki>Keyboard:                              </nowiki><br>
+
===Keyboard:===                                
<nowiki> Function KeyPressed: Boolean;          </nowiki><br>
+
<syntaxhighlight lang="pascal">
<nowiki> Function ReadKey: Char;                </nowiki><br>
+
Function KeyPressed: Boolean;           
<nowiki>                                        </nowiki><br>
+
Function ReadKey: Char;                 
<nowiki>Display:                               </nowiki><br>
+
</syntaxhighlight>
<nowiki>Procedure TextMode (Mode: word);        </nowiki><br>
+
                                       
<nowiki>Procedure Window(X1,Y1,X2,Y2: Byte);    </nowiki><br>
+
===Display:===                             
<nowiki>Procedure Window32(X1,Y1,X2,Y2: DWord); </nowiki><br>
+
<syntaxhighlight lang="pascal">
<nowiki>Procedure ClrScr;                      </nowiki><br>
+
Procedure TextMode (Mode: word);         
<nowiki>Procedure ClrEol;                      </nowiki><br>
+
Procedure Window(X1,Y1,X2,Y2: Byte);     
<nowiki>Procedure InsLine;                      </nowiki><br>
+
Procedure Window32(X1,Y1,X2,Y2: DWord);  
<nowiki>Procedure DelLine;                      </nowiki><br>
+
Procedure ClrScr;                       
<nowiki>Procedure TextColor(Color: Byte);      </nowiki><br>
+
Procedure ClrEol;                       
<nowiki>Procedure TextBackground(Color: Byte);  </nowiki><br>
+
Procedure InsLine;                       
<nowiki>Procedure LowVideo;                    </nowiki><br>
+
Procedure DelLine;                       
<nowiki>Procedure HighVideo;                    </nowiki><br>
+
Procedure TextColor(Color: Byte);       
<nowiki>Procedure NormVideo;                    </nowiki><br>
+
Procedure TextBackground(Color: Byte);   
<nowiki>                                        </nowiki><br>
+
Procedure LowVideo;                     
<nowiki>Cursor Control:                        </nowiki><br>
+
Procedure HighVideo;                     
<nowiki>Procedure cursoron;                    </nowiki><br>
+
Procedure NormVideo;                     
<nowiki>Procedure cursoroff;                    </nowiki><br>
+
</syntaxhighlight>
<nowiki>Procedure cursorbig;                    </nowiki><br>
+
                                       
<nowiki>Procedure GotoXY(X,Y: tcrtcoord);      </nowiki><br>
+
===Cursor Control:===                          
<nowiki>Procedure GotoXY32(X,Y: DWord);        </nowiki><br>
+
<syntaxhighlight lang="pascal">
<nowiki> Function WhereX: tcrtcoord;            </nowiki><br>
+
Procedure cursoron;                     
<nowiki> Function WhereY: tcrtcoord;            </nowiki><br>
+
Procedure cursoroff;                     
<nowiki> Function WhereX32: DWord;              </nowiki><br>
+
Procedure cursorbig;                     
<nowiki> Function WhereY32: DWord;              </nowiki><br>
+
Procedure GotoXY(X,Y: tcrtcoord);       
<nowiki>                                        </nowiki><br>
+
Procedure GotoXY32(X,Y: DWord);         
<nowiki>Sound:                                  </nowiki><br>
+
Function WhereX: tcrtcoord;             
<nowiki>Procedure Sound(Hz: Word);              </nowiki><br>
+
Function WhereY: tcrtcoord;             
<nowiki>Procedure NoSound;                      </nowiki><br>
+
Function WhereX32: DWord;               
<nowiki>                                        </nowiki><br>
+
Function WhereY32: DWord;               
<nowiki>Delay:  (Typically used with sound)    </nowiki><br>
+
</syntaxhighlight>
<nowiki>Procedure Delay(MS: Word);              </nowiki><br>
+
                                       
<nowiki>                                        </nowiki><br>
+
===Sound:===                                  
<nowiki>File:                                  </nowiki><br>
+
<syntaxhighlight lang="pascal">
<nowiki>Procedure AssignCrt(var F: Text);      </nowiki><br>
+
Procedure Sound(Hz: Word);               
 +
Procedure NoSound;                       
 +
</syntaxhighlight>
 +
                                       
 +
===Delay:  (Typically used with sound)===      
 +
<syntaxhighlight lang="pascal">
 +
Procedure Delay(MS: Word);               
 +
</syntaxhighlight>
 +
                                       
 +
===File:===                                    
 +
<syntaxhighlight lang="pascal">
 +
Procedure AssignCrt(var F: Text);       
 +
</syntaxhighlight>
  
 
== Variables and Constants ==
 
== Variables and Constants ==
  
<nowiki>Color Constants:</nowiki><br>
+
===Color Constants:===
<nowiki>Black = 0;</nowiki><br>
+
<syntaxhighlight lang="pascal">
<nowiki>Blue = 1;</nowiki><br>
+
const
<nowiki>Green = 2;</nowiki><br>
+
  Black       =   0;
<nowiki>Cyan = 3;</nowiki><br>
+
  Blue         =   1;
<nowiki>Red = 4;</nowiki><br>
+
  Green       =   2;
<nowiki>Magenta = 5;</nowiki><br>
+
  Cyan         =   3;
<nowiki>Brown = 6;</nowiki><br>
+
  Red         =   4;
<nowiki>LightGray = 7;</nowiki><br>
+
  Magenta     =   5;
<nowiki>DarkGray = 8;</nowiki><br>
+
  Brown       =   6;
<nowiki>LightBlue = 9;</nowiki><br>
+
  LightGray   =   7;
<nowiki>LightGreen = 10;</nowiki><br>
+
  DarkGray     =   8;
<nowiki>LightCyan = 11;</nowiki><br>
+
  LightBlue   =   9;
<nowiki>LightRed = 12;</nowiki><br>
+
  LightGreen   = 10;
<nowiki>LightMagenta = 13;</nowiki><br>
+
  LightCyan   = 11;
<nowiki>Yellow = 14;</nowiki><br>
+
  LightRed     = 12;
<nowiki>White = 15;</nowiki><br>
+
  LightMagenta = 13;
<nowiki>Blink = 128;</nowiki><br>
+
  Yellow       = 14;
 
+
  White       = 15;
 
+
  Blink       = 128;
 +
</syntaxhighlight>
  
  
 
[[Category:Units]]
 
[[Category:Units]]

Revision as of 17:49, 10 January 2018

Template:Translate

CRT is a unit providing subroutines for programming in text mode. It is similar to ncurses C library. It's intention is to be compatible with the Borland Pascal 7 CRT unit.


Procedures and Functions

Keyboard:

 Function KeyPressed: Boolean;          
 Function ReadKey: Char;

Display:

Procedure TextMode (Mode: word);        
Procedure Window(X1,Y1,X2,Y2: Byte);    
Procedure Window32(X1,Y1,X2,Y2: DWord); 
Procedure ClrScr;                       
Procedure ClrEol;                       
Procedure InsLine;                      
Procedure DelLine;                      
Procedure TextColor(Color: Byte);       
Procedure TextBackground(Color: Byte);  
Procedure LowVideo;                     
Procedure HighVideo;                    
Procedure NormVideo;

Cursor Control:

Procedure cursoron;                     
Procedure cursoroff;                    
Procedure cursorbig;                    
Procedure GotoXY(X,Y: tcrtcoord);       
Procedure GotoXY32(X,Y: DWord);         
Function WhereX: tcrtcoord;            
Function WhereY: tcrtcoord;            
Function WhereX32: DWord;              
Function WhereY32: DWord;

Sound:

Procedure Sound(Hz: Word);              
Procedure NoSound;

Delay: (Typically used with sound)

Procedure Delay(MS: Word);

File:

Procedure AssignCrt(var F: Text);

Variables and Constants

Color Constants:

const
  Black        =   0;
  Blue         =   1;
  Green        =   2;
  Cyan         =   3;
  Red          =   4;
  Magenta      =   5;
  Brown        =   6;
  LightGray    =   7;
  DarkGray     =   8;
  LightBlue    =   9;
  LightGreen   =  10;
  LightCyan    =  11;
  LightRed     =  12;
  LightMagenta =  13;
  Yellow       =  14;
  White        =  15;
  Blink        = 128;