Results 1 to 10 of 13

Thread: Delphi XE3 , Asphyre Sphinx 3

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Hi Robert! Welcome back

    To change to which component will Asphyre Sphinx 3 render you need to use code similar like this:

    I quickly modified code of the Basic example which comes with Asphyre Sphinx 3 so that it renders to Panel1 instead of directly rendering to the MainForm. I have left original code lines as comens so you can easily see what was changed and how.
    Code:
    procedure TMainForm.OnDeviceInit(Sender: TObject; Param: Pointer;
     var Handled: Boolean);
    begin
     //DisplaySize:= Point2px(ClientWidth, ClientHeight);
     DisplaySize:= Point2px(Panel1.ClientWidth, Panel1.ClientHeight);
     //GameDevice.SwapChains.Add(Self.Handle, DisplaySize);
     GameDevice.SwapChains.Add(Panel1.Handle, DisplaySize);
    end;

  2. #2
    Hello, thank you

    Hopefully I will get somewhere now. Right now I'm having a heck of a time again with loading AsphyreImages from asvf into TBitmap :

    Code:
          ImageTemp:=GameImages.Image[GameImages.Items[i].Name];
    It does not work obviously because ImageTemp expects TBitMap , but gets TAsphyreImage ... is there a simple solution for this ?

    Greetings

    update :

    think I will just cheat,since I'm planning to use fixed tiles, they won't change ... I'll just use ImageList 's to store tiles for the editor , and will use It like this :
    Code:
    procedure TForm1.DisplayAvailableTiles( TileSet : string );
    var i,j : integer;
        MyType : string;
    begin
      j:=0;
      // fill up listview with images
      for i:=0 to GameImages.ItemCount-1 do
        begin
          MyType:=copy(GameImages.Items[i].Name,0,4);
    
          if MyType = TileSet then
            begin
              if TileSet = 'Land' then ListView1.SmallImages:=TileDesert;
              if TileSet = 'Ocea' then ListView1.SmallImages:=TileOcean;
              ListView1.Items.Add.Caption:=GameImages.Items[i].Name;
              ListView1.Items.Item[j].ImageIndex:=j;
              j:=j+1;
            end;
    
         end;
      
      // set index to 0
     ListView1.ItemIndex:=0;
    end;
    it might not be the best solution but works nicely... now using a combobox , I can display tiles per category :

    -DesertTiles , OceanTils , DebrisTiles etc...
    Last edited by robert83; 24-02-2014 at 08:52 AM.

  3. #3
    Hello,

    [ Did not have much time to work on this editor thing,because I had to finish a database program that showcases (sorta) my knowledge , so that I may finally get a IT related job here in Germany ...]

    Anyway some update, I've been banging my head against the wall , because with my new editor layers 0 and 1 did not work properly , example, I've put a transparent shore tile on Layer1, then I've put an Ocean tile on Layer0 , the Ocean tile would be on top of the shore one, I've looked at the damn code for hours what could be wrong, even created a stringgrid for all arrays to display raw tile names.

    And then I found this in AsphyreSprite.pas

    Code:
      constructor TSprite.Create(const AParent: TSprite);
      begin
        inherited Create;
        FParent := AParent;
        if FParent <> nil then
        begin
          FParent.Add(Self);
          if FParent is TSpriteEngine then
            FEngine := TSpriteEngine(FParent)
          else
            FEngine := FParent.Engine;
          Inc(FEngine.FAllCount);
        end;
        FX := 200;
        FY := 200;
        FZ := 0;
        if Z = 0 then
          Z := 1;
        FWidth := 64;
        FHeight := 64;
        FName := '';
        FZ := 0;
        FPatternIndex := 0;
        FDoCollision := False;
        FMoved := True;
        FEffect := beNormal;
        FVisible := True;
        FTag := 0;
      end;
    see ? if Z = 0 then Z := 1; god dammit ...anyway back on track now, once the editor progresses as far as the other one with older Asphyre I will post it here along with source and all...

    Greetings
    Robert

  4. #4
    Since I don't have source code for this newer version of Asphyre Sprite Engine I'm asuming that Z is z order property of TSprite which determines which sprites are rendered on top. Also I'm asuming that FZ is internal vriable for storing Z property value.
    Now the
    Code:
    if Z = 0 then Z := 1;
    seems realy strange since accessing class property from within a class methods could lead to big problems (infinite loops) and should be therefore avoided if posible or used only for reading the property value.
    But what caught my eye even more is that in the code variable FZ (probably internal variable for storin Z property value) is set to 0 twice. Once right before that "if Z = 0" code and again a few lines below. This completly nullifies the efects of "if Z = 0" part of code and FZ is always 0.

    What happens if you change the Z property after the Sprite has already been created (set Z of Shore sprite to 1 and ocean sprite to 0 or maybe oposite)?

  5. #5
    Hello, so I did a bit further into this re-creatin...and I've hit the same problem with scrolling, I don't know what I'm doing wrong, but this MUST be me, since both Asphyre Extreem and this Asphyre 3 have demos with Smooth Scrolling and there it's all fine...
    What I did now, is I have a fullscreen app that loads all the tiles at once , and then on processevent (which is supposed to be running at constant speed executes it...)
    Well I still feel it is no smooth (guess this is what seperates the men from boys) .

    Attached is the source code, with all resouces ,and compiled exe , that automatically loads masodik.map file and scrolls trough it. (yeah, I've draw all my tiles.... )

    Please enlighten me what am I doing wrong, this is driving me crazy.

    Greetings
    Attached Files Attached Files

  6. #6
    Fast reply...WOW!

    I switched to OpenGL... It is scrolling smoothly now, why? I checked multiple speeds it is fine , I have only one problem, OpenGL 640x480 does not stretch to full screen , why?
    If need be I'll go use OpenGL instead.... don't plan to use any special directx effects...just trying to learn somthng...and pass some time till I get some job in Germany (which is harder then I thougt , cause I don't have any IT degree, and even though I've created a quiet nice database program for vehicle management as a demonstration of my skils, and I do know a thing or two about Linux ... I feel they don't care...sh*t... , my life NOOOO.... sorry drifted a bit of)

    Edit : DirectX9 is also smooth, it just hit me, DirectX7 is some kind of weird software rendering thing.... anyway please take a look at my source doing the scrolling like that in processing is correct?

    Plan : map scrolls down.... enemies appear later based on Layer 4 or Layer 5 , a few enemy types.... follow player...random movement shoot down etc...

    Nothing fancy...just make something very very basic...

    UPDATE 2 : still happens not as often though...I hate my life
    Last edited by robert83; 09-03-2014 at 09:53 AM.

  7. #7
    DirectX9 is also smooth, it just hit me, DirectX7 is some kind of weird software rendering thing.... anyway please take a look at my source doing the scrolling like that in processing is correct?
    I think that using DirectX 7 provider on Windows Vista and newer would result running in software mode which is there for backward compatibility while using DirectX 7 provider on Windows XP should still result in mostly hardware acelerated mode depending on your graphics card capabilities.

    Anywhay I quickly checked your code and I don't think there are any major botlenecks in it. Athleast none of them caught my eye.

    Quote Originally Posted by robert83 View Post
    just trying to learn somthng...and pass some time till I get some job in Germany (which is harder then I thougt , cause I don't have any IT degree, and even though I've created a quiet nice database program for vehicle management as a demonstration of my skils, and I do know a thing or two about Linux ... I feel they don't care...sh*t... , my life NOOOO.... sorry drifted a bit of)
    Unfortunately there aren't many jobs available for Delphi/Objective Pascal programmers due to language not being so popular.
    And due to the fact that creating a database driven application is not so hard these days I don't think that is best way to show your programming skils.
    A guy I know managed to make rudimentary inventory managment program (database driven) in just about three days. And later he spend about two months discusing and finetuning the visual interface to fully suit the customer needs.

    And while we are talking about databases check your PM I got a question for you for a change

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
  •