PDA

View Full Version : Liberty basic "drawbmp" command is acting up


rrr
Jan 3, 2007, 06:48 AM
I use xp home edition and have liberty basic v.4.03
The code goes like folowing:

Loadbmp "bmpname", "bmppath"
Graphicbox #window.graphicbox, 5, 5, 447, 511
Open "window" for dialog_popup as #window
Print #window.graphicbox "drawbmp bmpname 0 0" <-- error in this line
Wait

I have dimesioned the window and trapped the close event but the liberty basic says "no bitmap named bmpname. I have checked the path, and it is correct. What the!! Is going on?

:confused:

LTheobald
Jan 3, 2007, 07:32 AM
Hey RRR,

I've not touched Basic before but I'll give this shot. What kind of path are you putting in the loadbmp line? It should be fully qualified, e.g:


loadbmp "copyimage", "bmp\copy.bmp"
Or

loadbmp "copyimage", "C:\bmp\copy.bmp"

The code you supplied says "bmpath" which won't be valid.

rrr
Jan 3, 2007, 07:36 AM
sorry for that syntax error I mean to type
loadbmp "bmpname", path$
(the $ sign makes it a string variable if you didn't know)
where path$ is "C:\Documents and Settings\username\my documents\bmps\abmpfile.bmp"

rrr
Jan 3, 2007, 07:42 AM
Here is the actual code used. The purpose of this program was to show all th bmpfiles in a directory like a slideshow. Yes, I know, I could have used some other solution, BUT, I need to know what went wrong. :confused:


cinematic$="cinematic 1"
'nomainwin
dim arrayName$(40, 40)
files DefaultDir$+"\"+cinematic$, arrayName$()
times=val(arrayName$(0, 0))
num=times
maxnum=num

[loadmoviebmp]
while times > 0
if right$(arrayName$(times, 0), 3) = "bmp" then
loadbmp DefaultDir$+"\"+cinematic$+"\"+arrayName$(times, 0), DefaultDir$+"\"+cinematic$+"\"+arrayName$(times, 0)
end if
num=num-1
times=times-1
wend
maxnum=num

WindowWidth = 526
WindowHeight = 514
UpperLeftX=int((DisplayWidth-WindowWidth)/2)
UpperLeftY=int((DisplayHeight-WindowHeight)/2)
graphicbox #cin.dis, 5, 5, 511, 477
open "game cinematic" for dialog_popup as #cin
print #cin.dis, "down; fill white; flush"
print #cin, "font ms_sans_serif 10"
print #cin, "trapclose [unloadmovie]"
print #cin.dis, "color black ; place 10 45 ; font arial 40"
print #cin.dis, "\Right-click to "
#cin.dis, "place 10 100"
#cin.dis, "\continue"
#cin.dis, "when leftButtonDown [movieinput]"



num=maxnum
wait


[movieinput]
print str$(num)
if right$(arrayName$(num, 0), 3) = "bmp" and num <> 8 then
print DefaultDir$+"\"+cinematic$+"\" ; arrayName$(times, 0)
print #cin.dis, "drawbmp " ; DefaultDir$+"\"+cinematic$+"\" ; arrayName$(times, 0) ; ".bmp 11 11"
else
num=num+1
end if
wait


[unloadmovie]
num=0
while num > val(arrayName$(0, 0))
if right$(arrayName$(num, 0), 3) = "bmp" then
unloadbmp str$(num)
end if
num=num+1
wend

Carl Gundel
Jan 11, 2007, 02:18 PM
Hi,

The trouble seems to be that you have a space in the pathname. Parsing for the graphics commands delimits by spaces so the drawbmp command is looking for a bitmap named:

C:\Documents

Try making a folder without spaces (perhaps c:\myimages) and put the images in there.

-Carl Gundel, author of Liberty BASIC
Liberty BASIC - Easy Programming for Windows (http://www.libertybasic.com)

rrr
Jan 15, 2007, 04:04 AM
Aha. Thank you *bows and slaps own face*