1. Printing to screen in video mode

I'm using video mode 18 and trying to 
print a string to the screen after I 
print a bitmap.
The bitmap looks fine, but the string 
won't print at all.  Can I not do this
in a pixel-graphics mode?
Any other comments would be much appreciated.
Thank You, Josh

#! Special first line comment.
-- My first attempt at a Euphoria program.
-- Program will open and display a bitmap file.

constant FILENAME = "C:\\EUPHORIA\\PROGRAMS\\test.bmp"

integer myMode, screen_no
myMode=18
sequence vc

include graphics.e
include get.e
vc = video_config()

screen_no = open("CON","w")
if vc[VC_MODE] != myMode then

  if graphics_mode( myMode ) then
    puts(screen_no,"graphics mode not switched\n")
    abort(0)
  end if
    
end if

clear_screen()

include image.e
object x
sequence s
x = read_bitmap(FILENAME)
if atom(x) then
  s = prompt_string("Bad bitmap. Enter string to
continue:\n")
  abort(0)
end if

s = prompt_string("Bitmap read. Enter string to
continue:\n")

all_palette(x[1])

display_image({10,10},x[2])

-- printf and prompt_string both don't print anything to
the screen
position(10,10)
printf(screen_no,"Bitmap on screen. Enter string to
continue:\n",{})
s = prompt_string("Bitmap read. Enter string to
continue:\n")

integer done
done = graphics_mode(-1)
-- program finished

new topic     » topic index » view message » categorize

2. Re: Printing to screen in video mode

You need to use one of the pixel graphics libraries
available.. the one that sticks out in my mind
is font.e by Jiri Babor (*Super Fantastic library) 

try the RDS contrib archive and do a search for "font"
look for one that will work in Pixel graphics mode.

Euman

----- Original Message ----- 
From: <mrbiglesworth3 at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, June 07, 2001 17:12
Subject: Printing to screen in video mode


> 
> 
> I'm using video mode 18 and trying to 
> print a string to the screen after I 
> print a bitmap.
> The bitmap looks fine, but the string 
> won't print at all.  Can I not do this
> in a pixel-graphics mode?
> Any other comments would be much appreciated.
> Thank You, Josh
> 
> #! Special first line comment.
> -- My first attempt at a Euphoria program.
> -- Program will open and display a bitmap file.
> 
> constant FILENAME = "C:\\EUPHORIA\\PROGRAMS\\test.bmp"
> 
> integer myMode, screen_no
> myMode=18
> sequence vc
> 
> include graphics.e
> include get.e
> vc = video_config()
> 
> screen_no = open("CON","w")
> if vc[VC_MODE] != myMode then
> 
>   if graphics_mode( myMode ) then
>     puts(screen_no,"graphics mode not switched\n")
>     abort(0)
>   end if
>     
> end if
> 
> clear_screen()
> 
> include image.e
> object x
> sequence s
> x = read_bitmap(FILENAME)
> if atom(x) then
>   s = prompt_string("Bad bitmap. Enter string to
> continue:\n")
>   abort(0)
> end if
> 
> s = prompt_string("Bitmap read. Enter string to
> continue:\n")
> 
> all_palette(x[1])
> 
> display_image({10,10},x[2])
> 
> -- printf and prompt_string both don't print anything to
> the screen
> position(10,10)
> printf(screen_no,"Bitmap on screen. Enter string to
> continue:\n",{})
> s = prompt_string("Bitmap read. Enter string to
> continue:\n")
<snip>

> 
> 
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: Printing to screen in video mode

Josh,

This is from an old test I did, once I faced a problem much like yours. Not
a bitmap, but give it a try. It's tested.

-- begin program

include c:\prog\euphoria\include\graphics.e

atom t0
integer gmode
sequence bpal

bpal = {{5,5,15}, {5,10,15}, {5,15,20}, {5,20,25}, {5,25,30}, {5,30,35},
    {5,35,40}, {5,40,45}, {5,45,50}, {5,50,55}, {5,55,60}, {5,60,60},
    {60,60,60}, {5,60,60}, {5,55,60}, {5,50,55}}
gmode = graphics_mode(18) -- sets 640x480x16
all_palette(bpal)  -- sets blues palette
  -- draws blue rays
for f = 1 to 16 do
    polygon(f, 1, {{100, 1}, {f*100, 1}, {f*100, 400}, {f*40, 400}})
end for
position(25,20)
puts(1," This is a text mode string ")
  -- delays 2 seconds
t0 = time()
while 1 do
    if time() > t0 + 2 then exit
    end if
end while
-- end program


----- Original Message -----
From: <mrbiglesworth3 at yahoo.com>
To: "EUforum" <EUforum at topica.com>
Sent: Thursday, June 07, 2001 7:12 PM
Subject: Printing to screen in video mode


> I'm using video mode 18 and trying to
> print a string to the screen after I
> print a bitmap.
> The bitmap looks fine, but the string
> won't print at all.  Can I not do this
> in a pixel-graphics mode?
> Any other comments would be much appreciated.
> Thank You, Josh
>
> #! Special first line comment.
> -- My first attempt at a Euphoria program.
> -- Program will open and display a bitmap file.
>
> constant FILENAME = "C:\\EUPHORIA\\PROGRAMS\\test.bmp"
>
> integer myMode, screen_no
> myMode=18
> sequence vc
>
> include graphics.e
> include get.e
> vc = video_config()
>
> screen_no = open("CON","w")
> if vc[VC_MODE] != myMode then
>
>   if graphics_mode( myMode ) then
>     puts(screen_no,"graphics mode not switched\n")
>     abort(0)
>   end if
>
> end if
>
> clear_screen()
>
> include image.e
> object x
> sequence s
> x = read_bitmap(FILENAME)
> if atom(x) then
>   s = prompt_string("Bad bitmap. Enter string to
> continue:\n")
>   abort(0)
> end if
>
> s = prompt_string("Bitmap read. Enter string to
> continue:\n")
>
> all_palette(x[1])
>
> display_image({10,10},x[2])
>
> -- printf and prompt_string both don't print anything to
> the screen
> position(10,10)
> printf(screen_no,"Bitmap on screen. Enter string to
> continue:\n",{})
> s = prompt_string("Bitmap read. Enter string to
> continue:\n")
>
<snip>

new topic     » goto parent     » topic index » view message » categorize

4. Re: Printing to screen in video mode

mrbiglesworth3 at yahoo.com wrote:
> ...
> I'm using video mode 18 and trying to
> print a string to the screen after I
> print a bitmap.
> The bitmap looks fine, but the string
> won't print at all.  Can I not do this
> in a pixel-graphics mode?
> Any other comments would be much appreciated.
> Thank You, Josh
> 

Hi Josh,
in graphics mode you may use puts() and printf() as is text mode.
However, the position of the text elements are bounded into the 'normal'
text raster: for mode 18 you have 30 (or 60) rows and 80 columns.
If you want to place your text at an arbitrary pixel positron, the
easiest I know of is Jiri's 'rfont.e' from the archive, which offers the
two VGA ROM fonts (256 characters) in 16x8 and 8x8 pixels.
Have a nice day, Rolf

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu