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 / Bitmap fonts But....

Author
Message
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 28th Apr 2006 15:18
Hi ,

As a newbie , I could create a rutine which loads one
bitmap file with my font I wish and I want to blit it in seperates
glyph letter and write one string with this bitmap.

But , i don't want to put the image first on the screen , then
I grab from the screen.

I want to load it in one image number (Hidden in memory)
and then I put the small tilled letter for example 16x16 font
in one string.

get image command grabs from screen only.

How to grab from allready loaded image (bitmap from memory and
convert these letters to ascii fonts)?

I thing I am asking something difficult.


For example I have this font.

I have the image attached.

Thank you very much. ( I hope source code will be easy).

Attachments

Login to view attachments
RUCCUS
19
Years of Service
User Offline
Joined: 11th Dec 2004
Location: Canada
Posted: 28th Apr 2006 15:36
You could always paste the image to the screen, grab the image with the get iamge command, and then remove the image from the screen. Nobody would know the difference.

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 28th Apr 2006 15:51
or create another bitmap, paste image onto that, grab each letter using GET IMAGE, which works on 'current' bitmap. Bitmap 0 is the screen but you can have lots of extra bitmaps to play with in the background

Boo!
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2006 15:58
Load Image gives each image a number. So load a bitmap font as images 1 to 26.


Len() can find the length of a string.

Mid$() can find each letter in the string now that you know its length.

Val() can convert each letter into a number.

Then convert each number into the right image.

Texture a plain, or use a sprite for each letter.

BatVink
Moderator
21
Years of Service
User Offline
Joined: 4th Apr 2003
Location: Gods own County, UK
Posted: 28th Apr 2006 16:01
If you can wait until Monday, there will be a tutorial in the newsletter which includes such a routine

Allegedly.



Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 28th Apr 2006 16:10
I have one problem here, I don't know if is this a bug!!


I have this code.






It drops me error and bitmap_file argument does not pass the function.

load bitmap command does not pass the bitmap_file string.
Programm suppose to print bitmap_file sting
int text 0,0,bitmap_file this ("d:\future\dungeon.bmp")

But does not.

Is whis my error or bug?

I used both IDE and default and bluIDE.
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 28th Apr 2006 16:12
You can change "dungeon.bmp" to "future_font2.bmp" in attachment.
Is the same.
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 28th Apr 2006 16:14
And paste image command should loaded the image from
the load image bitmap_file,1

and then paste the image with paste image 1,10,10 which has loaded
before.

Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 28th Apr 2006 16:16
Try the code and tell me if there is a problem to your compilers.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 28th Apr 2006 16:21
That is not real computer code. You need to do what I said.

Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 28th Apr 2006 16:28 Edited at: 28th Apr 2006 16:30
In fact this code does nothing.

it only presents my problem.

This code pass the function from
load_bitmap_font(bitmap_file,x_size,y_size)

and it is call like this

load_bitmap_font("future_font2.bmp",16,16)

but compiler does not pass the arguments

and paste image drops me an error
and text 0,0,bitmap_file it drops error too

because arguments didn't passed through the function.



And string must be written by text 0,0,bitmap_file

When you load the program must see the image on the screen
with the path and directory on top on the screen.
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 28th Apr 2006 16:52
I post it in bug forums....
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 28th Apr 2006 16:54
You cannot mix bitmaps with images - they are completely different

Because you have overridden global variable as parameter of function it will not get put into global variable

Because you have loaded file into Bitmap 1 it becomes the 'default' bitmap, so you need to change 'current' bitmap back to 0 (the screen) with; set current bitmap 0

Boo!
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 2nd May 2006 02:21
How can I load font from a font file? in case I don't have
fonts installed in windows fonts directory?


Is there any trick to install one truetype in someones computer
but , how to locate the default windows directory?


Can you understand what I mean?

In some computers fonts are in c:\windows\fonts


but if someone has windows 98 and directory is:
c:\win98\fonts or
c:\w98\fonts or
c:\windows\fonts or
d:\windows\fonts or

etc...

How can I find windows fonts directory with DarkBASIC and install
my truetype font file there.

Windows does not allow to copy some font in windows\fonts directory
only if you go to font and install fonts manually.

But is little unprofessional to say , go and install these fonts to
your computer to make game work correct.

How do I create some installation programm which install fonts?


I have not manage to create bitmap fonts yet.

Thank you....
Cash Curtis II
19
Years of Service
User Offline
Joined: 8th Apr 2005
Location: Corpus Christi Texas
Posted: 2nd May 2006 05:50
Scraggle was so kind as to provide a multitude of free bitmap fonts, along with code to load them, trim them, and display them.

http://forum.thegamecreators.com/?m=forum_view&t=74431&b=4

Just give him credit.

Windows fonts are extrememly slow in DBP. Just use bitmap fonts. Plus, they look much more professional.


Come see the WIP!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 2nd May 2006 12:25
To use your own TTF fonts, you leave the TTF file in your game folder and use some windows DLL's to temporarily register that font in users windows.

Take a read;

http://forum.thegamecreators.com/?m=forum_view&t=63687&b=1

Boo!
Takis76
19
Years of Service
User Offline
Joined: 9th Apr 2005
Location: Greece
Posted: 2nd May 2006 14:19 Edited at: 2nd May 2006 14:21
Thank you very very much , this help me very much.

I will use the way to register a font.

And I will try to use bitmap fonts later on.

When I have some demo of my game in english version I will post it
in Work In Progress forum , to play and tell me if you like it.

Thank you very much again.

Login to post a reply

Server time is: 2024-09-24 21:38:45
Your offset time is: 2024-09-24 21:38:45