I am talking about both the Chrome command line compiler and the version that works within VS2005. The demos work with both. The thing that is a bit fiddly right now is adding resources to the project file. That needs to be done manually for now.
I am talking about both the Chrome command line compiler and the version that works within VS2005. The demos work with both. The thing that is a bit fiddly right now is adding resources to the project file. That needs to be done manually for now.
What is the possibilty of having pascal code that can compile in both Delphi (win32) and Chrome?
I know Indy has ifdefs to handle .Net compalation, is something simalar possible with Chrome? I'm just wanders code it would be nice to have XNA support in the engine I am building...
<A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
<br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
<br /></A>
The main IFDEF would look something like
{$IFDEF DELPHI}procedure{$ELSE}method{$ENDIF} MyfunctionOrProcedure();
Chrome does NOT have the concept of function/procedure only method.
Keep in mind that Chrome is working at .NET 2.0 so supports most of the features from that version and as such makes use of generics in XNA. Not to say that you couldn't work around this, but it would be a bit of a pain until Codgear add it to their Win32 and .NET compilers.
Thanks for the hint Dom
I just got the following to compile and run under Chrome, Delphi and FPC.
ChromeDelphi.dpr
[pascal]
{$IFDEF CHROME}
namespace ChromeDelphi;
{$ELSE}
program ChromeDelphi;
{$APPTYPE CONSOLE}
{$ENDIF}
{$IFDEF CHROME}
interface
uses System.*;
{$ELSE}
uses Test;
{$ENDIF}
{$IFDEF CHROME}
type
ConsoleApp = class
private
public
class method Main(args: array of string);
end;
{$ENDIF}
{$IFDEF CHROME}
implementation
{$ENDIF}
var a: TTest;
{$IFDEF CHROME}
class method ConsoleApp.Main(args: array of string);
{$ENDIF}
begin
WriteLine('InfinitEngine Test');
a := TTest.Create;
a.doStuff;
ReadLine();
{$IFDEF CHROME}
end;
{$ENDIF}
end.
[/pascal]
Test.pas
[pascal]
{$IFDEF CHROME}
namespace ChromeDelphi;
{$ELSE}
unit Test;
{$ENDIF}
interface
{$IFDEF CHROME}
uses System.*;
{$ELSE}
{$ENDIF}
type
TTestRecord = record
a: Integer;
end;
TTest = class
private
r: TTestRecord;
public
constructor Create;
procedure DoStuff; virtual;
end;
procedure WriteLine(s: string);
procedure ReadLine;
implementation
procedure WriteLine(s: string);
begin
{$IFDEF CHROME}
Console.WriteLine(s);
{$ELSE}
Writeln(s);
{$ENDIF}
end;
procedure ReadLine;
begin
{$IFDEF CHROME}
Console.ReadLine();
{$ELSE}
Readln;
{$ENDIF}
end;
constructor TTest.Create;
begin
inherited Create;
WriteLine('TTest.Create');
end;
procedure TTest.DoStuff;
begin
WriteLine('TTest.DoStuff');
end;
end.
[/pascal]
Well impressed
<A HREF="http://www.myhpf.co.uk/banner.asp?friend=139328">
<br /><IMG SRC="http://www.myhpf.co.uk/banners/60x468.gif" BORDER="0">
<br /></A>
Excellent Stuff Dean!
I just received my copy of Professional XNA Game Programming: For Xbox 360 and Windows so will start pouring over that this evening.
Pascal you say. But .Net is from Microsoft. And that look like C# for me or I should say PAscal# :-)
Live programming, eat programming, breath programming and die programming
You should check out Chrome: www.remobjects.com
or of course, Delphi for .NET: www.codegear.com
Both will allow you to work with .NET in Object Pascal. However only Chrome will allow you to work with XNA as it's the only Object Pascal compiler to support the nessissary versions of .NET to do so.
Hi Savage, I wanted to download 1 or more of your XNA demo projects you wrote using Chrome hosted on pascalgamedevelopment, but they don't seem to be there anymore (too old I guess).
Is there anyway I can get hold of them someplace?
cheers,
Paul
Games:
Seafox
Pages:
Syntax Error Software
itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
Bookmarks