project-navigation
Personal tools

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - xray

Pages: [1] 2 3 ... 5
1
Coding / Re: lua design thoughts
« on: September 19, 2015, 04:28:16 pm »
Rebased the PR. Hope it is alright now.

xray

2
Windows / Re: Solution to building uforadiant on windows platform
« on: September 19, 2015, 04:27:23 pm »
No. Not yet. If you like, you can add them using the attachment provided in the earlier post.

xray

3
Coding / Re: lua design thoughts
« on: September 18, 2015, 08:34:53 am »
... Would merge the pull request - but there is a merge commit in it. ...

How do I get rid of the merge commit?

xray

4
Coding / Re: lua design thoughts
« on: September 02, 2015, 01:54:03 pm »
Hi,

I've created a pull request with an update on the lua integration of the ui. It is now possible to create windows/compones/nodes from a data structure that looks more-or-less like ufo script. Note that there are some small changes to the situation described in the previous post, they're described in the wiki.

@geever: hope this is what youre looking for  :)

xray

5
Coding / Re: lua design thoughts
« on: August 30, 2015, 07:27:17 pm »
Hi,

A small update. I managed to write some lua code allowing the following construct (using lua tables). It allows for a hierarchy of (nested) tables defining ui nodes to be created in a single statement. This more or less mimics the old ufo script behaviour, only then in lua. Currently the code to create a set of nodes looks like this:

Code: [Select]
node = {
_type = "panel",
_name = "pnlTest",

pos = { 10, 250 },
size = { 200, 200 },
layout = ufo.LAYOUT_TOP_DOWN_FLOW,
layoutmargin = 15,
backgroundcolor = { 0.50, 0.00, 0.00, 1.00 },

{
_type = "MainMenuBtn",
_name = "btnTest1",
text = "_Test 1"
},

{
_type = "MainMenuBtn",
_name = "btnTest2",
text = "_Test 2"
},

{
_type = "MainMenuBtn",
_name = "btnTest3",
text = "_Test 3"
}
}

...
do
wndMain = ufo.create_window ("main", nil)
wndMain:set_background ("ui/main_bg")

local pnlTest = build(node, wndMain)

        ...


The above results in the red panel on the left (see attached image). I'm going to work on this further but for now, it looks promising.

xray

6
Coding / Re: lua design thoughts
« on: August 27, 2015, 07:48:43 am »
Thanks!

What about using our bug/feature tracker as a todo-list?

-geever

Added them as 2 improvements: 5495 and 5496.

xray

7
Coding / Re: lua design thoughts
« on: August 25, 2015, 03:47:55 pm »
2. Scrollbars
    Assigning scrollbars is annoying in the ufoscript too.
    ...

Problem here is that this is a flaw in the existing c-implementation of the ui, rather than a lua issue. If you look at similar implementations the actual creation of the scrollbar is delegated to the owning control. So I guess an "auto_scroll" property will need to be implemented on the c-side first. After that we have to evaluate if there is actually a need to implement a custom "on_scroll" event. However this event should not be used to scroll the parent view, since this aspect should be handled by the parent control creating the scrollbars.

Anyway, this takes some redesigning of the ui. I'll put it on the todo-list.

xray



xray

8
Coding / Re: lua design thoughts
« on: August 25, 2015, 03:36:41 pm »
What if instead we could write:
Code: [Select]
    local building_head = ufo.create_string(box, "building_head", {
        ["super"]        = nil,
        ["box"]          = { 0, 20, 150, 20 },
        ["font"]         = "f_very_small_bold",
        ["contentalign"] = ufo.ALIGN_CC,
        ["longlines"]    = ufo.LONGLINES_PRETTYCHOP,
        ["text"]         = "_Building"
    })

This is much in line with an idea I had about setting a group of properties using lua's native table structure. I'm going to look into this a bit more. It would look a bit like this:

Code: [Select]
local fooNode = ufo.create_button(...)
fooNode.set_properties({
  box = {0, 0, 100, 100}
  text = "_Foo button"
  ...
})

Typically it can be solved the lua way, using boilerplate code (e.g. a "set_properties" method) taking a lua table and then calling the api. Drawback is that you have to maintain two sets of interfaces. The lua-C interface and the lua-lua interace. An alternative is to add the method to the basic node that accepts a lua table, scans it and looks for properties in on the C-side. Drawback here is that the lua api has renamed some of the properties to more logical names.

xray

9
Coding / Re: lua design thoughts
« on: August 23, 2015, 09:03:58 pm »
I just found out that this is in master already... Hmm, I like it and don't, at the same time. It has great potential for moving out a lot of UI related code from C, but it also moves away from regular people: more programming and what is the worst: lots of of extra (useless) typing.[/quoute]

I had it moved in the main branch so it gets more feedback. Located in an isolated branch the development was more or less stalling. As for the design: it's lua, yes you need to program. But that's precisely why it was implemented firsthand since ufo script is not a good programming language with major drawback in writing the functions. As for the extra typing: one solution is to write boilerplate lua code that accepts some hierarchic structure defining the look of the gui and then translates it into appropriate api calls.

As it is, current implementation works side-by-side with the ufo script implementation, so at the moment anyone can pick the language he/she is most comfortable with.

I'm still looking for the change, hoping that the current state is just the beginning of something really good.
[/qoute]

I'm sure in the end it will become just that :-)

@xray: Would you be interested in my thoughts and improving the LUA UI engine?
-geever

@geever: Of course I'm open for thoughts on improving the LUA UI engine. You can PM me or post in this thread. Looking forward to your ideas!

xray

10
Windows / Solution to building uforadiant on windows platform
« on: July 21, 2015, 01:09:06 pm »
Hi,

I noticed the build for uforadiant on windows was broken due to some missing header files. I've attached them below. These files are typically created when running building gdk/gdkglext using configure. Unfortunately, configure drops the files somewhere in a user folder and in the source folder.

Apart from these files, the exec.h and exec.cpp need to be fixed. After that, it builds. To run you need to put the needed dll's in the uforadiant.exe folder or somewhere on the path.

xray

11
Linux / build of fork fails on linux: lua link error
« on: June 01, 2015, 09:52:35 pm »
Hi,

I've created a fork of the main branch to work on lua integration for the ui (see topic: lua design thoughts). Currently picking up where I left in januari and the first thing I wanted to do was to create a linux build environment so that build validation can also be performed on the linux platform (my dev platform is windows).

Now the following issue arises. The repository main branch compiles just fine on windows and linux using configure and make.
My fork however produces link errors if I use configure and make. If I use the C::B project, the build is succesfull on windows. On linux C::B uses the makefile, so it fails. All link errors are related to missing lua functions. So it somehow doesn't link in the required c-files (my guess)

But that doesn't make sense since the main branch also uses lua and this one is building fine. I cannot find any differences in the makefiles that explains this. But the truth is, I'm no expert on makefiles. My fork is found on https://github.com/rxadmin/ufoai.

Help please..

Thx.
xray

12
Coding / update on project (was: Re: lua design thoughts)
« on: May 31, 2015, 07:18:37 pm »
Hi everybody,

I guess you were wondering wether this project was actually abandoned. Well, it's not. However, it's been a long time, I know.

Since  my last post in january I got all tied up in both work and my master thesis (should you wonder: yes it is finished and yes I got my master title  ;D ;D ;D). I was planning on bringing this project into the main branch until I realised that I couldn't spent any time on issues should they arise. So I postponed the pull request.
 
Now I'm picking up were I left. Last week I merged with the main branch and fixed some issues. This week I'm going to setup a linux build environment. After that, it will be time to merge with the main branch.

Regards,
xray

13
Coding / Re: lua design thoughts
« on: December 10, 2014, 05:28:14 pm »
Fixed the intro problem. Now seeing a nice blue earth in the window...

14
Coding / Re: lua design thoughts
« on: December 09, 2014, 08:38:44 pm »
  • nor intro window
Merged your pull request. The segfaults are gone. At least as far as I can see. Anyway, the intro seems to be running on my system without troubles. At least.. I guess with "intro" you mean the sequence played when you start a new campaign.

15
Coding / Re: lua design thoughts
« on: December 08, 2014, 10:03:44 pm »
Few more problems I've experienced.
  • requested set_cvar segfaults
  • cvar-associated checkbox can't be checked back if unchecked
  • nor intro window nor model_test windows work (in case of intro you have to find intro.ogm, because it was removed a while ago)
  • and some others
I created a pull request and commented on each issue I stated above.

Thx. for the pull request, it clarified a lot. Problem was I did not have a lua ufo file that actually triggered this code. Found the segfault. It should work now. Also added the option to set cvar with a string value. Can you check if it's working now?

As for the other issues, I'm going to look into this by the end of this week. The checkbox issue might be related to the mixing of int/float values in the cvar.

Pages: [1] 2 3 ... 5