Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Please help, paste bitmap fonts

Author
Message
Ant
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 20th Feb 2006 13:36
Hi I am trying to use Darkforge`s excellent scroller code to paste bitmaps onto the text I want displayed on screen.
I have a very very basic understanding of arrays, and this code is starting to confuse me, I can display the magnified bitmap font, but its not corresponding with the text stored in my data sequence.
I don\'t know if anyone could help me

(i) make the code display the proper text
(ii) maybe explain to me what the hell is going on
(iii) simplify the variables to allow me to see what is going on
more clearly

I have tried in vein, but am getting nowhere fast, I do hope someone can help, thanks.

Ant

[/code]

hide mouse
sync on
sync rate 85

bc=1000

dim x#(bc)
dim t$(bc)


load bitmap \"knight6.bmp\",1
ox=32 : oy=25 :os=2 : s=6

x=0 : y=0 : bw#=ox*os

for i=1 to 60

get image i,x,y,x+ox,y+oy
inc x,ox

if x>=319

x=0
inc y,oy
endif

sync

next i

i=1

create bitmap 2,640,480

if os>1

for z=61 to 120

create bitmap 1,ox*os,oy*os
paste image i,0,0
set current bitmap 2
copy bitmap 1,0,0,ox,oy,2,0,0,ox*os+os,oy*os
get image z,0,0,ox*os+os,oy*os
inc i

next z

endif

set current bitmap 0
delete bitmap 2

bc=640/bw#+1

for a=1 to bc

st$=st$+\" \"

next a

read s$
st$=st$+s$
lot=len(st$)+1

if lot<12 then st$=st$+\" \"

for a=1 to bc

x#(a)=bw#*a
`t$(a)=mid$(st$,a)
ast=asc(t$(a))
sprite a,x#(a),0,29+ast
set sprite a,0,1

next a

`y=(480-oy*os)/2 : t=bc

do

cls 0
for a=1 to bc

x#=x#(a)
`inc x#,s

`if x#=<-0-bw#
`x#(a)=640
inc t

if t=lot
t=1
read st$
if st$=\"*\"
restore
read st$
endif
`lot=len(st$)+1
endif
x#(a)=0
t$(a)=mid$(st$,t)
`else
`x#(a)=x#
`endif

ast=asc(t$(a))
sprite a,xpos,ypos,29+ast
inc xpos,1

if xpos>640
xpos=0
inc ypos,bw#
endif

next a

sync
wait 100
loop

data \"WELCOME TO THE NEW DEMO, \"
data \"BROUGHT TO YOU BY \"
data \"*\"

[code]
Ant
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 20th Feb 2006 13:43
Ant
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 20th Feb 2006 13:48
Just thought I originally tried to adjust the code, so that it used the text command to display the relevant bitmap fonts, is this possible?
or do you have to use sprites?
if it is possible to use the text command, could anyone give me an example of this also.

Thanks
Ant
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 20th Feb 2006 21:59
A basic example of what I want, but with bitmap fonts!

Ant
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 23rd Feb 2006 23:00
Hi

I have managed to figure out some of the code, but to be honest I'm still confused, the text printed out on screen is the second line in my data sequence, I cant seem to figure out how to display the text properly, as I really dont understand how all of the commands work, and how the computer interprets them.
I do hope someone will be able to help !!!

Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 24th Feb 2006 11:22
Quote: "`if I change a=1 to 1 then it prints out 1st line of data
`sequence, why?
"


If you change it to a one it'll only read the first "data" statement.

Quote: "`Have tried to play around with screen width commands and text
`width commands to display text on screen properly, but
`I dont know how to move a word if its too long for the screen
`width, which results in broken words! Any ideas ???????
"


You just have to separate the text on a per word basis and check if the current position + word length will go over the screen size. If it does go to the next line to print the next word.

You really should use "paste image" instead of sprites.


Ant
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 26th Feb 2006 11:47
Hi grog

Thanks for the advice, I have attached my new code using PASTE IMAGE instead of sprites. I have not been able to work out the code to store the words in the array properly, as when I call PRINT t$(1)
nothing happens.

Also can't seem to get the output displayed properly on screen, as discussed before, I have tried, but the code is breaking it down into single letters which is what I want, but I can't figure out how to calculate when it should move to a new line.

The problem is, I am still a Newbie !!!!

Attachments

Login to view attachments
Ant
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 26th Feb 2006 16:25
Another question if I may

I have attached another piece of code here that I am also having trouble with. I want it to output text on screen with a cursor, but if I use paste or sprite to display the box as the cursor, it doesn't display it the way I want it to.

I would appreciate some help on this

Ant
19
Years of Service
User Offline
Joined: 27th Nov 2004
Location:
Posted: 26th Feb 2006 17:07
Please forgive my last post, I have found out the answer to that problem
Quote: "
set sprite 1, 1, 0
"

but if anyone else can shed any light on my paste bitmap font question I`d be really grateful.

Thanks.
Grog Grueslayer
Valued Member
19
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 26th Feb 2006 22:25
Here's an example of what I mean (not using bitmap fonts but it's the same concept). It should be real easy for you to figure it out for your code. The only difference is you just use a little math to get the text size to see if it's going to go over the screen size.

This has a "wait key" everytime a word is placed in the Text Box... I did that to show you when each word is actually placed on the screen.




Login to post a reply

Server time is: 2024-09-24 17:38:11
Your offset time is: 2024-09-24 17:38:11