Notices
Results 1 to 11 of 11

Thread: Pascal and graphics

  1. #1 Pascal and graphics 
    Forum Freshman Violaris's Avatar
    Join Date
    Mar 2007
    Posts
    29
    Hey guys,
    Does anyone have a clue if there is any other way of implementing graphics in pascal other than using an OpenGL platform? That is, can you output graphics only with code?
    I am asking this because of a project I have for college. The prof. wants us to make a game, but he never taught anything for OpenGL or any other graphics platform.
    Thanks.


    Epsilon Web Design!

    Host your sites, NOW!
    Reply With Quote  
     

  2.  
     

  3. #2  
    Guest
    In all my years of programming computers in various languages I never once wrote any games in my professional career, sorry mate, I for one cannot help you, but if you want to move a giant radio telescope around and munch it's data...


    Reply With Quote  
     

  4. #3  
    Forum Professor leohopkins's Avatar
    Join Date
    Dec 2006
    Location
    Dulwich, London, England
    Posts
    1,417
    Do you HAVE to use pascal to make your game, or can you use which ever language you want ?

    What type of game do you want to create ?

    The reason I ask this is because if you ARE limited to pascal and he has taught you nothing of OpenGL, then maybe you could create one of the old text-based games.

    If you are not limited to pascal then you should use C++ or, for a quick and easy option you could use DarkBASIC.
    The hand of time rested on the half-hour mark, and all along that old front line of the English there came a whistling and a crying. The men of the first wave climbed up the parapets, in tumult, darkness, and the presence of death, and having done with all pleasant things, advanced across No Man's Land to begin the Battle of the Somme. - Poet John Masefield.

    www.leohopkins.com
    Reply With Quote  
     

  5. #4  
    Forum Freshman Violaris's Avatar
    Join Date
    Mar 2007
    Posts
    29
    Sadly, yes, I am limited to Pascal. I'm in first year CS, and this course is called 'introduction to Computer Programming - A Pascal Approach'. I am fluent in pascal as I taught myself while I was in high school, and I also know VB and Scheme, but I have no clue how to make graphics in pascal without OpenGL.

    Sadly once again, the professor is one of those guys that like to play smart. For example I asked him how can I output graphics for my game (he assigned that we do snakes and ladders in pascal) and his response was ''Well, that's the hard part mate'', and walked off. I am starting to think that not all people with a Doctorate should have one....

    Anyway, thanks for your input, I''l just do it with text, as odd as it sounds playing 'Snakes and ladders' using text...
    Epsilon Web Design!

    Host your sites, NOW!
    Reply With Quote  
     

  6. #5  
    Guest
    So far as I remember there is no specific graphics in Pascal, I do not recall it ever being mentioned in K&R - you know the 'bible' - so it will be language specific, I have written some graphics for Pascal but I had to construct units based on the sytem I was using, - Turbo Pascal 7 was the package. - Which one are you using?
    Reply With Quote  
     

  7. #6  
    Forum Freshman Violaris's Avatar
    Join Date
    Mar 2007
    Posts
    29
    I am using Free IDE Pascal.
    Epsilon Web Design!

    Host your sites, NOW!
    Reply With Quote  
     

  8. #7  
    Forum Professor leohopkins's Avatar
    Join Date
    Dec 2006
    Location
    Dulwich, London, England
    Posts
    1,417
    Quote Originally Posted by Violaris
    Sadly, yes, I am limited to Pascal. I'm in first year CS, and this course is called 'introduction to Computer Programming - A Pascal Approach'. I am fluent in pascal as I taught myself while I was in high school, and I also know VB and Scheme, but I have no clue how to make graphics in pascal without OpenGL.

    Sadly once again, the professor is one of those guys that like to play smart. For example I asked him how can I output graphics for my game (he assigned that we do snakes and ladders in pascal) and his response was ''Well, that's the hard part mate'', and walked off. I am starting to think that not all people with a Doctorate should have one....

    Anyway, thanks for your input, I''l just do it with text, as odd as it sounds playing 'Snakes and ladders' using text...
    Snakes and ladders ??

    Okay, so how about this, simply draw the board using painbrush and get pascal to load it up; once its on screen all you will need to do is add a couple of different coloured sprites (or even different colour asteriks) which just jump from square to square; animating them, in my opinion isnt necessary. And of course there is the "random" number generation for the dice.
    The hand of time rested on the half-hour mark, and all along that old front line of the English there came a whistling and a crying. The men of the first wave climbed up the parapets, in tumult, darkness, and the presence of death, and having done with all pleasant things, advanced across No Man's Land to begin the Battle of the Somme. - Poet John Masefield.

    www.leohopkins.com
    Reply With Quote  
     

  9. #8  
    Forum Freshman Violaris's Avatar
    Join Date
    Mar 2007
    Posts
    29
    How do I load a .bmp inside a pascal program?
    Epsilon Web Design!

    Host your sites, NOW!
    Reply With Quote  
     

  10. #9  
    Forum Professor leohopkins's Avatar
    Join Date
    Dec 2006
    Location
    Dulwich, London, England
    Posts
    1,417
    To be honest, I don't know. I only know C++ and BASIC, but I have found this which MAY be of use to you........(The source is Swinbrain)

    http://mercury.it.swin.edu.au/swinbr...und,_and_Input
    The hand of time rested on the half-hour mark, and all along that old front line of the English there came a whistling and a crying. The men of the first wave climbed up the parapets, in tumult, darkness, and the presence of death, and having done with all pleasant things, advanced across No Man's Land to begin the Battle of the Somme. - Poet John Masefield.

    www.leohopkins.com
    Reply With Quote  
     

  11. #10  
    Guest
    Does your version of pascal allow you to write units? - does it allow inline assembler? - do you have access to a list of DOS BIOS graphics routines?

    If yes to all three then you need to write a pascal low level function like the one I did many years ago to set the screen into 640x480 then set/reset any pixel, I made other routines for lines, boxes, circles etc but here's the 'guts' of a turbo pascal 7 unit.

    {Graphics routines - IBM PC & compatible}
    unit GRAPHICS;


    interface

    Procedure G640_480;
    Procedure set_pixel(var x,y:integer;var pcolor:byte);


    implementation


    uses dos;

    procedure G640_480;assembler;
    asm
    MOV AX,12h
    INT 10h
    end;

    Procedure set_pixel;assembler;
    asm { SET_PIXEL }
    LES SI,Y
    MOV AX,WORD PTR [ES:SI]
    MOV DX,80
    MUL DX
    LES SI,X
    MOV BX,WORD PTR [ES:SI]
    MOV CL,BL
    SHR BX,1
    SHR BX,1
    SHR BX,1
    ADD BX,AX
    AND CL,7
    XOR CL,7
    MOV AH,1
    SHL AH,CL
    MOV DX,03CEH
    MOV AL,8
    OUT DX,AX
    MOV AX,205H
    OUT DX,AX
    MOV AX,0A000H
    MOV ES,AX
    MOV AL,ES:[BX]
    PUSH ES
    LES SI,PCOLOR
    MOV AL,BYTE PTR [ES:SI]
    POP ES
    MOV ES:[BX],AL
    MOV AX,0FF08H
    OUT DX,AX
    MOV AX,5
    OUT DX,AX
    end; { SET_PIXEL }
    Reply With Quote  
     

  12. #11  
    Forum Freshman Violaris's Avatar
    Join Date
    Mar 2007
    Posts
    29
    Thanks a lot guys, you've been very helpful.
    Even though, I foresee loooong ass programming nights ahead of me
    Thanks a lot once again!
    Epsilon Web Design!

    Host your sites, NOW!
    Reply With Quote  
     

Bookmarks
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
  •