GEuser's CGUI LIB: dotMatrix Font Creator

How to find or create sprites, graphics, sounds and music.

GEuser's CGUI LIB: dotMatrix Font Creator

Postby GEuser » Wed Apr 02, 2014 2:21 am

THIS TOPIC IS RELATED TO THE FOLLOWING THREAD LINK: GEuser's CGUI Lib: dotMatrix() - dotMatrix Canvas Fonts viewtopic.php?f=8&t=13263

SCREENSHOT

Image

Image

DOWNLOADS Game Editor version 1.4.0

1. Linux
dMFC_Lin.zip
(854.86 KiB) Downloaded 191 times

2. Mac
dMFC_Mac.zip
(1.14 MiB) Downloaded 178 times

3. Windows
dMFC_Win.zip
(895.49 KiB) Downloaded 678 times


BASIC INFORMATION

Allows you to create your own dotMatrix fonts, can save the fonts to text file and auto-generates the global code to use in your own projects. Whether you want to create alien scripts, maths / scientific symbols for educational apps, space invader icons for simple games (with each character representing an animation frame) or border dingbats for general use, you can do them with this font creator. Your imagination is the only limit.

Image

CODE USE
1. Create a CANVAS ACTOR
2. Access game editor's script editor.
3. Copy/Paste following Global Code from below into script editor. Add it as: getCharCode.

Code: Select all
int getCharCode(char C)
{
    // usage: int i = getCharCode('A');
    int result=0;
    sscanf("%d", &C);
    result=C;
    return result;
}


3. Import the global code generated by this font creator (You will find it in the same folder as the font creator - where ever you unzipped it). Add this imported code as whatever its says in the global code (1st line, after the void bit).
4. you can now repeat step 3. for each font you create.

CALL your custom function from your CANVAS ACTOR EVENTS (usually Create Actor or Draw Actor) like this:

Code: Select all
yourcustomfunction(0, "My text goes here.", 1, "FFFFFF0000000000", 10, 10, 1, 1, 0, 0);


NOTES

HELP GUIDE
As well as clicking on the HELP GUIDE tab, you can also hover over the buttons to see what they do (tool-tip message appears on top side).

FILE EXAMPLES
Don't include the extensions for the FONT FILE and CODE FILE filenames.

FONT FILE: myFontData will be saved as myFontData.txt automatically.

and likewise:-

CODE FILE: myFontCode will be saved as myFontCode.c (with the function named in code as void myFontCode(...)...etc., ready for you to import and add into Game Editor global code as: myFontCode. So, just substitute for whatever you named them as shown.

EXAMPLE FONTS
To load in the example fonts in screenshots (alienscript1, supersub, borders) simply type in as named and click LOAD FONT button. The .txt files have been included in the .zip files.

FEEDBACK
If you like, feel free to provide screenshots for any cool looking fonts you design.
Last edited by GEuser on Tue May 06, 2014 4:05 am, edited 1 time in total.
GEuser
 
Posts: 204
Joined: Thu Jan 05, 2012 3:08 pm
Score: 19 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby tvz » Wed Apr 02, 2014 5:33 pm

AWESOME!!! :!: :D
+ sin^2 (0)+cos^2 (0) for u
I have not left.
User avatar
tvz
 
Posts: 98
Joined: Sun Mar 10, 2013 7:13 am
Location: Your PC screen
Score: 3 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby lcl » Thu Apr 03, 2014 12:45 pm

I tested it quickly, and here's some of my reactions..

I chose the comma character and replaced it with a smiley.
I saw the program showing me different versions of it right on the left side of where I was drawing the character and seeing my
smiley be drawn there in different sizes and styles made me laugh. It was fun because the program is very easy to learn and I immediately knew what I was doing with it.
And you even added "Help Guide" for the people who don't understand everything just by reading the tool tips.
Very well done designing-wise! I have never seen such and incredibly well-designed little program in my life! +1 to you for that!

Then I exported my edited font as the global code version and went to open it.
My first reaction:
lcl's mouth actually said, even though the GE forum wants to say wrote:
HOLY SMITH!

The way you've programmed it to give one a fully operable function for each font ready for just being copy-pasted to GE is mind blowing!
Awesome job and I'll DEFINITELY use this in some of my future game projects. Just because this is so cool ( 8) ) that I want everybody to know about this!

Only one little thing that I would hope you to do is to explain what all the arguments in the function are and what they do.
I was able to figure them out pretty quickly, but not everyone is capable of understanding what your code does.
(EDIT: Just noticed that the dotMatrix fonts' own topic has good explanations about the function arguments viewtopic.php?f=8&t=13263 :) )

Also what about using simple r, g and b values for color setting? I mean, that would of course mean more arguments for the function, but
that would be a lot more easier to use. I, for example, don't know enough about hexadecimal color codes to be able to use the current color selection to input any color I'd want to.

But still, great job and I'll definitely play with this more when I have some more time!
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby GEuser » Thu Apr 03, 2014 1:32 pm

Thanks for the postive feedback guys.

Oh and thanks icl for linking up with my other dotMatrix() forum topic that produces the fonts (I forget to add the link-up for function explanation).

Problem with the RGB thing is that I'll need to add 8 more arguments (RGBA=ON RBGA=OFF) to handle the colors. I'll have to add something to make color selection easier in the next update .

Hey, icl, you could help by including a short hexadecimal lesson in your tutorials. It's really useful for handling colors in gE and a good thing for newbies to grasp.
GEuser
 
Posts: 204
Joined: Thu Jan 05, 2012 3:08 pm
Score: 19 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby lcl » Thu Apr 03, 2014 3:16 pm

GEuser wrote:Problem with the RGB thing is that I'll need to add 8 more arguments (RGBA=ON RBGA=OFF) to handle the colors. I'll have to add something to make color selection easier in the next update.

You could, for example have two more functions in the same code as the getCharCode(), one for setting the background color and one for setting the text color. The functions would change values to some globally defined arrays, and the custom functions would either use the hexadecimal colors or the colors set by the two functions. You could use "(none)" in the hexadecimal color to tell the function to use the colors from the global arrays instead of the hexadecimal. Then all one would have to do would be to call the functions like this:
Code: Select all
setBackgroundColor(red, green, blue, alpha);
setTextColor(red, green, blue, alpha);
customfunction(here all the arguments, and the hexadecimal argument as "(none)");


GEuser wrote:Hey, icl, you could help by including a short hexadecimal lesson in your tutorials. It's really useful for handling colors in gE and a good thing for newbies to grasp.

I could do that or just make a separate tutorial about them, but I'll first have to learn them myself :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby GEuser » Mon Apr 07, 2014 3:00 am

Sorry for the short instructions. Here's a quick fix for using rgba (a=alpha) colors using: dmColors() function. That's short for dot matrix colors).

DESCRIPTION

dmColors() - A function that converts rgba settings to a 16 character hex string for Font ink & Font background colors.

Format:-
dmColors(retColors, rInk, gInk, bInk, aInk, rBack, gBack, bBack, aBack)

retColors = The character string to hold hex conversion once dmColors() has been called.

rInk, gInk, bInk, aInk = rgba settings for the Font Ink/Foreground color

rBack, gBack, bBack, aBack = rgba settings for the Font Background color

CODE USE
1. Access your script editor.

2. Add the GLOBAL CODE below as dmColors (or append to existing global code).

3. In your Canvas actors DRAW or CREATE event (or whatever) enter the EVENT CODE below. Use your dotMatrix() or whatever custom name you gave your font function as normal.

EVENT CODE
Code: Select all
// Goes in your canvas actor events
char myColors[18];
dmColors(myColors,255,255,255,0.0,0,0,0,0.0);

dotMatrix(0,"your text here", myColors, 0,0,1,1,0,0);



GLOBAL CODE - dmColors
Code: Select all
//Add or append as global code.
void dmColors(char retColors[18], int rInk, int gInk, int bInk, double aInk, int rBack, int gBack, int bBack, double aBack)
{
    unsigned int AlfInk=0; unsigned int AlfBack=0;
 
    if(rInk>255)
    {
        rInk=255;
    }
 
    if(rInk<0)
    {
        rInk=0;
    }

    if(gInk>255)
    {
        gInk=255;
    }
 
    if(gInk<0)
    {
        gInk=0;
    }
 
 
    if(bInk>255)
    {
        bInk=255;
    }
 
    if(bInk<0)
    {
        bInk=0;
    }
 

    if(aInk>1.0)
    {
        aInk=1.0;
    }
 
    if(aInk<0.0)
    {
        aInk=0.0;
    }

    if(rBack>255)
    {
        rBack=255;
    }
 
    if(rBack<0)
    {
        rBack=0;
    }

    if(gBack>255)
    {
        gBack=255;
    }
 
    if(gBack<0)
    {
        gBack=0;
    }
 
 
    if(bBack>255)
    {
        bBack=255;
    }
 
    if(bBack<0)
    {
        bBack=0;
    }
 

    if(aBack>1.0)
    {
        aBack=1.0;
    }
 
    if(aBack<0.0)
    {
        aBack=0.0;
    }

    AlfInk=(int) ceil(255*aInk);
    AlfBack=(int) ceil(255*aBack);

    // %02X means always display 2 characters with leading 0
 
    sprintf(retColors,"%02X%02X%02X%02X%02X%02X%02X%02X", rInk,gInk,bInk,AlfInk,rBack,gBack,bBack,AlfBack);

}


TIPS

You can use variables in the dotMatrix() and dmColors() function calls for ease of entry although your more than likely to enter values directly into the functions once you become comfortable with the formats.

Example Code:-
Code: Select all
// Goes in your canvas actor events
int myInkRed=255;
int myInkGreen=55;
int myInkBlue=155;
int myInkAlpha=0.5;

int myBackRed=0;
int myBackGreen=0;
int myBacBlue=0;
int myBacAlpha=0.0;

int myKerning=1;

int myXpos=10;
int myYpos=10;

int myWide=1;
int myHigh=1;

int myXgap=0;
int myYgap=0;

char myColors[18];
char myText[255]="This is my text message!";

dmColors(myColors, myInkRed, myInkGreen, myInkBlue, myInkAlpha, myBackRed, myBackGreen, myBackBlue, myBackAlpha);

dotMatrix(myKerning, myText, myColors, myXpos, myYpos, myWide, myHigh, myXgap, myYgap);


Hope this makes it a little easier to set the colors for those not yet comfortable with using hexadecimal color definitions.

@ lcl

Here's a quick something about hexadecimals. Click on the bits to explore how hex numbers relate to bytes, bits and decimals.

SCREENSHOT:
Image

DOWNLOAD (.ged file zip)
HexTutorial.zip
(52.91 KiB) Downloaded 188 times
GEuser
 
Posts: 204
Joined: Thu Jan 05, 2012 3:08 pm
Score: 19 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby lcl » Tue Apr 08, 2014 11:52 am

Good, dmColors is a great addition to this making it easier for everyone to use dotMatrix fonts. Great job!
GEuser wrote:@ lcl
Here's a quick something about hexadecimals. Click on the bits to explore how hex numbers relate to bytes, bits and decimals.

Thank you! This little program here made it easier for me to understand hexadecimals and I now know how to use them in Game Editor, too, thanks to you! +1
I'll make sure to cover hexadecimals on some of my tutorials, as well. If it's ok to you, I could put a link to this little hexadecimal program to the tutorial.
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby GEuser » Tue Apr 08, 2014 11:25 pm

lcl wrote:...If it's ok to you, I could put a link to this little hexadecimal program to the tutorial...

Feel free. If you want edit the .ged file and make it more pretty to put in your own tutorials.
GEuser
 
Posts: 204
Joined: Thu Jan 05, 2012 3:08 pm
Score: 19 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby Jagmaster » Wed Apr 09, 2014 3:06 am

First of all:

Image

Second of all, This is freaken cool man. Good job +1

You sure do have a knack for explaining things well.
User avatar
Jagmaster
 
Posts: 875
Joined: Sun May 08, 2011 4:14 pm
Location: Not where you think.
Score: 82 Give a positive score

Re: GEuser's CGUI LIB: dotMatrix Font Creator

Postby GEuser » Tue May 06, 2014 4:10 am

Jagmaster wrote:First of all:

Second of all, This is freaken cool man. Good job +1

You sure do have a knack for explaining things well.


A belated thanks for the welcome. Just about when I got back into gE RL got me out again, hehe. Got to love the minions. Watched the 2nd film only last week.
GEuser
 
Posts: 204
Joined: Thu Jan 05, 2012 3:08 pm
Score: 19 Give a positive score


Return to Game Resources

Who is online

Users browsing this forum: No registered users and 1 guest

cron