From e3fc5e2c58302159b79e0e25e183aa3e75397a41 Mon Sep 17 00:00:00 2001 From: jaybinks Date: Tue, 18 Sep 2007 11:16:30 +0000 Subject: added switches.inc , which will contain compiler directives used ( at least ) for porting to linux. this file now contains compiler directive UseSerialPort, which is conditionally set depending on the compiler. at this point lazarus will not use the serial port ( LCD or Light ) units. however this functionality should be maintained at this point in delphi. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@390 b956fd51-792f-4845-bead-9b4dfca2ff2c --- Game/Code/Classes/ULCD.pas | 18 +++++++++++++++--- Game/Code/Classes/ULight.pas | 9 ++++++++- Game/Code/Classes/UMain.pas | 14 ++++++++++++-- 3 files changed, 35 insertions(+), 6 deletions(-) (limited to 'Game/Code/Classes') diff --git a/Game/Code/Classes/ULCD.pas b/Game/Code/Classes/ULCD.pas index a3cdac73..52b0f96a 100644 --- a/Game/Code/Classes/ULCD.pas +++ b/Game/Code/Classes/ULCD.pas @@ -1,6 +1,7 @@ unit ULCD; interface +{$I switches.inc} type TLCD = class @@ -41,16 +42,24 @@ const implementation uses - SysUtils, zlportio, UTime; + SysUtils, + {$IFDEF UseSerialPort} + zlportio, + {$ENDIF} + UTime; procedure TLCD.WriteCommand(B: Byte); // Wysylanie komend sterujacych begin - if not HalfInterface then begin +{$IFDEF UseSerialPort} + if not HalfInterface then + begin zlioportwrite(Control, 0, $02); zlioportwrite(Data, 0, B); zlioportwrite(Control, 0, $03); - end else begin + end + else + begin zlioportwrite(Control, 0, $02); zlioportwrite(Data, 0, B and $F0); zlioportwrite(Control, 0, $03); @@ -66,11 +75,13 @@ begin Sleep(2) else TimeSleep(0.1); +{$ENDIF} end; procedure TLCD.WriteData(B: Byte); // Wysylanie danych begin +{$IFDEF UseSerialPort} if not HalfInterface then begin zlioportwrite(Control, 0, $06); zlioportwrite(Data, 0, B); @@ -89,6 +100,7 @@ begin TimeSleep(0.1); Inc(Position); +{$ENDIF} end; procedure TLCD.WriteString(S: string); diff --git a/Game/Code/Classes/ULight.pas b/Game/Code/Classes/ULight.pas index 1fc4aba8..b9c7af9e 100644 --- a/Game/Code/Classes/ULight.pas +++ b/Game/Code/Classes/ULight.pas @@ -1,5 +1,6 @@ unit ULight; interface +{$I switches.inc} type TLight = class @@ -30,7 +31,11 @@ const implementation uses - SysUtils, zlportio, UTime; + SysUtils, + {$IFDEF UseSerialPort} + zlportio, + {$ENDIF} + UTime; constructor TLight.Create; begin @@ -45,8 +50,10 @@ end; procedure TLight.SetState(State: integer); begin + {$IFDEF UseSerialPort} if Enabled then PortWriteB($378, State); + {$ENDIF} end; procedure TLight.AutoSetState; diff --git a/Game/Code/Classes/UMain.pas b/Game/Code/Classes/UMain.pas index 43010bde..e89b4785 100644 --- a/Game/Code/Classes/UMain.pas +++ b/Game/Code/Classes/UMain.pas @@ -1,8 +1,16 @@ unit UMain; interface +{$I switches.inc} + uses SDL, UGraphic, UMusic, URecord, UTime, SysUtils, UDisplay, UIni, ULog, ULyrics, UScreenSing, - OpenGL12, zlportio {you can disable it and all PortWriteB calls}, ULCD, ULight, UThemes{, UScreenPopup}; + OpenGL12, + + {$IFDEF UseSerialPort} + zlportio {you can disable it and all PortWriteB calls}, + {$ENDIF} + + ULCD, ULight, UThemes{, UScreenPopup}; type TPlayer = record @@ -512,7 +520,9 @@ begin if (TempBeat mod 4 <> 0) then Music.PlayHihat;*) end; - //PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala + {$IFDEF UseSerialPort} + // PortWriteB($378, LPT_1 + LPT_2 * 2); // 0 zapala + {$ENDIF} end; procedure NewBeatD(Sender: TScreenSing); -- cgit v1.2.3