BBC BASIC for Windows
« Graphics Window For Text Adventure »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 11:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Graphics Window For Text Adventure  (Read 704 times)
Ironman
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 15
xx Graphics Window For Text Adventure
« Thread started on: Jan 8th, 2011, 08:39am »

Hello, can somebody please tell me how to place an image (jpg or whatever) in a window with a text input/output window below for a graphic/text adventure game.
Any help would me much appreciated.
smiley
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: Graphics Window For Text Adventure
« Reply #1 on: Jan 8th, 2011, 11:35am »

on Jan 8th, 2011, 08:39am, Ironman wrote:
Hello, can somebody please tell me how to place an image (jpg or whatever) in a window with a text input/output window below for a graphic/text adventure game.

Here's an example of doing that when the image is a BMP file:

Code:
      WindowWidth% = 640
      WindowHeight% = 512
      CharWidth% = 8
      CharHeight% = 16
      TextRows% = 4
      Image$ = "C:\Windows\Web\Wallpaper\Bliss.bmp"
      
      REM Setup the window:
      VDU 23,22,WindowWidth%;WindowHeight%;CharWidth%,CharHeight%,16,128
      
      REM Create a text viewport at the bottom:
      VDU 28,0,WindowHeight%/CharHeight%-1,WindowWidth%/CharWidth%-1, \
      \   WindowHeight%/CharHeight%-TextRows%
      
      REM Display the image at the top:
      SYS "SetStretchBltMode", @memhdc%, 4
      OSCLI "DISPLAY """ + Image$ + """ 0,"+STR$(TextRows%*CharHeight%*2) + "," + \
      \ STR$(WindowWidth%*2) + "," + STR$(WindowHeight%*2-TextRows%*CharHeight%*2)
      
      REM Output some text:
      PRINT "This is some text" 

If the image is a JPG you'll need to use the code listed in the Help documentation:

http://www.bbcbasic.co.uk/bbcwin/manual/bbcwine.html#gifjpeg

Richard.
User IP Logged

Ironman
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 15
xx Re: Graphics Window For Text Adventure
« Reply #2 on: Jan 8th, 2011, 1:39pm »

Thankyou so much Richard. I've copied the listing you gave me and will be experimenting with it. smiley
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls