Page 1 of 7 123 ... LastLast
Results 1 to 10 of 67

Thread: Pascal and XNA...

  1. #1

    Pascal and XNA...

    I was just discussing with cairnswm about creating stuff with Pascal and XNA. Since Chrome 1.5 supports .NET 2.0 I thought I would quickly try and get a Hello world progam workin. This is the result...



    0. Install .NET 2.0 and XNA Game Studio Express

    1. Download the Free Chrome 1.5 command line compiler and install it

    2. Create a file named XNADemo.pas and copy code as follows...

    Code:
    namespace XNADemo;
    
    interface
    
    uses
      Microsoft.Xna.Framework,
      Microsoft.Xna.Framework.Content,
      Microsoft.Xna.Framework.Audio,
      Microsoft.Xna.Framework.Graphics,
      Microsoft.Xna.Framework.Input,
      Microsoft.Xna.Framework.Storage;
    
    type
      TXNAGame = class(Microsoft.Xna.Framework.Game)
      private
        // these are the size of the output window, ignored on Xbox 360
        preferredWindowWidth  : integer;
        preferredWindowHeight : integer;
    
        graphics : GraphicsDeviceManager;
    
        class content : ContentManager;
      protected
        method Initialize; override;
        method BeginRun; override;
        method Update( gameTime : Gametime ); override;
        method BeginDraw : boolean; override;
        method Draw( gameTime : Gametime ); override;
        method EndDraw; override;
        method LoadGraphicsContent( loadAllContent : boolean ); override;
        method UnloadGraphicsContent( unloadAllContent : boolean ); override;
      public
        constructor;
    
        // Entry point into this object.
        class method Main;
      end;
    
    implementation
    
    constructor TXNAGame;
    begin
      inherited;
      preferredWindowWidth := 320;//1280;
      preferredWindowHeight := 240;//720;
      
      Self.graphics := new Microsoft.Xna.Framework.GraphicsDeviceManager(Self);
      Self.graphics.PreferredBackBufferWidth := preferredWindowWidth;
      Self.graphics.PreferredBackBufferHeight := preferredWindowHeight;
    end;
    
    class method TXNAGame.Main;
    begin
      try
        // probably should not be instantiating an object within itself :).
        with lGame := new TXNAGame do
          lGame.Run;
      except
        on E: Exception do
        begin
          // MessageBox.Show(E.Message);
        end;
      end;
    end;
    
    method TXNAGame.Initialize;
    begin
      // Your Initialize Code here
      Window.Title := 'Pascal and XNA';
      
      inherited;
    end;
    
    method TXNAGame.BeginRun;
    begin
      // Your BeginRun Code here
      inherited;
    end;
    
    method TXNAGame.Update( gameTime : Gametime );
    begin
      // Allows the default game to exit on Xbox 360 and Windows
      if (GamePad.GetState(PlayerIndex.One).Buttons.Back = ButtonState.Pressed) then
         Self.Exit();
    
      // Your Update Code here
    
      inherited Update( gameTime );
    end;
    
    method TXNAGame.BeginDraw : boolean;
    begin
      if not ( inherited BeginDraw ) then
      begin
        result := false;
        exit;
      end;
    
      // Your BeginDraw Code here
    
      result := true;
    end;
    
    method TXNAGame.Draw( gameTime : Gametime );
    begin
      graphics.GraphicsDevice.Clear( Color.CornflowerBlue );
    
      inherited Draw( gameTime );
    
      // Your Draw Code here
    
    end;
    
    method TXNAGame.EndDraw;
    begin
      // Your EndDraw Code here
    
      inherited;
    end;
    
    method TXNAGame.LoadGraphicsContent( loadAllContent : boolean );
    begin
      if (loadAllContent) then
      begin
        // TODO: Load any ResourceManagementMode.Automatic content
      end;
    
      // TODO: Load any ResourceManagementMode.Manual content
      
    end;
    
    method TXNAGame.UnloadGraphicsContent( unloadAllContent : boolean );
    begin
      if (unloadAllContent) then
      begin
        content.Unload;
      end;
    end;
    
    end.
    3. At the command line type
    Code:
    Chrome XNADemo.pas /frameworkversion:v2.0.50727 /ref:"C:\Program Files\Microsoft XNA\XNA Game Studio Express\v1.0\References\Windows\x86\Microsoft.Xna.Framework.dll" /ref:"C:\Program Files\Microsoft XNA\XNA Game Studio Express\v1.0\References\Windows\x86\Microsoft.Xna.Framework.Game.dll"
    If all goes well you should have an XNADemo.exe file ready to run. This will display a blank screen with the Window title "Pascal and XNA"!

    Remember this is Chrome Object Pascal, which is slightly different to CodeGear Object Pascal
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  2. #2

    Pascal and XNA...

    An impressive black window
    [size=9px]BEGIN GEEK CODE BLOCK
    <br />d s-- : a24 GB GCS GTW GE C++ P L+ W++ N+ K- w++++ M- PS+ PE+ Y- t+ 5+++ X+ R*
    <br />tv b+ DI++ D+ e++ h+ G-
    <br />END GEEK CODE BLOCK[/size]
    <br />Create your own GeekCode block at: <a href="">...</a>

  3. #3

    Pascal and XNA...

    Quote Originally Posted by tanffn
    An impressive black window
    I've been told I create the best black windows in the business.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  4. #4

    Pascal and XNA...

    Perhaps a silly question but does this mean we can develop for Xbox 360?

  5. #5

    Pascal and XNA...

    .net 2.0 executables should be able to run on the XBOX 360. THis is a pretty sweet find savage .

  6. #6

    Pascal and XNA...

    Quote Originally Posted by Traveler
    Perhaps a silly question but does this mean we can develop for Xbox 360?
    In theory, that is the case.

    Taken from a google ]
    The cash cow is XNA Creators Club, an Xbox Live-hosted service that Microsoft hopes budding developers will turn to for help, white papers, game assets offered not only by Microsoft but also by third-parties, forums and the like. More to the point, coders won't be able to deliver games to Xbox 360 owners without coughing up to Microsoft.

    In addition to the $99 annual subscription, purchased through Xbox Live Marketplace, Microsoft is also offering a $49 four-month sub. Membership will allow developers to offer finished games through Xbox Live Arcade.

    Downloaders will require a console fitted with a hard drive and likewise be an XNA Creators Club member, Microsoft's XNA FAQ reveals. That's because creators don't share the game but the assets and source code, which the recipient must then compile into an Xbox 360-friendly format. Xbox 360 games must be offered on non-commercial terms, Microsoft added, though XNA can be used to develop commercial titles for Windows.

    "Games developed using XNA Game Studio Express cannot be shared through a memory card or CD/DVD at this time," the software giant warned.
    [/quote]

    Someone would need to investigate this further. I would if I had an XB360 but I don't and only plan on getting a PS3 when that is released in the UK.
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  7. #7

    Pascal and XNA...

    http://blogs.msdn.com/coding4fun/arc...8/1491742.aspx

    I'll also ask around and see what I can find out about doing this outside of VisualStudios. The link above at least explains how to do it within VisualStudios (witch can be used with Chrome).

  8. #8
    Legendary Member cairnswm's Avatar
    Join Date
    Nov 2002
    Location
    Randburg, South Africa
    Posts
    1,537

    Pascal and XNA...

    If I can get a Pascal Program running on an XBox360 I might actually buy one!

    I've already converted my S2DL framework over to C# and XNA Game Studio Express. If I can use Pascal instead I will also convert to Chrome and XNA.

    I use ConTEXT as my editor of choice for command line compilers - I will try set it up tonight to compile and run the program with F9. If I can I pretty much have enough to start writing XBox games

    Well done Savage!
    William Cairns
    My Games: http://www.cairnsgames.co.za (Currently very inactive)
    MyOnline Games: http://TheGameDeveloper.co.za (Currently very inactive)

  9. #9

    Pascal and XNA...

    using /ref: switch in Chrome you should be able to link to the XBox versions of the Xna.* Assemblies which are installed when XNA Game Studio Express is installed. So I think it should theoretically be possible to use Chrome to create an XB360 exe.

    There are some tutorial videos that show how to load 3D objects etc over @ http://blogs.msdn.com/xna/archive/20...available.aspx
    but you should be able to keep up to date by checking
    http://blogs.msdn.com/xna/
    regularly
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  10. #10
    Co-Founder / PGD Elder WILL's Avatar
    Join Date
    Apr 2003
    Location
    Canada
    Posts
    6,107
    Blog Entries
    25

    Pascal and XNA...

    Am I going to have to put XBox360 in the description for the 'Console Development' forum?
    Jason McMillen
    Pascal Game Development
    Co-Founder





Page 1 of 7 123 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •