GUI

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

GUI

Post by Sparx »

Hi there,

I allready found a lot of guis arround. But it seems so confusing which one to use... I think bartbes allready wrote something about this ;-)
I'm looking for a simple gui supporting textfields, select-lists, buttons, tabs.. I thinks thats basicly it. Which gui can you advice me?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: GUI

Post by Robin »

Well, LOVEly Eyes and LoveUI are pretty up-to-date. Which of the two you should choose is up to you ;). I would recommend trying out the demos, and see which API looks simpler to you.
Help us help you: attach a .love.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: GUI

Post by bartbes »

Tabs.. don't know about that, but a list was made on request by appleide, and I myself think LoveUI works great, and, most important, is easy to implement. When I was done I was surprised about the amount of code needed. (in a positive way, so it was not much)
So, check out LoveUI I'd say, and be sure to talk to appleide, always helps.

(and, it uses SECS, but that shouldn't make a difference)

Because I don't want to be biased, be sure to take a look at LOVEly Eyes as well, never hurts.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: GUI

Post by Sparx »

LOVEUI looks great... Is it possible to have the list that you can scroll table like and maybee even sort them by values in the table?
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: GUI

Post by bartbes »

I'm not really sure what you want, maybe somebody else does, or maybe you can try and explain it to me.

EDIT: some answers:
You can manipulate all incoming data, as it uses a callback to get number of items and the items themselves, so it doesn't matter where you get that data from, and you can pass it on in any order you want.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: GUI

Post by Sparx »

Something like this:

http://images.clanbase.com/docs/guids/F ... 3_P3.1.jpg

having several values like "Server Name", "PING" or "MAP"

click on them and the list gets sorted....
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: GUI

Post by bartbes »

Well, possible, as you can use your own functions to pass the data, if you need help, just ask (though it's probably better to do that on IRC).
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: GUI

Post by Sparx »

Integrated in the gui would be perfect =)
Maybee appleide is willing to do so?
User avatar
appleide
Party member
Posts: 323
Joined: Fri Jun 27, 2008 2:50 pm

Re: GUI

Post by appleide »

Hmm columns are not possible yet. My semester is just ending so I'll get a one week exam break starting from next saturday... Depends where my motivations are I could be : studying, working, programming (on iphone) or programming (in love). Hopefully not socialising because that would ruin my exam results. :( I'll do a table next though.... when I get around to it. :)

Btw it shouldn't be too hard to sort your own array and then feed the data into the ListView.

Code: Select all

--Example code for a ListView, along with data.
function getList()
	return {
		{"Australia server1", "Sydney"},
		{"Australia server2", "Melbourne"},
		{"Australia server3", "Brisbane"},
		{"New Zealand server1", "Auckland"},
		{"New Zealand server2", "Wellington"},
		{"Papua New Guinea server1", "Port Moresby"},
		{"Indonesia server1", "Jakarta"},
		{"Indonesia server2", "Bali"},
		{"Singapore server1", "City Hall"},
		{"Malaysia server1", "Kuala Lumpur"},
		{"Hong Kong", "Central"},
	};
end
-- serverList
local servers=getList();

--make a dataSource object that provides data for listView
local data={};
function data:viewForRow(aListView, rowIndex, aListCell)
	local newView=LoveUI.View:new(LoveUI.rectZero);
	function newView:display()
		LoveUI.graphics.setColor(0,0,0);
		LoveUI.graphics.draw(servers[rowIndex][1], 10, 20);
	end
	
	return newView;
end

function data:numberOfRows(aListView)
	return table.getn(servers)
end

function data:columnWidth(aListView)
	return 200
end

--the actual listView
local aListView=LoveUI.ListView:new(LoveUI.Rect:new(350, 10, 200, 220), data)
aContext:addSubview(aListView);
The code isn't perfect; I've since realised a way to optimise this would be to cache the views into an array and return them so they don't need to be generated every time reloadData is called.

EDIT: for tabs the only way to fake them with LoveUI is to draw each tab's stuff on a different view, with same sizes and locations. then have e.g 4 buttons on top where when you click one, it makes one of the views visible and the other 3 hidden.
User avatar
Sparx
Party member
Posts: 125
Joined: Thu Apr 02, 2009 9:54 am
Location: Aachen, Germany

Re: GUI

Post by Sparx »

I thought the same thing about the tabs, it should be easy.
I'm not going to code my own table and sorting codes if this is going to be implemented (hope it will be soon :) )
Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests