Jump to content

Browser and GUI


dugasz1

Recommended Posts

Hello guys.

I'm writing a costume GUI system with dx functions but it is possible with a browser too. What do you guys think which way should i do?


Which has better performance? My dx GUI is simple (recentagle shaped) but if i make it with browser i would make a more fancy GUI (I mean curved border, nice animations with HTML5 or maybe responsive with media queries) MTA can handle this on a slow PC too?

And can someone link some docs or examples about this JavaScript <-> Lua communication? How i JS call a Lua func or Lua a JS func?

Link to comment

I wasn't replying cause i don't actually have an answer given my knowledges, but since it seems this applies more on less to all people that viewed this for nearly a day....

22 hours ago, dugasz1 said:

but it is possible with a browser too

what do you mean? making all the stuff in html and displaying it with a browser? I think (but not sure) it will work on all PCs, but (still not sure) the browser is slower.

As you may understand i'm not really helpful, so have you seen resources like this (i didn't)?

If i have time i could give a shot to this intresting argument (html gui)... but till now if nobody knows this... i think you will have to test it yourself :( sorry

Still don't lose hopes about someone experienced with this, and don't let the topic die... i am interested to you questions too

Edited by LoPollo
Link to comment

Thank you i appreciate you'r answer.

Well yes i meant that. Making the look in HTML and css and interact with JS and Lua.

Yes a saw that resource it helps to know how to do it but not to understand it. There is a function he/she use in js to communicate with lua: mta.triggerEvent but where is this mta class (i guess it's a class) come from? What can it do?

Link to comment

Watch these lines:

html of the page:

<script>
function test(command){
    var login = document.getElementById("login").value
	var password = document.getElementById("password").value
		mta.triggerEvent("cmsg", login, password, command)
	}
</script>

<div class="login">
	<input type="text" placeholder="username" name="user" id="login"><br>
	<input type="password" placeholder="password" name="password" id="password"><br>
	<input type="button" value="Login" onclick=test("login")>
	<input type="button" value="Register" onclick=test("register")>
</div>

client.lua

function cmsg(login, password, command)
	if (command == "login") then
		triggerServerEvent("login", resourceRoot, login, password)
	elseif (command == "register") then
		triggerServerEvent("register", resourceRoot, login, password)
	end
end
addEvent("cmsg", true)
addEventHandler("cmsg", root, cmsg)

He defined a func in js that triggers an event in the script, and then handles it from there...

but i don't know where that "mta" comes from:

mta.triggerEvent("cmsg", login, password, command)

login and password are the inputs, command is the one passed with onclick=test("register") or onclick=test("login") but i don't know where that "mta" comes from... maybe it's predefined?

Edited by LoPollo
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...