Here's an example of what I was talking about with 2d, 3d, and pasting a sprite. I also included a basic text entry function. I noticed that it did flash only after typing the text and pressing enter when the 2d was directly over the 3d so I shrank the 3d window and that stopped it.
rem text entry over pasted sprite
rem by latch
rem 03/21/2012
set display mode 1024,768,32
sync on
sync rate 40
_main:
gosub _init
rem it flashed a little with the 2d over the 3d, but when I scoot the 3d
rem window over, it doesn't flash at all
set camera view 300,0,screen width(),screen height()
do
text 400,0,"Click in the grey box to enter text"
gosub _name_entry
sync
loop
end
_init:
rem make a matrix
make matrix 1,1000,1000,25,25
rem draw character entry box as a sprite
create bitmap 1,301,screen height()
rem title
ink RGB(255,128,64),0
box 1,1,299,100
ink 0,0
center text 150,50,"Character Selection"
rem name entry box
ink RGB(128,128,128),0
box 1,102,299,202
rem other info box - picture, whatever
ink rgb(255,255,255),0
box 2,205,298,screen height()-3
get image 1,0,0,301,screen height()
sync
rem create sprite, turn off transparency, turn off auto redraw, hide it
sprite 1,0,0,1
set sprite 1,0,0
hide sprite 1
delete bitmap 1
return
`======================================================================
_name_entry:
rem if there is a left mouse click in the grey box, text entry begins
paste sprite 1,0,0
if mouseclick()=1
if mousewithin(1,102,299,202,mousex(),mousey())
x=20
y=135
color=rgb(255,255,255)
sp=1
spimg=1
mystring$=simple_text_entry(x,y,allowescape,color,maxlen,maxchars,sp,spx,spy)
endif
endif
text x,y,mystring$
return
`======================================================================
function simple_text_entry(x,y,allowescape,color,maxlen,maxchars,sp,spx,spy)
rem a basic text enter function by Latch
rem 03/21/2012
rem SYNC should be on
rem entry continues until ENTER is pressed
rem if allow escape is set to 1, then system escape should be previously disabled so
rem ESC can be used to exit the function
rem if sp > 0 then that sprite number will be pasted each cycle
rem clear temporay string
temp$=chr$(0)
c$=chr$(0)
letteradjust=0
if maxchars=0 then maxchars=255
rem loop through keyboard entry
while returnkey()!1
if sp > 0
paste sprite sp,spx,spy
endif
rem a black box to draw in
ink 0,0
box x,y,x+text width(temp$),y+text height("gM")
ink color,0
rem if the escape key is disabled and the programmer has used DISABLE ESCAPEKEY
rem then pressing ESC returns immeditately from the function with an empty string
if allowescape
if keystate(1)
temp$=chr$(0)
exitfunction temp$
endif
endif
rem check for delete and backspace
if keystate(14) or keystate(211)
if len(temp$) = 1
temp$=chr$(0)
else
if len(temp$) > 1
temp$=left$(temp$,len(temp$)-1)
endif
endif
rem control key repeat
repeat
c$=right$(temp$,len(temp$)-letteradjust)
text x,y,c$
sync
until scancode()=0
else
rem some other key was pressed - only check standard asci - this can easily
rem be changed
b$=a$
a$=inkey$()
if a$ ! b$
if asc(a$) > 31 and asc(a$) < 127
if len(temp$) < maxchars
temp$=temp$+a$
endif
endif
endif
endif
rem draw text - control display
if text width(temp$) > maxlen and (maxlen > 0)
diff = text width(temp$) - maxlen
letteradjust=(diff/text width("Q"))+1
c$=right$(temp$,len(temp$)-letteradjust)
text x,y,c$
else
text x,y,temp$
letteradjust=0
endif
sync
endwhile
endfunction temp$
function mousewithin(x1,y1,x2,y2,mx,my)
if mx > x1 and mx < x2
if my > y1 and my < y2
exitfunction 1
endif
endif
endfunction 0
What it comes down to ultimately, is that there is no advantage to using sprites over images except if you want to keep something on the screen behind a sprite (because nothing draws over a sprite except another sprite) or if you want to use the simple built in sprite collision. In DBC, sprites take a lot of processing power and like you see, you can't easily draw over them.
Enjoy your day.