Sign in to follow this  
thisdp

[DGS]Advice on this Open Source Dx Lib

Recommended Posts

I would apperciate it very much if you could give some advice on DGS.

 

  • Like 2

Share this post


Link to post

I have one. It may not work (depends on how similar your dgs to mta cgui).

Make a resource that will patch other resources to replace existing scripts based on cgui with dgs.
For example it may add a file into resource of this kind:

guiCreateButton = exports.dgs.guiCreateButton -- global variable guiCreateButton will store exported function that will be called instead of mta's cgui function anywhere within the resource
guiCreateWindow = exports.dgs.guiCreateWindow

In this file you will place all your functions that replace mta default functions. So all calls of default mta funcs within the resource would be redirected to dgs system.
As for events - you will have to rewrite their names within dgs script to be same as standart ones.
I'm sure this would be very useful for lots of people who don't have time/motivation to rewrite their old existing scripts with your dgs system.

Edited by AfterAll14
  • Like 3

Share this post


Link to post
15 hours ago, AfterAll14 said:

I have one. It may not work (depends on how similar your dgs to mta cgui).

Make a resource that will patch other resources to replace existing scripts based on cgui with dgs.
For example it may add a file into resource of this kind:


guiCreateButton = exports.dgs.guiCreateButton -- global variable guiCreateButton will store exported function that will be called instead of mta's cgui function anywhere within the resource
guiCreateWindow = exports.dgs.guiCreateWindow

In this file you will place all your functions that replace mta default functions. So all calls of default mta funcs within the resource would be redirected to dgs system.
As for events - you will have to rewrite their names within dgs script to be same as standart ones.
I'm sure this would be very useful for lots of people who don't have time/motivation to rewrite their old existing scripts with your dgs system.

the functions name are incorrect

https://wiki.multitheftauto.com/wiki/Dgs

 

But some functions are different from cegui's

Edited by thisdp

Share this post


Link to post

Better optimization. I've tested your script, did the button performance test. 30 fps. Now, realistically you wouldn't really have 1k buttons but I did check overall performance, and it's just not that great imo. I found that it takes up quite a bit of resources and especially on older computers with lower end gpu's it has negative performance impact. Seems that your code is doing lots of calculations each frame when it doesn't have to. You can overcome some of this by using render targets and eliminate any unnecessary calculations by only updating it when a change occurs, like a mouse enter/leave, click, etc. Render targets are great for this, however, real optimizations would still need to be done.

Secondly, why didn't you make it object-oriented? That would certainly make your code a lot shorter, more structured and a lot more manageable than it is right now. Especially with inheritance you could probably cut down your code up to 1/3 of what it is now. I can give you a hand in that if you like.

Anyway, keep up the work, you certainly have one of the most complete frameworks out there which I applaud you for that.

 

  • Like 2

Share this post


Link to post
1 hour ago, Tails said:

Better optimization. I've tested your script, did the button performance test. 30 fps. Now, realistically you wouldn't really have 1k buttons but I did check overall performance, and it's just not that great imo. I found that it takes up quite a bit of resources and especially on older computers with lower end gpu's it has negative performance impact. Seems that your code is doing lots of calculations each frame when it doesn't have to. You can overcome some of this by using render targets and eliminate any unnecessary calculations by only updating it when a change occurs, like a mouse enter/leave, click, etc. Render targets are great for this, however, real optimizations would still need to be done.

Secondly, why didn't you make it object-oriented? That would certainly make your code a lot shorter, more structured and a lot more manageable than it is right now. Especially with inheritance you could probably cut down your code up to 1/3 of what it is now. I can give you a hand in that if you like.

Anyway, keep up the work, you certainly have one of the most complete frameworks out there which I applaud you for that.

 

Don't forget Render Target takes more resources and video memory.

And I am actually seeking for the solution of optimization, while I found dxDrawText, dxDrawImage, dxDraw...  these function are very very very slow.

Object-oriented code is good for experienced scripters, but it is horrible for new scripters.

Thanks for your suggestions and supports.

Edited by thisdp

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.