Results 1 to 8 of 8

Thread: Screen Output

  1. #1

    Screen Output

    I've been working on Turbo Pascal, I recently started working on Delphi,
    and I'm currently trying to understand it..... So i was wandering If there
    is an easy way, to create a Window i.e 320x240, and then let me draw
    in it, pixel per pixel? I want to make a 2D game, so i need this drawing
    to be fast enough for some basic animation.

    Oh, also can i do this from a console application? (I'm still used to turbo.. )


    Thank you in advance.

  2. #2

    Re: Screen Output

    Turbo Pascal generates DOS only executables (and you will need a fix for run-time error bug on fast machines). Indeed, you can try using interrupts to change video mode to 13h (320x200) and then accessing video memory directly (at A000:0000, if my memory is correct), but you may want to explore other options first.

    In order to create Win32 console executables (if that's what you are after), you can use either FreePascal or Delphi. Using either OpenGL and Direct3D you can draw images and stuff, but it's no longer made on pixel-by-pixel basis (though it's still possible), though it needs video hardware to do this. There is another option - using DirectDraw. It's rather outdated but if you really need only to manipulate pixels, this option may be worth exploring.

  3. #3

    Screen Output

    Those are good solutions but maybe not the easiest to get into especially straight from TP.

    I would highly recommend you start with the good old windows GDI.
    So yes you need a window, put down a TImage or similar and initalise it with a picture, then you can draw on it on a per pixel basis or copy another TImage onto it fairly fast if you keep the drawing area small...

    Here are a few places to start:
    - Look up the TBitmap.Scanline function in the Delphi help. It allows you to get the raw pixels of that picture.
    - Google Delphi GDI or Delphi Canvas...
    My site: DelphiTuts.com (coming soon)...

    Download Font Studio 4.21 here.

  4. #4

    Screen Output

    As an addition to Nitrogen's answer, check efg's Computer Lab which contains many useful tutorials and information (including about Scanline properly).

  5. #5

    Screen Output

    Thank you, i now at least know where to start from!

  6. #6

    Screen Output

    I decided to do this the hard way, basically because I'm a fan of old dos modes So i'm going to use Pascal and some interrupts

    Any idea how i can make this work in Free pascal ?


    Procedure SetMCGA; { This procedure gets you into 320x200x256 mode. }
    BEGIN
    asm
    mov ax,0013h
    int 10h
    end;
    END;

    It doesn't look like it works in FP :/

  7. #7

    Screen Output

    this code will only work on 16-bit applications (only DOS).
    I don't remember if Free Pascal compiles for DOS, or Windows 32bit Console application:?

    I'm shure this stuff must work on Turbo Pascal

  8. #8

    Screen Output

    It works on Turbo Pascal, but I unfortunately can't run 16bit version applications. I work on a 64bit system :/ So i was looking for a way to do the same in Freepascal which compiles for DOS. (and uses 32bit)

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
  •