aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UPlatform.pas
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-01-12 12:31:43 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2008-01-12 12:31:43 +0000
commite74bd57c12f470257111c1c0530fb38f0fd34414 (patch)
treeea55446e8faa73e164d53521c108d748095a9f80 /Game/Code/Classes/UPlatform.pas
parent79c5b96f49412541efdd51bca62ce5912b864c08 (diff)
downloadusdx-e74bd57c12f470257111c1c0530fb38f0fd34414.tar.gz
usdx-e74bd57c12f470257111c1c0530fb38f0fd34414.tar.xz
usdx-e74bd57c12f470257111c1c0530fb38f0fd34414.zip
bunch of smaller changes...
some changes to song loading... Record global changed to singleton object started implementing mic volume display in Settings-Record hope this dosnt break anything.. :P git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@789 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to 'Game/Code/Classes/UPlatform.pas')
-rw-r--r--Game/Code/Classes/UPlatform.pas74
1 files changed, 19 insertions, 55 deletions
diff --git a/Game/Code/Classes/UPlatform.pas b/Game/Code/Classes/UPlatform.pas
index 19a960e7..bfb03d54 100644
--- a/Game/Code/Classes/UPlatform.pas
+++ b/Game/Code/Classes/UPlatform.pas
@@ -16,7 +16,6 @@ interface
uses Classes;
type
-
TDirectoryEntry = Record
Name : WideString;
IsDirectory : Boolean;
@@ -27,33 +26,16 @@ type
IPlatform = Interface
['{63A5EBC3-3F4D-4F23-8DFB-B5165FCA23DF}']
- Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
- function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean;
-
- function GetLogPath : WideString;
- function GetGameSharedPath : WideString;
- function GetGameUserPath : WideString;
- end;
-
- TPlatform = class( TInterfacedOBject, IPlatform )
-
- // DirectoryFindFiles returns all files matching the filter. Do not use '*' in the filter.
- // If you set ReturnAllSubDirs = true all directories will be returned, if yout set it to false
- // directories are completely ignored.
- function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray; virtual; abstract;
-
- function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean; virtual;
-
-// function GetGamePath : WideString; virtual;
- function GetLogPath : WideString; virtual;
- function GetGameSharedPath : WideString; virtual;
- function GetGameUserPath : WideString; virtual;
-
+ Function DirectoryFindFiles(Dir, Filter : WideString; ReturnAllSubDirs : Boolean) : TDirectoryEntryArray;
+ function TerminateIfAlreadyRunning(var WndTitle : String) : Boolean;
+ function FindSongFile(Dir, Mask: widestring): widestring;
+ procedure halt;
+ function GetLogPath : WideString;
+ function GetGameSharedPath : WideString;
+ function GetGameUserPath : WideString;
end;
-
-var
- Platform : IPlatform;
+ function Platform : IPlatform;
implementation
@@ -69,48 +51,30 @@ uses
UPlatformMacOSX;
{$ENDIF}
-{ TPlatform }
-(*
-function TPlatform.GetGamePath: WideString;
-begin
- // Windows and Linux use this:
- Result := ExtractFilePath(ParamStr(0));
-end;
-*)
-function TPlatform.GetLogPath : WideString;
-begin
- result := ExtractFilePath(ParamStr(0));
-end;
-
-function TPlatform.GetGameSharedPath : WideString;
-begin
- result := ExtractFilePath(ParamStr(0));
-end;
+// I have modified it to use the Platform_singleton in this location ( in the implementaiton )
+// so that this variable can NOT be overwritten from anywhere else in the application.
+// the accessor function platform, emulates all previous calls to work the same way.
+var
+ Platform_singleton : IPlatform;
-function TPlatform.GetGameUserPath : WideString;
+function Platform : IPlatform;
begin
- result := ExtractFilePath(ParamStr(0));
+ result := Platform_singleton;
end;
-function TPlatform.TerminateIfAlreadyRunning(var WndTitle : String) : Boolean;
-begin
- // Linux and Mac don't check for running apps at the moment
- Result := false;
-end;
initialization
-
{$IFDEF MSWINDOWS}
- Platform := TPlatformWindows.Create;
+ Platform_singleton := TPlatformWindows.Create;
{$ENDIF}
{$IFDEF LINUX}
- Platform := TPlatformLinux.Create;
+ Platform_singleton := TPlatformLinux.Create;
{$ENDIF}
{$IFDEF DARWIN}
- Platform := TPlatformMacOSX.Create;
+ Platform_singleton := TPlatformMacOSX.Create;
{$ENDIF}
finalization
- Platform := nil;
+ Platform_singleton := nil;
end.