Home » MODDING HQ 1.13 » v1.13 Coding Talk » RII - Resolution Independent Interface [UPDATE :RII v4f]
Re: RII - Resolution Independent Interface[message #214135] Sat, 25 April 2009 14:31 Go to previous messageGo to next message
Native_Elder is currently offline Native_Elder

 
Messages:56
Registered:April 2009
BirdFlu
Until now i did not touch the code, i only scaled the images, where i also scaled the offsets. I think the problem is that the distance between two tiles is not scaled and thus all objects are placed way too close to each other. To change that i need to modify that part of the code that handles inter-tile distances.


makes sense. You may have to change tile size. That might open a new can of worms though, especially JSD's and the like :openmouth:

Report message to a moderator

Corporal
Re: RII - Resolution Independent Interface[message #219963] Mon, 08 June 2009 17:11 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
I was just thinking, what if the GUI can be separated from the Tactical screen. Basically making it an overlay rather than a component of it. That would give us far more leeway to edit and alter, and even make a better functioning GUI for the game.

I was playing SupCom Forged Alliance which got me thinking about this as the GUI in that is configurable on the fly. You can move sections about and have them disappear offscreen etc...

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #222072] Fri, 19 June 2009 20:52 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
There are several components in a GUI that need to be tackled :

Definition , Layout , Function , Rendering

----------------
Definition : The rendered GUI elements have to be defined at a point in the code. This is about the pure existence of an element. It gets a name and is "accessible" (in an abstract sense) in the game from now on. It is accessed to set its layout, to link it to a function (e.g. button press) and to render it.

Layout : This is just the position of an element on the screen.

Function : There are static objects (e.g. background image) and there a dynamic ones (e.g. buttons). Whenever a dynamic element is supposed to react to some event a callback function is called. This callback function is linked to the element when it is defined.

Rendering : The elements that have an image associated with it are rendered by drawing its image to the frame buffer at the location specified by the layout.
----------------

In this project, i mostly addressed the definition and the layout of gui elements. I didn't changed the rendering and the functions. Because the rendering is explicit, that is only the elements that are known at compile time are rendered, the definition has also to happen at compile time. So, adding new elements is not possible now (maybe except for buttons, as there is generic rendering code for them). As the linking of the functions to the elements is also done at compile time, there is only the layout that can be modified.

Functions could be "externalized", now that the Lua project is getting some attention. Unfortunately functions and rendering code aren't always separated, that is rendering code is called from the callback function. So, that leaves us with externalizing only the non-critical callback function. Of course, you could also expose the rendering functions to the user, but i don't think it's a good idea. It's too low level, and would probably degrade performance (a lot?).

Exposing the functions wouldn't be too hard, i think. Right now we use GUI_CALLBACK, with is a function pointer typedef. That should be changed to a functor, because they are more powerful. As there are no functors (or delegates or similar constructs in C++) we would have to do it ourselves. But it's not that hard.
// base functor
class GUI_FUNCTOR
{
public:
  virtual bool operator()(param1, param2, ...) = 0;
};

// GUI_CALLBACK replacement
class GUI_FUNPTR
{
public:
  GUI_FUNPTR(GUI_CALLBACK funptr) : fun(funptr) {};
  virtual bool operator()(param1, param2, ...)
  {
    return fun(param1,param2);
  }
private:
  GUI_CALLBACK fun;
};

// externalized Lua callback function
class GUI_LUACALLBACK
{
public:
  GUI_LUACALLBACK(string filename, string funtionname) : file(filename), function(functionname) {};
  virtual bool operator()(param1, param2, ...)
  {
    if(globalObject.FileNotLoaded(file)) globalObject.LoadFile(file);
    lua_pushfunctionname(function);
    lua_pushparameters(param1, param3);
    if(!lua_pcall(...))
    {
      lua_geterror();
      return false;
    }
    return lua_popresult();
  }
private:
  string file, function;
};


The Layout is externalized for some parts of the GUI. Basically, the layout of the complete strategic screen is available to modding. Just look at the xml files that are coming with this project. The Definition is also more relaxed now. You can define fonts and colors and even the actual image file(name)s that will be used for rendering.

So, the real "enemy" of this project is the explicit rendering code. It has to be made implicit, that is traversing a data structure (that can be filled from outside) and rendering its elements according to some rules. Once the rendering works, everything else will be much easier to transform.

I wasn't working on this project for some time, as i was busy integrating the VFS into the MP code, which is now merged with the main branch. But i already merged, my "old" code with the current SVN HEAD, so the next release should come in the next couple of "time units", although it probably won't contain any new stuff.

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #222083] Fri, 19 June 2009 22:09 Go to previous messageGo to next message
gmonk

 
Messages:670
Registered:April 2002
Location: Newfoundland, Canada
Dude, you are an angel. :angel:

You understand this idea completely. I don't think that Lua scripting for UI element placement, outside of game init, should even be a consideration. If there's interface scripting involved it should only be called for during game initialisation, perhaps it could be replaced by an .ini file, but I thought that perhaps Lua scripts could be more flexible.

Since most of us have no real idea how it works in the code, you're the guy to dictate what can or can't be done via scripting. If you can come up with anything at all that might be user configurable via scripts it'd be helpful.

In my crazy SMP diatribe I was thinking mostly mostly the placement of interface objects. Rendering can, and should only be, handled by the main engine. How would that affect something like a call for "FadeToBlack" or "Screenshake" though? I'm thinking ahead to user configurable cutscene scripts here.

Report message to a moderator

First Sergeant
Re: RII - Resolution Independent Interface[message #222137] Sat, 20 June 2009 05:32 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
User configurable Fonts!!!
:bow: :bow: :bow: :bow:

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #222480] Mon, 22 June 2009 00:43 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
New version released ( Alpha V.4c ), download from first post in this thread

Release Notes:
  • merged with current SVN HEAD (r3023)
  • splitted MDGuns.sti, MDPxItems.sti to single png images
    * Interface\MDGUNS\*.png
    * Interface\MDPxItems\*.png
  • updated Ja2Convert.exe
    * converts sti animations with new xml structure (png series in 7z archive)
    * uses file patterns to convert multiple files at once
  • updated convert batch files

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #222492] Mon, 22 June 2009 01:34 Go to previous messageGo to next message
Roadkill is currently offline Roadkill

 
Messages:155
Registered:May 2001
Location: Lords of the Bytes
:ok:

Report message to a moderator

Staff Sergeant
Re: RII - Resolution Independent Interface[message #222495] Mon, 22 June 2009 02:33 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3480
Registered:January 2000
Location: Danubia
Once I get my head out of NO, I'll get playing on these goodies.

Report message to a moderator

Captain
Re: RII - Resolution Independent Interface[message #222498] Mon, 22 June 2009 03:05 Go to previous messageGo to next message
Wil473

 
Messages:2815
Registered:September 2004
Location: Canada
BirdFlu

splitted MDGuns.sti, MDPxItems.sti to single png images
* Interface\MDGUNS\*.png
* Interface\MDPxItems\*.png


Can it be, freedom from the STi graphics architecture?

[Updated on: Mon, 22 June 2009 03:06] by Moderator

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #222509] Mon, 22 June 2009 08:05 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
BirdFlu
New version released ( Alpha V.4c ), download from first post in this thread

Release Notes:
  • merged with current SVN HEAD (r3023)
  • splitted MDGuns.sti, MDPxItems.sti to single png images
    * Interface\MDGUNS\*.png
    * Interface\MDPxItems\*.png
  • updated Ja2Convert.exe
    * converts sti animations with new xml structure (png series in 7z archive)
    * uses file patterns to convert multiple files at once
  • updated convert batch files

I could kiss you, but I'm manly so how about a beer instead Wink

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #222533] Mon, 22 June 2009 13:02 Go to previous messageGo to next message
abbadon101 is currently offline abbadon101

 
Messages:6
Registered:June 2008
I think I will have to name my first legitimate child after you!

Report message to a moderator

Private
Re: RII - Resolution Independent Interface[message #222550] Mon, 22 June 2009 14:01 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
Poor kid, being called Birdflu! Just don't give him the forenames Flying Pig Wink

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #222551] Mon, 22 June 2009 14:03 Go to previous messageGo to next message
Thor is currently offline Thor

 
Messages:423
Registered:February 2007
Location: Belgium
LOL

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #222627] Mon, 22 June 2009 21:08 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
What, no love for illegitimate children?

PS. as i said elsewhere the item/png images have to be paletted images. Other images that can be specified in the XML files, can be 24- or 32-bit. Or not, it depends on the case.

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #222630] Mon, 22 June 2009 21:17 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3480
Registered:January 2000
Location: Danubia
Ok, i totally failed in my first JA2NO attempt and before i restart the game I'll be the happy tester. Starting with this beauty.


Hmm..

1) Installed clean JA2
2) Installed v1.13 using Kaerar's single click installer
3) Installed RII latest version from download in first post
4) Ran both .bat files in directory to convert sti's

Problems:
a) Files appear to have been converted, although Profile/data_png/Anims only include 1 bodytype of each kind.
b) When i launch the RII exe i run into an assertion failure error. Log below:

Quote:
*** Mon Jun 22 21:39:52 2009 ***

>>>>>>>>>>>>>>>>>>>>>
========== Mon Jun 22 21:39:40 2009 ==========
File : .\vfs_init.cpp
Line : 179
Location : InitVirtualFileSystem

Could not initialize directory [""] in : profile ["Player Profile"], location ["uprof_root"], path ["Profiles\UserProfile_JA2113"]

<<<<<<<<<<<<<<<<<<<<<

>>>>>>>>>>>>>>>>>>>>>
========== Mon Jun 22 21:39:52 2009 ==========
File : .\vfs_file_raii.cpp
Line : 67
Location : vfs::COpenWriteFile::COpenWriteFile

Could not create VFS file "sound.log"

<<<<<<<<<<<<<<<<<<<<<


I am sure I missed/screwed up something, I just dont know what.

[Updated on: Mon, 22 June 2009 21:46] by Moderator

Report message to a moderator

Captain
Re: RII - Resolution Independent Interface[message #222634] Mon, 22 June 2009 21:49 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3480
Registered:January 2000
Location: Danubia
Hmm...

UserProfile_JA2113

I was supposed to have such a folder in Profiles? I made one and game crashed with no log (WindowsXP error window only) on execution.

Btw could you find time and update the first post with detailed installation and testing instructions? They seem a bit outdated to me...

[Updated on: Mon, 22 June 2009 21:51] by Moderator

Report message to a moderator

Captain
Re: RII - Resolution Independent Interface[message #222639] Mon, 22 June 2009 22:18 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
First, the directory "Profiles/UserProfile_JA2113" must exist. And it usually does, when you have the newest SVN version. I don't know if the One Click Installer creates this directory.
Then you have to activate this mod by adding this in ja2.ini
[Ja2 Settings]
VFS_CONFIG_INI = vfs_config.RII.ini
;VFS_CONFIG_INI = some old vfs_config.*.ini that you commented out, in order to not loose it

Other wise you start the game with a wrong configuration file, which of course doesn't work. But i've written this in my first post, most of it.

You don't necessarily have to call the batch files. They convert SLF archives and the images that are not located in archives, but the vfs_config.*.ini file doesn't use them. You would have to modify the vfs_config.*.ini yourself, but you don't have to as it works without it.

The item/weapon png files are in the Profiles/RII/Interface/* directories and they are always used, independent of whether you called the batch files or not.

[Updated on: Mon, 22 June 2009 22:18] by Moderator

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #222641] Mon, 22 June 2009 22:22 Go to previous messageGo to next message
gmonk

 
Messages:670
Registered:April 2002
Location: Newfoundland, Canada
See the info about setting up a new VFS entry here.

Anyone want to write a simple step-by-step tutorial for the setting up a new VFS entry with an example file? Off_Topic maybe? I can have a look at it tomorrow, but I'm not sure how much time I'll have.

[Updated on: Mon, 22 June 2009 22:25] by Moderator

Report message to a moderator

First Sergeant
Re: RII - Resolution Independent Interface[message #222645] Mon, 22 June 2009 22:31 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
The vfs setup document needs to be updated and freed from typos.

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface[message #222686] Tue, 23 June 2009 00:26 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
I can confirm the latest SCI (SVN v1149) does create that directory (Profiles\UserProfile_JA2113).

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface[message #223550] Fri, 26 June 2009 16:44 Go to previous messageGo to next message
coffeecommander

 
Messages:86
Registered:June 2009
Location: Europe, and pitying you.

I've been forced to help you, but I can't code. What can I thus contribute to one day having my JA2 in 1680x1050?

Report message to a moderator

Corporal 1st Class
Re: RII - Resolution Independent Interface[message #223560] Fri, 26 June 2009 17:13 Go to previous messageGo to next message
gmonk

 
Messages:670
Registered:April 2002
Location: Newfoundland, Canada
Read the first post. Completely.

Download the modified exe and drop it in.

Read the last handful of posts about setting up VFS (it only looks scary. VFS is more afraid of you than you are of it. Wink )

Once you get it running, play with it and post back with what you think of it and what you think can be improved (bearing in mind that it's an alpha). And...

BAM! You're a beta alpha tester.

If you can't get it running, post back with any issues regarding that as well.

Report message to a moderator

First Sergeant
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223634] Sat, 27 June 2009 00:19 Go to previous messageGo to next message
profound is currently offline profound

 
Messages:64
Registered:October 2004
Location: Lithuania
First impression:
1680x1050(WS) = 2/3 of Omerta landing map. Few random graphical glitches(nothing solid)

http://vdsg.b4net.lt/temp2resized.jpg

Report message to a moderator

Corporal
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223648] Sat, 27 June 2009 02:25 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3480
Registered:January 2000
Location: Danubia
Kaerar
I can confirm the latest SCI (SVN v1149) does create that directory (Profiles\UserProfile_JA2113).


Thanks to someone's typo in URL i didn't have the latest release. LOL. Now I do and indeed is different. I can confirm it's running smoothly. Gonna test it asap.

Report message to a moderator

Captain
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223649] Sat, 27 June 2009 02:36 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3480
Registered:January 2000
Location: Danubia
Well, JA2 at 1280x1024 sure looks new. Hehe... and tiny...

http://www.ja-galaxy-forum.com/shanga/1240x1024b.jpg

Screen takes a while to refresh the out edges when you press the exit to map view. When you open the laptop or option you do get the black edge, but not immediately. Probably has a perfectly resonable explanation I've missed.

[Updated on: Sat, 27 June 2009 02:37] by Moderator

Report message to a moderator

Captain
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223658] Sat, 27 June 2009 03:23 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3480
Registered:January 2000
Location: Danubia
Here's an idea that haunted me for ages. Probably damn hard to implement, but sure seems more easy now than it was almost 10 years ago.

The gameworld can be rendered at 1280x1024 or any high res nowdays. Ok... but can we design a "sniper scope" that actually zooms down to lowest resolution? Like a movable lens.

Think of how much this would change aiming in JA2.

a) non-aimed shot, standard cursor, no option to pick body part (like on prone bodies). Equivalent to a shot from hip. Very fast, damn inaccurate.
b) normal sights lens, gives option to aim at head/torso/feet, limited levels of zoom, aka adding aim points.
c) scope lens, gives option to aim max points at a certain body part.

d) /dreammode on - add additional targeting points on the body (torso especially). Imagine shot to heart, shot to the shoulder/arm, etc. Game handles those randomly now, but why we shouldn't have the option to do them by hand?

[Updated on: Sat, 27 June 2009 03:26] by Moderator

Report message to a moderator

Captain
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223663] Sat, 27 June 2009 04:17 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
Basically adding a dynamic zoom function, similar to Supreme Commander?

I suggested that a while back! If we split the sections (no need for the map to be rendered behind other window sections anymore Wink ) so that the window that displays the tactical map has the ability to zoom on mouse cursor then I think it would be perfect Smile

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223700] Sat, 27 June 2009 11:12 Go to previous messageGo to next message
lockie is currently offline lockie

 
Messages:3717
Registered:February 2006
Location: Scotland
Would be great if only the game could handle bodypart specific damage .Shot to the right arm , fine , cannot shoot with that arm , and so on .

Report message to a moderator

Captain

Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223747] Sat, 27 June 2009 14:33 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3480
Registered:January 2000
Location: Danubia
Yep, dunno if LUA or some new advances in coding will ever make that possible. But those are two tweaks I've always dreamed about (since seing them in nother games). I think Commandos had a sniper scope cursor too, didn't it?

As for more body parts to aim at, I've looked at the code and seems like there's a lot of stuff to modify, since it's not only about showing a new cursor text, but also putting in a new CtH calculation. Plus the desired effect (enemy dropping weapon, fatal shot to heart). But would be cool.

Report message to a moderator

Captain
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223788] Sat, 27 June 2009 16:32 Go to previous messageGo to next message
coffeecommander

 
Messages:86
Registered:June 2009
Location: Europe, and pitying you.

I can see coming the days when some players will always aim for non-fatal hits.
And others for the nads.

Anyway, the bottom window - the one with the mercs and their stuff - is awfully small in higher resolutions...I find that a little straining on the eyes.

Report message to a moderator

Corporal 1st Class
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223792] Sat, 27 June 2009 16:40 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
That's why we keep 640x480 as an option for the elderly :diabolical:

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223793] Sat, 27 June 2009 16:40 Go to previous messageGo to next message
Shanga is currently offline Shanga

 
Messages:3480
Registered:January 2000
Location: Danubia
On very high res JA2 is actually hardly playable, because everything is tiny. I found myself going back to original res or 800x600 to actually see what's happening. But that's mostly because you don't have a zoomable camera (can we?).

Btw, back on RII topic, on 1280x1024 i found a strange bug. My mouse cursor had access to only 3/4 of the screen. The entire 1/4 of the right side made the mouse cursor dissapear. This changed on scrollin g of course, but always 1/4 of the screen was out of reach. Maybe because I went too high on res?

Report message to a moderator

Captain
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223799] Sat, 27 June 2009 16:48 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
Can't have gone too high as it's been up to 1650x 1080...

A zoom function would be really good along with a new scalable interface. But that's dreaming I think Wink

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223801] Sat, 27 June 2009 16:53 Go to previous messageGo to next message
lockie is currently offline lockie

 
Messages:3717
Registered:February 2006
Location: Scotland
Quote:
I can see coming the days when some players will always aim for non-fatal hits.


Would make stealing an awful lot easier...... What , no arms or legs , let me relieve you of these fine weapons and accessories good sir , and I wont even punch you , just lie twitching in that corner please !

Report message to a moderator

Captain

Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #223817] Sat, 27 June 2009 17:38 Go to previous messageGo to next message
Roadkill is currently offline Roadkill

 
Messages:155
Registered:May 2001
Location: Lords of the Bytes
caf
Anyway, the bottom window - the one with the mercs and their stuff - is awfully small in higher resolutions...I find that a little straining on the eyes.


That's what i have too, so i don't deepen the resolution. But it's nice to "stretch" the screen for my widescreen laptop Smile

Report message to a moderator

Staff Sergeant
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #226237] Wed, 08 July 2009 11:51 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
I think new versions of the Single Click Installer will run off the PNG folder setup Very Happy

Finally got around to playing with this properly and all I can say is Kudos Smile

Report message to a moderator

Lieutenant

Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #226362] Thu, 09 July 2009 03:17 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
You won't be able to use the PNG's in the SVN versions of the game. They don't have the necessary code. They still look for the monolithic STI Item/Gun images.

Report message to a moderator

Master Sergeant
Re: RII - Resolution Independent Interface [UPDATE : Alpha V4c][message #226363] Thu, 09 July 2009 03:19 Go to previous messageGo to next message
Kaerar is currently offline Kaerar

 
Messages:2021
Registered:January 2003
Location: Australia :D
Bugger Sad

Is there anyway to get that section SVN approved? It would be really good to get those into the game.

Also for the Bigitems wouldn't it be simpler to have the entire folder in a single Bigitems.jpc.7z container rather than a 1000 containers in the folder?

Report message to a moderator

Lieutenant

RII Light v1[message #226365] Thu, 09 July 2009 03:40 Go to previous messageGo to next message
BirdFlu is currently offline BirdFlu

 
Messages:438
Registered:September 2007
Location: Lampukistan
Here is a RII version with Lua support. But it doesn't contain the actual interface changes/updates. I call it RII Light, although i'm open for better name suggestions, as RII doesn't really fit the new direction of this mod anymore.

[ download ]

This exe is build on the current SVN version (r.3095) and it comes with a small script that demonstrates some features.
-- this function will be called from inside the game
function InitLuaUI()
	print( "Initializing Lua User Interface
" )

	-- get root node of 'MainMenu' screen
	root = gui.getScreen("MainMenu").root_node
	root.position = { 100, 100 }
	
	move_image = {
		[1] = { image = "BigItems/GUN11.sti", offset = {40, 100} },
		[2] = { image = "BigItems/GUN33.sti", offset = {40, 200} },
	}
	
	for i in ipairs(move_image) do
		local im = gui.createImage{ parent = root, image = move_image[i].image }
		im.offset = move_image[i].offset

		local t = gui.createTextNode{
			parent = im,
			text = move_image[i].image,
			font = "BLOCKFONT2", foreground = 240, background = 0
		}
		--t.offset = { -1 * im.size[1]/2, -10 }
		t.offset = { 0, -10 }
		
		local re = gui.createRegion{ parent = im }
		re.size = im.size
		
		local move,button = GetMouseCallbacks(im)
		re:define( button, move )
	end
	
	local text = gui.createTextNode{ parent = root }
	text.font = "FONT16ARIAL"
	text.foreground = 134
	text.background = 1
	text.text = "Hello World!"
	text.position = { 640/2 - 40, 20 }

	return 1
end

-- this function creates mouse callbacks (closures)
function GetMouseCallbacks(node)
	local _node = node
	local _lbutton = false
	local _position = {}
	
	local moveCallBack = function(tab)
		if(tab.reason == 64) then
			_lbutton = false
			-- print("lost mouse")
		elseif(tab.reason == 128) then
			-- print("gain mouse")
		end 
		if( _lbutton == true) then
			-- compute relative displacement
			local rd = { 
				tab.mouse_x - _position[1],
				tab.mouse_y - _position[2]
			}
			-- apply displacement to node
			local xy = _node.position
			for i=1,2 do xy[i] = xy[i] + rd[i] end
			_node.position = xy
			
			-- save current mose position
			_position = { tab.mouse_x, tab.mouse_y }
		end
	end
	
	local buttonCallBack = function(tab)
		if(tab.reason == 4) then
			_lbutton = true
			_position = { tab.mouse_x, tab.mouse_y }
		elseif tab.reason == 8 then
			_lbutton = false
		elseif tab.reason == 16 then
			local p = _node.position
			local o = _node.offset
			local t = _node.type;
			print( t )
			print( "  position : " .. p[1] .. ", " .. p[2])
			print( "  offset   : " .. o[1] .. ", " .. o[2])
		end
	end

	return moveCallBack, buttonCallBack
end


It doesn't do very much, but it gives you something to play with.

Btw. you should start this version in windowed mode. It probably wont work in fullscreen mode, i haven't tested it yet.

[Updated on: Thu, 09 July 2009 10:57] by Moderator

Report message to a moderator

Master Sergeant
Re: RII Light v1[message #226376] Thu, 09 July 2009 06:10 Go to previous messageGo to previous message
gmonk

 
Messages:670
Registered:April 2002
Location: Newfoundland, Canada
Looks cool, BirdFlu! :thumbsup:

It also works in fullscreen, btw. I 'dropped' the gun I was dragging a couple of times. Maybe the code can't keep up with reading my mouse position? [I'm using a semi-crappy USB optical mouse]

The_Bob is working on some dynamic UI code using Lua, have you guys had any kind of discussion? You guys could co-operate on a UI redesign using Lua. Smile

[Updated on: Thu, 09 July 2009 19:48] by Moderator

Report message to a moderator

First Sergeant
Previous Topic: Learning how the tactical AI works
Next Topic: Folding Stock Revamp
Goto Forum:
  


Current Time: Tue Jan 14 21:22:34 GMT+2 2025

Total time taken to generate the page: 0.02338 seconds