Magic Library - True Type windows font

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

ok , i got it.

thank you esaptonor for post the image test.

bey
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

Hi esaptonor

here is a screenshots oh HDR with your image and i saved it as jpg for good quality.
Image

the image demonstrat the steps of making the hdr effect.
esaptonor
Posts: 145
Joined: Sat May 06, 2006 11:59 pm

Post by esaptonor »

looks great emil, but i notice there is not much (if any) outer glow. Does that mean you are running this code on individual objects? or somehow without much glow on a post process filter?
If its on individual objects, is the performance drop significant when you have 20+ objects on the screen?
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

there is no much outer glow becuase i reduce it in the combin shader program,if you take a closer look into the code ,in previous page, you will see the next line

Code: Select all

cgCombin->AddToPixelProgram("   color  =  (Col1+Col2) * 0.70 ;                     ");
i multiplied the final color by 0.7 to reduce the glow.

here is a screenshot but with value 0.95
Image

my example was appling for on individual object, but you could easlly do that effect for entire scene , by appling this effect on the final image of drawing scene ,ie afetr smgr->drawAll() function.

i will make an other exaple and post a screenshot for entire scene
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

Hi esaptonor

here is ascreenshot of HDR for entire Scene

the upper Image is the original One and the other is HDR.

Image

as you see the appling Hdr for final render does not drop the FPS much more and the performance does not chenged.

Bey
esaptonor
Posts: 145
Joined: Sat May 06, 2006 11:59 pm

Post by esaptonor »

ok, thats good.
And I do like the effect you have got, makes me want to go back to my HDR and play around :D
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

Hi Everybody

oh , every time i sow any demo for Amiga i want to convert it for work with my MagicLibrary
Amiga was and will be forever the best computer that i had , it remember me the old good days.

this time i have found an amiga demo that was written in FreeBasic language by SHOCKWAVE.
i converted and added new graphics and music for it , so here is the screen shot of the new demo
Image

here is the link of freeBasic demo
http://www.freebasic.net/forum/viewtopic.php?t=5707

next updating of Magic Library will have this demo.

thanks.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

Hi EveryBody

here is the update ver 1.2 of Magic Library for Irrlicht 1.1 , has 99 examples now.

it is 23.4 MB size, i have included the compiled files of all examples , i will divide it into smaller parts , such as compiled.Zip , media.zip and Includes_libs.zip part for more easlly downloading.

i have updated my site , so do not forget to visit it,and download the new Lib from Download page.

also i have converted another demo from BlitzMax , here is the screenshot of it.
Image
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

99 examples!

*faints*

and thats just the example code, i wonder how big magic lib would be when its finished.

good luck.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

hey Omer it is just the beginning , Magic library has no end like mister X , so it will grow and grow ............... :D

i am just kidding , i intend to improve some already_existed features of Magic library and ofcource make and convert new demos.

ok , thenks for wishing good luck for me.

BTW i have put some tips of making entir sceen fading In & out with sound fading also in my web site under Tips & Trics page.

Bey.
omaremad
Competition winner
Posts: 1027
Joined: Fri Jul 15, 2005 11:30 pm
Location: Cairo,Egypt

Post by omaremad »

Mister X lol that made me laugh for a long time :lol:
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

Hi everybody

this time i have improved TileMap stuff, (TImageStrip class).

this class allows you to build a TileMap the scroll it in full screen or part of screen see the screenshot below , here is the prototype of the class

Code: Select all

class DLL_EXPORT TImageStrip
 {
           f32                 Coords[4][2];
           f32                 fWidth,fHeight;
           s32                 TotalFrm;
           s32                 stepww,stephh;
           f32                 sx,sy;
           s32*                Map;
           s32                 xRepeat,yRepeat;
           s32                 MapCellWidth,MapCellHeight;
           s32                 ScrnX,ScrnY;
           s32                 MaxX,MinX,MaxY,MinY;
           TImageTexture*      Matr;

      public:
           TImageStrip();
           ~TImageStrip(){};
           void LoadImageStrip(char* filename,s32 frmWidth,s32 frmHeight,bool useClrKey=false);
           inline void setFrame(int n);
           void DrawElement(f32 x = 0, f32 y = 0);
           void SetTileMap(s32* tileMap,int mpw,int mph,int srx=1000,int sry=1000);
           void LoadTileMap(char* MapFileName);
           void SaveTileMap(char* MapFileName);
           void SetCell(s32 x,s32 y, s32 val);
           void FillMap(s32 val);
           void FullScreenScrolTileMap(f32 XOff=0,f32 YOff=0,bool forward=true);
           void ScrolTileMap(f32 x=0,f32 y=0,f32 XOff=0,f32 YOff=0,bool forward=true);
 };
here is the screenshot of 2 layers scrolling tileMaps in defferent speed and deffernt direction
Image

so do not forget to upgrad to ver 1.3 for irr 1.1 ,visit my site below and download it from download page.

Enjoy it.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

Hi Everybody

here is a littil updating of Magic Library

Functions added

1-SetMediaDir
2-GetMediaFile

for simplify loading media from your media folder

3-DeltaMouseX
4-DeltaMouseY

for returning the deffernce amount between each mouse movment.

also added scrolling font demo with mirror effects , see how amos language
was so powerful language for amiga computer. the following is a screenshot
Image

Code: Select all

/************************************
      Scrolling Mirror Font Demo
       From Anos Basic of Amiga
           By Emil Halim
*************************************/


#include <MagicIncludes.h>


// global declration of Irrlicht interfaces
IrrlichtDevice* device;
IVideoDriver*   driver;
ISceneManager*  smgr;

bool ProgramRun;


int main()
{
    device = createDevice(EDT_OPENGL, dimension2d<s32>(640, 480), 32);
    bool rslt = InitMagic(device);
    if(rslt == false)
          printf("Magic Library will only work with OpenGL driver");

	driver = device->getVideoDriver();
	smgr   = device->getSceneManager();

/// setting current Directory path of media folder
	SetMediaDir("../../MagicLibrary/media/");


/// creating Rainbow Image
    u32  RianColor[] =
     {
         0x11,0x22,0x33,0x44,
         0x55,0x66,0x77,0x88,
         0x99,0xaa,0xbb,0xcc,
         0xdd,0xee,0xff,
         0x11ff,0x22ff,0x33ff,
         0x44ff,0x55ff,0x66ff,
         0x77ff,0x88ff,
         0x11aa,0x1199,0x1188,0x1177,
         0x66,0x55,0x44,0x33,0x22,0x11
    };
    TImageTexture* Ranbow = new TImageTexture;
    Ranbow->CreateImage(2,64);
    for(int h=0;h<33;h++)
     {
         for(int w=0;w<2;w++)
         Ranbow->ImageData[w+h*2] = 0xFF000000|RianColor[h];
     }
    Ranbow->Update();

 /// creating Font
    TImageTexture* FontA = new TImageTexture;
    FontA->LoadImage(GetMediaFile("mrfont.bmp"));
    FontA->setColorKey(0,0);
    MFont* fnt_2 = CreateFont(FontA,39,45,40);
    SetBaseChar(fnt_2,65);
    SetFont(fnt_2);


    // small letter f represntes a space char because image has no space char
    char*  Msg = new char[2048];
    strcpy(Msg, "HAYfDOfYOUfBELIVEfTHATffTHISfSCROLLINGfFONTfDEMOfWASfWRITING");
    strcat(Msg, "fMOREfTHANfTENfYEARSfAGOfBYfAMOSfBASICfLANGUAGEfFORfAMIGAfCOMPUTER");
    s32 MsgLen = TextLength(fnt_2,Msg);

    ProgramRun = true;
    int lastFPS = -1;

	while(device->run()&& ProgramRun)
	{

		driver->beginScene(true, true, SColor(0,0,0,0));

                 if(KeyDown(KEY_ESCAPE))ProgramRun=false;

                 ViewOrtho();

                 SetBlend(ALPHABLEND);

                 SetViewport(0,0,640,480);
                 SetColor(255,255,255);
                 SetScale(320,4);
                 Ranbow->SetTexture();
                 DrawImage(Ranbow,320,413);

                 static f32 X=640,Y=0,base=375,sx=0;
                 SetScale(2,2);
                 Y = 35+sin(sx)*40; sx+=0.01*4;
                 X-=0.5*4;
                 if(X < -TextLength(fnt_2,Msg)) X=640;
                 SetViewport(40,0,600-40,base);
                 SetColor(255,0,0);
                 FontA->SetTexture();
                 DrawText(Msg,X,base-Y);
                 SetViewport(40,base,600-40,60);
                 SetAlpha(0.25f);
                 SetScale(2,1.5);
                 DrawInversedText(Msg,X,base+Y);
                 SetAlpha(1.0f);
                 ViewPerspective();


		           WaitVBL(); //just like Amos "Wait vbl" function

		driver->endScene();
		int fps = driver->getFPS();
         if (lastFPS != fps)
         {
            wchar_t tmp[1024];
            swprintf(tmp, 1024, L" Scrolling Mirror Font Demo(%s)(fps:%d)",driver->getName(), fps);
            device->setWindowCaption(tmp);
            lastFPS = fps;
         }
	}

	device->drop();

	return 0;
}
for downloading the demo and updating please visit my dowload page in my site

now i am working in creating TileMap Editor ,so that you can edit your Map then
loading it from file in your program.

Enjoy it.
Emil_halim
Posts: 518
Joined: Tue Mar 29, 2005 9:02 pm
Location: Alex,Egypt
Contact:

Post by Emil_halim »

Hi EveryBody

i have made a new class called TSystemFont , will be included with next release of magic library.

System font class allows you to use the window True Type font,
it work's just like irrlicht font except that you can create the
font on the fly, I.e. you will not create the font with external tool
then loading the texture . but you will simply call one smart function
then use the font , also at any time while the program is running you
could erase the font and create an other on.

system font class will follow the Magic rols , you could scale , rotate ,
colour the system font as usual.

system font allows you to spcify the width & hight of the character ,also
spcify how bold the font will be , the Italic and underline could be spcified.

system font has function for calculate the width of any text in pixel ,so that
you could easily center your text on the screen ,or drawing border around your text

system font allows you to get the hight of font , so that you could easily alignment your text virticaly on the screen.

system font allows you to draw Outliend text , you could spcify the outer colour and inner colour and the thikness of outlined text.

Code: Select all

now let us see how we could use it
===================================

1- create an instance of the class

        TSystemFont* SysFont = new TSystemFont;

2- spcify the attributes of font and create it

                          +----- name of the font
                          |            +----  width of the font
                          |            |  + ---- hight of the font
                          |            |  |  + ---- how bold the font will be
                          |            |  |  |   + ---- italic flag
                          |            |  |  |   |     +---- underline flag
                          |            |  |  |   |     |    +---- size of texture that hold
                          |            |  |  |   |     |    |          the font
                          |            |  |  |   |     |    |
        SysFont->Create("Raster fonts",8,12,900,false,true,512);


3- in loop of your program , set the textuer first then draw your texts as you want

        SysFont->SetTexture();
        static char* str = "System Font is your way for drawing real time window font";
        f32 cen = SysFont->CenterX(str);
        SetColor(255,255,0);
        SysFont->DrawString(str,cen,300);

                                    +---- pointer to string
                                    |   +---- starting x coordinate
                                    |   |   +---- starting y coordinate
                                    |   |   |   +---- red component of outer color
                                    |   |   |   |  +---- green component of outer color
                                    |   |   |   |  | +---- blue component of outer color
                                    |   |   |   |  | |  +---- red component of inner color
                                    |   |   |   |  | |  |   +---- green component of inner color
                                    |   |   |   |  | |  |   |  +---- blue component of inner color
                                    |   |   |   |  | |  |   |  | +---- thikness of outer color
                                    |   |   |   |  | |  |   |  | |
        SysFont->DrawOutLinedString(str,100,450,255,0,0,255,255,0,1);

here is a screenshot of SysFont demo
Image
Cryptit
Posts: 5
Joined: Thu Oct 26, 2006 9:22 pm
Location: Germany

Reference Problems in dll exports?

Post by Cryptit »

Emil_halim wrote:Hi everybody

this time i have improved TileMap stuff, (TImageStrip class).

this class allows you to build a TileMap the scroll it in full screen or part of screen see the screenshot below , here is the prototype of the class

Code: Select all

class DLL_EXPORT TImageStrip
 {

...
 };
Hello Emil_halim,

i've started to work with Irrlicht and your Magic Library for a few days. Impressive work so far - but unfortunately i've run into problems.

Hopefully no noob questions, but while integrating Magic Library 1.2 (with updates 1.3 lib and samples), i got some reference problems. It seems that the compiled DllMagic.dll has some export problems (?):

Code: Select all

Project   : Irrlicht Project
Compiler  : GNU GCC Compiler (called directly)
Directory : E:\irrlicht-1.1\MagicLibrary\Examples\Basic4GL\2LayersBackGroundMap\
--------------------------------------------------------------------------------
Switching to target: default
Linking console executable: ..\..\..\..\bin\Win32-gcc\2LayersBackGroundMap.exe

...

.objs\main.o:main.cpp:(.text+0x31c): undefined reference to `_imp___ZN11TImageStrip10SetTileMapEPiiiii'
.objs\main.o:main.cpp:(.text+0x373): undefined reference to `_imp___ZN11TImageStrip10SetTileMapEPiiiii'
.objs\main.o:main.cpp:(.text+0x4a3): undefined reference to `_imp___ZN11TImageStrip22FullScreenScrolTileMapEffb'
collect2: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
0 errors, 0 warnings

I think it's a problem from the "updatingMagicLibrary1.3.a.Irr1_1.zip"-File from your server, because the included libDLLMagic.a is dated from October, 1., 2006 and it has no actual dll exports for the tilemap stuff?

Greetings,

Cryptit
Last edited by Cryptit on Sun Oct 29, 2006 3:43 am, edited 2 times in total.
Post Reply