aboutsummaryrefslogtreecommitdiffstats
path: root/Game/Code/Classes/UCommon.pas
diff options
context:
space:
mode:
authorjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-22 08:15:59 +0000
committerjaybinks <jaybinks@b956fd51-792f-4845-bead-9b4dfca2ff2c>2007-09-22 08:15:59 +0000
commitcf1102dac69a569279ae05dd95426d9e1c544ffc (patch)
tree48dbf78fa62ab1d86dbdbd23df83172181906880 /Game/Code/Classes/UCommon.pas
parent217cd16e10ff809e7382e5447f1ccde60f3e8564 (diff)
downloadusdx-cf1102dac69a569279ae05dd95426d9e1c544ffc.tar.gz
usdx-cf1102dac69a569279ae05dd95426d9e1c544ffc.tar.xz
usdx-cf1102dac69a569279ae05dd95426d9e1c544ffc.zip
minor bug fixes to have lazarus build load resources into SDL_Image
correctly... ( lazarus Resources are weak compared to delphi :( ) also Laz build will now run, and main loop works properly. git-svn-id: svn://svn.code.sf.net/p/ultrastardx/svn/trunk@429 b956fd51-792f-4845-bead-9b4dfca2ff2c
Diffstat (limited to '')
-rw-r--r--Game/Code/Classes/UCommon.pas26
1 files changed, 24 insertions, 2 deletions
diff --git a/Game/Code/Classes/UCommon.pas b/Game/Code/Classes/UCommon.pas
index b572a768..8089f28c 100644
--- a/Game/Code/Classes/UCommon.pas
+++ b/Game/Code/Classes/UCommon.pas
@@ -7,7 +7,10 @@ interface
{$ENDIF}
uses
-
+{$IFDEF FPC}
+ lResources,
+{$ENDIF}
+ ULog,
{$IFDEF win32}
windows;
{$ELSE}
@@ -28,7 +31,9 @@ type
type
TWndMethod = procedure(var Message: TMessage) of object;
-function RandomRange(aMin: Integer; aMax: Integer) : Integer;
+function LazFindResource( const aName, aType : String ): TLResource;
+
+function RandomRange(aMin: Integer; aMax: Integer) : Integer;
function MaxValue(const Data: array of Double): Double;
function MinValue(const Data: array of Double): Double;
@@ -82,6 +87,23 @@ end;
{$IFDEF FPC}
+function LazFindResource( const aName, aType : String ): TLResource;
+var
+ iCount : Integer;
+begin
+ result := nil;
+
+ for iCount := 0 to LazarusResources.count -1 do
+ begin
+ if ( LazarusResources.items[ iCount ].Name = aName ) AND
+ ( LazarusResources.items[ iCount ].ValueType = aType ) THEN
+ begin
+ result := LazarusResources.items[ iCount ];
+ exit;
+ end;
+ end;
+end;
+
function MaxValue(const Data: array of Double): Double;
var
I: Integer;