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.

Dark GDK / HassanText

Author
Message
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 23rd Mar 2010 19:11 Edited at: 1st Feb 2011 08:57
Hey guys

So yeah, we all know that GDK text SUCKS.
how about some new text functions? here we go

now let's see what can we get from GDK text trying to make some nice text effects:


and hassantext:


now lets compare:
function:
GDK text adjust each paragraph's color/size/font/style(bold/normal)

HassanText adjusts each paragraph's alpha/color/size/font/some more styles ( alot of available styles )

FPS:
FPS without anything on screen : 2000

GDK text whithout effects (one paragraph) : 1400 FPS = (1000/1400)-(1000/2000) = 0.21 ms per frame loss
HassanText with effects (one paragraph) : 1300 FPS = (1000/1300)-(1000/2000) = 0.26 ms per frame loss

microscopic difference : 0.05

with effects:
GDK text : 12 which is equal to (1000/12) = 83.22 ms per frame loss
HassanText : 721 which is equal to (1000/721) = 01.38 ms per frame loss

that's actually a huge difference

much better eh? ( tho my calculations may be wrong LOL, but the text is better than GDK text )
there is only one drawback which is multiple paragraphs, it slows it down a bit ( not really a drawback compared to GDK text )

also, you can adjust alpha and some other font types / styles using HassanText

so here's how it works:

-> start GDK
-> create a cText object ( main text class )
-> create custom fonts AT START NOT IN LOOPS ( this is what makes it beat GDK text. )
-> draw text in loop ( same way as GDK text )
-> render text

code:


it's all simple and self explained, maybe D3DXCreateFont is the only unusual thing, well you can find info about parameters at
http://msdn.microsoft.com/en-us/library/bb172773%28v=VS.85%29.aspx

you create some custom fonts that has the sizes / styles, give them an ID and use them later with cText:rawText() ( fontid parameter ) so each paragraph have a font ( multiple paragraphs can have multiple fonts without problems )

feel free to use it or even modify it if you want, it's pretty simple, download link: http://filebeam.com/6f0728c1a445336895041e2e12542aab

P.S. might make it faster when i go into sprites, you can do it yourself if you know how, tho.

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 23rd Mar 2010 19:27
Thats awesome Hassan, having you learning DirectX may benefit us all. Another thing that is really slow is the draw functions, lines shapes etc, not saying you should fix it but make sure you fix it

haliop
User Banned
Posted: 23rd Mar 2010 22:28
how come DarkGDK is so slow?
that is an intersting question...


and hasan , wow man.
awesome!
if i'll understand what is written above i will probably use it
NightX
15
Years of Service
User Offline
Joined: 3rd Apr 2009
Location: Australia, QueensLand
Posted: 24th Mar 2010 13:16
Sweet thanks

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 24th Mar 2010 13:55
Quote: "how come DarkGDK is so slow?
that is an intersting question..."


it seems you havn't tried writing different paragraphs of text with different colors / styles / etc, check out the demo attached and comment out the line "#define HASTXT", and see what i mean

haliop
User Banned
Posted: 25th Mar 2010 08:10
what i meant was
how come DarkGDK stuff is so slow , as it was created by proffesionals, is it like Vista
Mireben
16
Years of Service
User Offline
Joined: 5th Aug 2008
Location:
Posted: 25th Mar 2010 08:46
I recently submitted a bug report about dbInk slowing down the program and the explanation was that it's slow because Dark GDK rebuilds the font when its properties change. Here is the thread if you are interested.

http://forum.thegamecreators.com/?m=forum_view&t=166602&b=15

Hassan, thank you for making this solution available.
Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 26th Mar 2010 23:51 Edited at: 27th Mar 2010 10:46
This is great! i remember your post that showed off your text! at last you release it you should make it a library nice nice!

EDIT: can i use both at the same time to compare them? im having some sort of difficulties getting it to work... everythings in place... but only gdk text gets drawn. is this normal?

EDIT 2: Lol forget it. hoho i forgot to place txt->RenderText(); now it works!

EDIT 3: hmmm seems that when i create the font, it sort of modifies gdks text too, so if i use dbText it draws the text with the same font only in white... maybe this is just me?

EDIT 4: its just me lol (i think)

hi
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 27th Mar 2010 11:04
lot of edits

well yeah it's probably just you ( some error in your code ) since the fonts created with HT has nothing to do with the GDK text

glad you liked it

Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 27th Mar 2010 11:10 Edited at: 27th Mar 2010 11:19
Hassan im glad i caught you here. when i do this:



it prints Mover10 1.000000 always... where it was supposed to write mover1, mover 2 ... etc... how can i change that?

EDIT: ill try to put txt->RenderText ( ); after every statement and see how it goes

EDIT2: yay that fixed it
changed that code to this:

Now it works at last! multicolor text thats not slow

hi
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 27th Mar 2010 12:12 Edited at: 27th Mar 2010 12:21
minor update:

http://filebeam.com/1cf7208b0afd48ab661894daf445df66

updates:


Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 27th Mar 2010 12:13
oh didn't see your post Cetobasilius, ill make an update to fix this.

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 27th Mar 2010 12:19 Edited at: 27th Mar 2010 12:29
ok fixed:

http://filebeam.com/6f0728c1a445336895041e2e12542aab

that was a silly error, dunno how i did it
So guys, if find any bugs, or have any siggestions for new functions, just let me know!

P.S. added link to first post

haliop
User Banned
Posted: 27th Mar 2010 13:12
hi hassan im glad you finally went with the Wrapper all the way
i just checked your WebSite and it awesome man!

i liked the name HasX Engine
good job!
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 27th Mar 2010 13:37
heh, thanks

Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 27th Mar 2010 13:59 Edited at: 27th Mar 2010 14:05
yeah this kind of work makes me happy to be here just tested the new update and it works great. the bug is gone (although i didnt know it was a bug) HasX Engine! im willing to be a tester for that!, i have a directinput wrapper for joysticks. maybe you would like to integrate it into HasX although it doesnt have force feedback capability... yet

hi
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 27th Mar 2010 15:07
well maybe, but im not really sure whether i'll release it or not, depends on how it goes

Isocadia
15
Years of Service
User Offline
Joined: 24th Jul 2009
Location:
Posted: 30th Mar 2010 19:37
Please release, it would be awesome!

Isocadia

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 2nd Apr 2010 22:00
do GDK have a function like dbGetSprite() to get the sprite handle? ( ID3DXSprite* )

Oneka
20
Years of Service
User Offline
Joined: 24th Apr 2004
Location: Hampton,VA
Posted: 6th Apr 2010 03:53
What you should add, is support for UTF-8 encoded characters, then this would be even better!


Making dreams possible, one line at a time...
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 7th Apr 2010 19:11
@ oneka : i might do it, but to be honest, i've never dealt with unicode stuff, getting alot of unhandled exceptions with them, but i might get it working soon, i hope so

@ everyone : i might create some 2d drawing functions, but my maths are extremely failure, so, anyone can give me a simplified line / circle drawing algorithms?

Thanks.
-Hassan

Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: <script> alert(1); </script>
Posted: 7th Apr 2010 19:17
also, can someone give me an example of using GDK 2d functions, that destroys fps?

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 8th Apr 2010 15:50
Quote: "also, can someone give me an example of using GDK 2d functions, that destroys fps?"


Take a look at the DarkForm plug-in, this killed my fps and I'm pretty sure it was the drawing functions.

Cetobasilius
14
Years of Service
User Offline
Joined: 29th Dec 2009
Location: Mexico
Posted: 12th Apr 2010 22:21 Edited at: 13th Apr 2010 03:51
Hassan can you please guide me how to use this text inside this class:
(i need to replace the gdk default command down there with yours)


if i have my main text object on my main.cpp file... and this file shown is a .h file... i have tried different ways with no success.


EDIT: i retrieve the text and print it in the main.cpp, but when i type something very fast, it seems to leak memory. this is what i do in the loop:

any help would be aprecieated

hi
Cuddle Bunniezzz 12
15
Years of Service
User Offline
Joined: 14th Jan 2009
Location: Buffalo, NY
Posted: 12th Apr 2010 23:16
Hassan, pretty much all of the DarkGDK draws commands can kill FPS.

When I was testing a game of mine using my Polygon Collision System, I used the function to draw a preview of the polys (only about three), it slowed down quite a few Frames (and I was only using dbDot()). But after I turned off the poly preview and turned on the sprites it was at it's set FPS without any delays.

http://www.darkgdk.us/ <- You can now submit pages, upload images, yet were lacking content. We need your help!
Hassan
15
Years of Service
User Offline
Joined: 4th May 2009
Location: &lt;script&gt; alert(1); &lt;/script&gt;
Posted: 13th Apr 2010 19:40 Edited at: 13th Apr 2010 19:40
only when you write fast? weird, mind showing a simple example causing this leak?

@ Cuddle Bunniezzz 12: well i tried making the 2d stuff, but it wasnt "much" faster than GDK ones ( 200x200 dots takes 400 m/s from GDK dbDot, and 300 m/s from mines, not quite much ) so i need to re-create it

Matty H
15
Years of Service
User Offline
Joined: 7th Oct 2008
Location: England
Posted: 13th Apr 2010 19:55 Edited at: 13th Apr 2010 19:58
Cloggys D3D

I think this might just be for DBPro but he may indicate the speed improvement of his library somewhere, I have not looked at it in any great depth.


Edit:Link
O.K, he says 500% and there is a GDK version, I have not checked it out yet but I think the source is available.

Login to post a reply

Server time is: 2024-10-02 03:29:15
Your offset time is: 2024-10-02 03:29:15