anything related to UI in general, splash screens, UI widgets, input and output etc.

GUI Editor load jpg from lua

GUI Editor load jpg from lua

Postby epsilonion » 01 Nov 2015, 15:26

Hi,
I have been looking at how to do a inventory system and I am stumbling on how to load a texture into the GUI.

I want to pull the inventory from the table created in a script.


then after this I would be looking at the drag and drop of the GUI system to populate a held in hand table for use in game.

For instance the inventory is items within the back pack that can not be used unless equipped into the in hand table, then you press numbers "1","2","3" (on the keyboard not the numpad) etc to use them.

That brings me to another question, is there a way to keyindex, like 49 is the index of key 1 on the keyboard, 50 is number 2 etc etc, as standard lua doesn't support this apparently according to google :lol:
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 866
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: GUI Editor load jpg from lua

Postby SolarPortal » 01 Nov 2015, 15:55

i had a look and it seems it isn't possible. When we are over our current tasks, then we will add this in :D
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: GUI Editor load jpg from lua

Postby epsilonion » 01 Nov 2015, 16:01

Thank you, just reworded it so its easier to understand.. lol

been scratching my head on this for hours.. lol
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 866
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: GUI Editor load jpg from lua

Postby Shando » 19 Sep 2017, 00:19

Hi All,

I know this is a bit old, but did this ever get implemented?

I have seen the following in the API and assume I have to use this:
Code: Select all
gui::setAttribute ( String bodyID, String elementID, String param, String value ) 


So, would it be as simple as:
Code: Select all
gui.setAttribute ( "sccGUI", "btnCont11", "Normal Image", "NEW_GRAPHICS\skyline_thumbs/altar_2_blue.jpg"


Thanks in advance

Shando
Alienware 17 (i7-4700MQ 2.4GHz 16GB GTX770M Win 10 64)

Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 492
Joined: 06 Mar 2013, 22:35
Location: Kings Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: GUI Editor load jpg from lua

Postby SolarPortal » 19 Sep 2017, 11:23

ill have a look. got a couple of jobs, then will look at your requests and a couple of user requests :)
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: GUI Editor load jpg from lua

Postby epsilonion » 19 Sep 2017, 11:54

This will be great for inventory items :)
User avatar
epsilonion
Skyline Lead Moderator
Skyline Lead Moderator
 
Posts: 866
Joined: 26 Feb 2015, 11:51
Location: Hull, East Yorkshire, England
Skill: Business Manager
Skill: Great creative

Re: GUI Editor load jpg from lua

Postby SolarPortal » 19 Sep 2017, 11:59

most certainly, i thought we already did this years ago, but cant remember of the top of my head lol :oops: so much in skyline to keep track of haha... :P
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: GUI Editor load jpg from lua

Postby Shando » 05 Nov 2017, 01:07

Hi SP,

Sorry about this, but I'm still struggling with the setAttribute function :?

Basically, I'm trying to update the images (Normal, Hover & Pressed) on buttons via script. I've tried loads of different combinations and nothing seems to work :cry:

for example:
Code: Select all
gui.setAttribute ( sccGUI, sT2, "Normal Image", sT )

where sT2 = "btnCont1" and sT = "altar_2_grey.jpg"

and
Code: Select all
gui.setAttribute ( sccGUI, "btn_3_1_N", "background-image", "NEW_GRAPHICS\skyline_thumbs/altar_2_grey.jpg 512px 512px 0px 0px" )


The GUI has been created using the VGUI Editor with the following showing in the relevant files:
RCSS:
Code: Select all
#btnCont1
{
   background-color: #777;
   border: 1px solid #ccc;
   height: 24.5%;
   left: 0.5%;
   position: absolute;
   top: 0.25%;
   width: 49%;
}

...

#btn_3_1_H
{
   background-decorator: image;
   background-image: NEW_GRAPHICS\skyline_thumbs/altar_2_blue_b.jpg 534px 534px 0px 0px;
   display: none;
   height: 100%;
   position: absolute;
   width: 100%;
}

#btn_3_1_N
{
   background-decorator: image;
   background-image: NEW_GRAPHICS\skyline_thumbs/altar_2_blue.jpg 512px 512px 0px 0px;
   display: block;
   height: 100%;
   position: absolute;
   width: 100%;
}

#btn_3_1_P
{
   background-decorator: image;
   background-image: NEW_GRAPHICS\skyline_thumbs/altar_2_blue.jpg 0px 0px 512px 512px;
   display: none;
   height: 100%;
   position: absolute;
   width: 100%;
}

RML:
Code: Select all
<div onmouseout="show(self,btn_3_1_N);hide(self,btn_3_1_H);lua(scenescript,mouseOut,btnCont1)" onmouseover="hide(self,btn_3_1_N);show(self,btn_3_1_H);lua(scenescript,mouseOver,btnCont1)" onmousedown="hide(self,btn_3_1_N);hide(self,btn_3_1_H);show(self,btn_3_1_P);lua(scenescript,btnCont1,1)" id="btnCont1" onmouseup="hide(self,btn_3_1_P);show(self,btn_3_1_H);"><div id="btn_3_1_N" /><div id="btn_3_1_H" /><div id="btn_3_1_P" /></div>


As always, any help would be greatly appreciated.

Regards

Shando

PS: All the buttons are within a Container element, if that makes any difference??
Alienware 17 (i7-4700MQ 2.4GHz 16GB GTX770M Win 10 64)

Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 492
Joined: 06 Mar 2013, 22:35
Location: Kings Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer

Re: GUI Editor load jpg from lua

Postby SolarPortal » 07 Nov 2017, 22:08

Sorry, i forgot to respond to this one... not igoring you lol :P :oops:

Yeah, image loading is a fun one and i am still to get around to it.. this release is just taking everything haha :P
Skyline Game Engine - Lead Dev.
Please provide as much info as possible when asking for help.


Specs: OS: Win 10 64bit, CPU: Intel i7 3770 3.4ghz x 4 core(8 threads), GPU: Nvidia GTX 1060 6GB, Ram: 16gig DDR3, Windows on 250gb Samsung Evo 860

Twitter: @SolarPortal
Instagram: @SolarPortal
User avatar
SolarPortal
Skyline Founder
Skyline Founder
 
Posts: 3202
Joined: 29 Jul 2012, 15:56
Location: UK
Skill: 3D Modeller
Skill: 2D Artist
Skill: Programmer
Skill: Level Designer

Re: GUI Editor load jpg from lua

Postby Shando » 07 Nov 2017, 22:33

Hi SP,

No worries, I know you're busy ;)

It's not a show-stopper, so take your time ( though, not too long, of course :twisted: )

Shando
Alienware 17 (i7-4700MQ 2.4GHz 16GB GTX770M Win 10 64)

Love, Hope, Strength http://www.lovehopestrength.co.uk
User avatar
Shando
Skyline Moderator
Skyline Moderator
 
Posts: 492
Joined: 06 Mar 2013, 22:35
Location: Kings Beach, Queensland
Skill: Programmer
Skill: Scripter
Skill: Level Designer


Return to UI

Who is online

Users browsing this forum: No registered users and 1 guest