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.