Jump to content

interactive dxDraw


NeXTreme

Recommended Posts

Hey guys.

My current goal is to make an entire interface for my role play script out of dxDraw functions (image, rectangle, etc.). Obviously, drawing the items is not a problem. What I want though are buttons, edit fields, scroll bars, grid lists and other stuff available with GUI made with dxDraw functions.

My first idea for making buttons would be to draw an image, and then create a GUI button underneath and make it invisible. My button would then look like my custom image, and I could also use events from GUI.

However I haven't thought of a way to efficiently create edit fields and other stuff. For the edit field, maybe put an invisible edit field underneath too? I dunno.

My question is, what's the easiest way to create something like that? I need a system that allows me to quickly create buttons and edit fields, etc. and also to remove them.

Cheers,

NeXTreme

Link to comment
  • Moderators

Hi,

I making a resource to convert every gui functions in directX functions.

Exemple:

-- FUNCTIONS: 
dxCreateStaticImage( x, y, sx, sy, path, relative, parent ) 
dxSetPosition( dxElement, x, y , relative) 
dxGetPosition( dxElement, relative ) 
dxSetSize( dxElement, sx, sy , relative) 
dxGetSize( dxElement, relative ) 
  
-- EVENTS: 
onClientDXClick 

I start to create this system last week.

At this time, all functions and the event works ( and the parent/children system too ). :mrgreen:

I will upload my resource on the community when the basics gui functions are done for the 1st version then I will add other functions from the gui system.

But the tabs and the scoll system will be very hard :|

To change all your gui's in directX => replace all 'gui' by 'dx' :wink:

Link to comment

I have started making a directx GUI few weeks ago. At the moment, windows, buttons, checkboxes and edit fields are done. Scrollbars are mostly finished. Windows are fully movable, customizable (colors) and will be resizable too. Buttons have different background image when being idle, hovered or clicked. Clicking every dx gui element triggers onCLientDXGUIClick event and much more.

gtasa2011042612461105.jpg

Now I see that were doing independently the same. I thought it is very unlikely to happen.

*TIP After finishing scrollbars and scrollpanes, you can use them to make gridlist, so you don't have to double your work. But actually srollpanes seems very hard to make in a general way.

Link to comment
  • Moderators

Nice vEnom

This is the list of functions/events that I have scripted (since last week ):

  • element dxCreateStaticImage ( float x, float y, float width, float height, string path, bool relative, [element parent = nil] )
    bool dxSetPosition ( element dxElement, float x, float y, bool relative )
    float, float dxGetPosition ( element dxElement, bool relative )
    bool dxSetSize ( element dxElement, float width, float height, bool relative )
    float, float dxGetSize ( element dxElement, bool relative )
    bool dxStaticImageLoadImage ( element dxElement, string filename )
    string dxGetStaticImage( element dxElement ) -- return the filepath
    bool dxGetVisible ( element dxElement )
    bool dxSetVisible ( element dxElement, bool state )
    bool dxSetAlpha ( element dxelement, float alpha )
    int dxGetAlpha ( element dxElement )
    onClientDXClick => Parameters: string button, string state, int absoluteX, int absoluteY
    onClientDXDoubleClick => Parameters: string button, string state, int absoluteX, int absoluteY ( only "up" is send for the state )

The parent and the relative system works.

Now I will make the window, button, edit, checkboxes etc with the CGUI.png (all images used by the gui system is in this pictures )

cgui.png

The goal: to make the same system than the gui with the same design, functions and events => just replace 'gui' by 'dx' and 'GUI' by 'DX' and it will works !

Link to comment
  • Moderators

I will make a system that the player can choose an interface and all peoples can make his own CDX.png ( it's the name of CGUI.png in my resource :mrgreen: )

Yes ! Every DD/Race server want it because when you use the GUI system and you spectate another player, when this player starts the nos, the GUI disappears from the screen ! Do the test.

So for the 1st release, it will make exactly the same than the GUI system but all servers can replace the CDX.png by his own CDX.png.

Do you understand ? ( Sorry for my poor english :| )

Link to comment
  • Moderators
They can be used dynamically, like example for small real time clock, gui can't do that - gui is static.

yeah but you can use guiStaticImageLoadImage or guiSetPosition or guiSetSize etc, so it's not really 'static' like you said.

In what ways are the dx functions better?

For me, it's just the problem of the nos with the GUI system that the dx system doesn't have :D

Link to comment

You know, you could probably add custom GUI skin support to MTA with a day or two's work, which would be much easier for everyone than reimplementing the GUI from scratch.

1.1 supports skin switching, so it's not much of a step from there.

Link to comment

The skin idea is nice, then however everyone would have different look, which is not my point. Maybe a new client function to set the skin to a player?

  
guiSetSkin(string imagePath) 
  

This one looks cool:

cguisquare_1644490_1179555.png

Anyways, I want to use dxDraw because I can make it look much better than GUI, allows me to draw images and text, and with a little work you can create nice animations for opening/closing interfaces, changing windows, etc.. The problem of course is making it "interactive".

Every DD/Race server want it because when you use the GUI system and you spectate another player, when this player starts the nos, the GUI disappears from the screen

I have never encountered this problem, I used a combination of GUI and dxDraw for a race userpanel and I never saw that.

Link to comment
  • Moderators
You know, you could probably add custom GUI skin support to MTA with a day or two's work, which would be much easier for everyone than reimplementing the GUI from scratch.

1.1 supports skin switching, so it's not much of a step from there.

Yeah maybe but I want to remake the GUI system in directX. Why ?

Answer:

because when you use the GUI system and you spectate another player, when this player starts the nos, the GUI disappears from the screen !

@NeXTreme: Awesome skin :P

Link to comment

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...