Jump to content

[WIP] Information system


Anubhav

Recommended Posts

Hi again

I haven't released resources in some weeks, so I decided to make on DX Information system.

This is just a idea now, I'm trying to think the design and do it.

Remember it's status IS WIP.

I'm working on it right now!

Progress:

Screenshots:

The main base:

http://i.imgur.com/0WBJzVN.png

-> This is not photoshop, I just made this window now. I'm working on the functions of it now!

Features

- DX GUI working with the database and the database system with settings of tabs - DONE

- GUI for editing things with the data - Not DONE

Edited by Guest
Link to comment

So basically it's a dxDrawText exported from an SQLite database query, and a GUI to edit that query, it's a nice idea, but make sure not to query each time the window is drawn, only on resourceStart, and one more thing, add/delete menus can come in handy.

Link to comment

The colours are a bit obnoxious to say the least, maybe go with something that's a bit easier on your eyes? :P Also maybe try to center things a bit more, make it look a bit more professional rather than sloppily thrown together.

For example, even spacing between things, to keep some uniformity in it all.

Also, to make things look better, you should outline things. You can check my tutorial for some "utility functions". Maybe you'll find them useful :)

Link to comment

Alternatively you can also use the same code as I did for an old login panel of mine. It should make it automatic. You'll have to figure out how to use it yourself, though. It shouldn't be too hard if you're familiar with tables in Lua. :)

-- Define Data Constructs 
local stage1 = {}; 
  
function addLoginPanelLabel(dataConstruct, theRef, theText, PosX, PosY, SizeX, SizeY) 
    if(dataConstruct[theRef] == nil) then 
        dataConstruct[theRef] = {["Text"] = theText, ["textLabel"] = {["PosX"] = PosX, ["PosY"] = PosY, ["SizeX"] = SizeX, ["SizeY"] = SizeY}}; 
        if(dataConstruct[ref] == nil) then 
            return false; 
        else 
            return true; 
        end 
    end 
end 
  
function deleteLoginPanelButton(dataConstruct, ref) 
    if (dataConstruct[ref] == nil) then 
        return false 
    else 
        dataConstruct[ref] = nil 
        if (dataConstruct[ref] == nil) then 
            return true 
        else 
            return false 
        end 
    end 
end 
  
function addLoginPanelLabel(dataConstruct, theRef, theText, PosX, PosY, SizeX, SizeY) 
    if(dataConstruct[theRef] == nil) then 
        dataConstruct[theRef] = {["Text"] = theText, ["textLabel"] = {["PosX"] = PosX, ["PosY"] = PosY, ["SizeX"] = SizeX, ["SizeY"] = SizeY}}; 
        if(dataConstruct[ref] == nil) then 
            return false; 
        else 
            return true; 
        end 
    end 
end 
  
function deleteLoginPanelLabel(dataConstruct, theRef) 
    if (dataConstruct[theRef] == nil) then 
        return false 
    else 
        dataConstruct[theRef] = nil 
        if (dataConstruct[theRef] == nil) then 
            return true 
        else 
            return false 
        end 
    end 
end 
  
function showOnStart_Handler() 
    if(stage1Active == false and stage2AActive == false and stage2BActive == false) then 
        showCursor(true); 
        addEventHandler("onClientPreRender", getRootElement(), drawStage1Text_Handler); 
        addLoginPanelButton(stage1, "loginButton", "Images/ButtonUnlit.png", 0.3625, 0.6875, 0.0566, 0.0911, "< Login", 0.4227, 0.7148, 0.5139, 0.7552); 
        addLoginPanelButton(stage1, "registerButton", "Images/ButtonUnlit.png", 0.3625, 0.8242, 0.0566, 0.0911, "< Register", 0.4228, 0.8529, 0.5537, 0.8919); 
        stage1Active = true; 
    end 
end 
addEventHandler("onClientResourceStart", resourceRoot, showOnStart_Handler); 
  
function drawStage1Text_Handler() 
    dxDrawImage(0, 0, screenX, screenY, "Images/FAG_Background.jpg"); 
    local mSX, mSY = getCursorPosition(); 
    local mSX, mSY = mSX*screenX,mSY*screenY; 
    for referenceName, theArray in pairs(stage1) do 
        dxDrawImage(theArray["buttonImage"]["PosX"], theArray["buttonImage"]["PosY"], theArray["buttonImage"]["SizeX"], theArray["buttonImage"]["SizeY"], theArray["buttonImage"]["imageSource"], 0, 0, 0, tocolor(255, 255, 255, 255), true); 
        dxDrawText(theArray["Text"], theArray["buttonText"]["PosX"]+1, theArray["buttonText"]["PosY"]+1, theArray["buttonText"]["SizeX"]+1, theArray["buttonText"]["SizeY"]+1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "Left", "top", false, false, true, false, false); 
        dxDrawText(theArray["Text"], theArray["buttonText"]["PosX"]+1, theArray["buttonText"]["PosY"]-1, theArray["buttonText"]["SizeX"]+1, theArray["buttonText"]["SizeY"]-1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "Left", "top", false, false, true, false, false); 
        dxDrawText(theArray["Text"], theArray["buttonText"]["PosX"]-1, theArray["buttonText"]["PosY"]+1, theArray["buttonText"]["SizeX"]-1, theArray["buttonText"]["SizeY"]+1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "Left", "top", false, false, true, false, false); 
        dxDrawText(theArray["Text"], theArray["buttonText"]["PosX"]-1, theArray["buttonText"]["PosY"]-1, theArray["buttonText"]["SizeX"]-1, theArray["buttonText"]["SizeY"]-1, tocolor(0, 0, 0, 255), 1.00, "bankgothic", "Left", "top", false, false, true, false, false); 
        dxDrawText(theArray["Text"], theArray["buttonText"]["PosX"], theArray["buttonText"]["PosY"], theArray["buttonText"]["SizeX"], theArray["buttonText"]["SizeY"], tocolor(187, 0, 0, 255), 1.00, "bankgothic", "Left", "top", false, false, true, false, false); 
        if(mSX >= theArray["buttonImage"]["PosX"] and mSX <= theArray["buttonImage"]["PosX"]+theArray["buttonImage"]["SizeX"]) and (mSY >= theArray["buttonImage"]["PosY"] and mSY <= theArray["buttonImage"]["PosY"]+theArray["buttonImage"]["SizeY"]) then 
            -- Button Active 
            theArray["buttonImage"]["imageSource"] = "Images/RedButtonLit.png"; 
        else 
            -- Button Inactive 
            theArray["buttonImage"]["imageSource"] = "Images/ButtonUnlit.png"; 
        end 
    end 
end 

Link to comment
  • 2 weeks later...

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...