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

Menu system

Re: Menu system

Postby StarFire » 10 May 2017, 21:27

Awesome works like a charm, old skool smoke and mirrors ;)
Great work :D
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1455
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: Menu system

Postby SolarPortal » 10 May 2017, 21:28

Great work! Fake it til you make it :D

Shadows are probably not working due to the Transparent floor. If its using the alpha smooth, then shadows dont work on it.
Although, it might not cast shadows correctly but may recieve them.

Try turning cast shadows off on the floor and see if that helps :)
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: Menu system

Postby planetX » 11 May 2017, 09:31

Thanks buddies, it wouldn't be possible without your support. ;)

Depending on the alpha level and the floor's material settings, hard shadows appear sometimes... but I understand that this setup is not easy to manage due to weird meshes and materials, plus that I have no idea what I'm doing most of the times, so I'm not going to dig more on this at the moment, at least until lights and stuff are completely developed. Fake shadows are coming! :D

I have to populate the menu with all the pages and functionalities, but I'm already thinking on the save/load profiles stuff and, of course, no idea where to start... what would be the best approach? Do you have any good example to store data?

I think I've said this before, but I have to say it again: I really love this engine, everything is so easy... it's just awesome.

There's however something that really piss me off at the moment, which is the fact that none of the code editors (lua, rml, rcss) uses a monospaced font... I can deal with Verdana, but coding in Green Arial Italic is a PITA. :lol: I know that you're working hard in more important features and not sure how hard is to change the font, but maybe you could consider to include this in the next update?

Cheers!

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby SolarPortal » 11 May 2017, 10:33

think I've said this before, but I have to say it again: I really love this engine, everything is so easy... it's just awesome.

That is great news :) We are pleased you like the engine

I have to populate the menu with all the pages and functionalities, but I'm already thinking on the save/load profiles stuff and, of course, no idea where to start... what would be the best approach? Do you have any good example to store data?

yes, JSON will be your best bet and its super easy to use.

Example: JSON Save and Load
Code: Select all
-- | Requires the 0.9.7 preview version of skyline or later.

obj = 0;
function onInit(objID)
   obj = objID;
end

function onKeyDown( key )

   -- | on key one, we will serialize the table to file.
   if(key == "1")then
      lprint("#&127,127,127:Saving table to JSON...")
   
      -- | First Lets create a lua table and fill in some data to test with.
      local tempTable = {};
      tempTable["playername"] = "Joe";
      tempTable["lastName"] = "Bloggs";
      tempTable[0] = { ["a"]="Hello", [3]=200};
      tempTable[1] = "World";
     
      -- | Second: create a json object based on the table, this contains the correct
      -- | metatable for the code to write the JSON data properly.
      jsonObj = rapidjson.object(tempTable)
     
      -- | Third; Lets dump the new object into a json file.
      -- |    > The pretty at the end is to create more readable lines. Setting false will write into one line.
      -- |    > For a specific location on a Hard drive e.g. E:/myFile.json
      -- |    > You can name the extension to whatever you want ... *.tableData, *.player etc...
      rapidjson.dump(jsonObj, "C:/myfile.json", {pretty=true});
     
      lprint("#&127,255,127:Saving table to JSON Complete!");
   end
   
   -- | on key two, we will load the files data into a table and print the data.
   if(key == "2")then
      lprint("#&127,127,127:Loading table to JSON...")
   
      -- | Load the json file into a table.
      myData = rapidjson.load("C:/myfile.json");
     
      -- | Print the data to the in game screen.
      sprint("playername = "..myData["playername"]);
      sprint("lastName = "..myData["lastName"]);
      sprint("0 = "..myData[tostring(0)]["a"]);
      sprint("0 = "..myData[tostring(0)][tostring(3)]);
      sprint("1 = "..myData[tostring(1)]);
     
      lprint("#&127,255,127:Loading table to JSON Complete!");
   end
end

This file can be found in "Asset Library\Scripts\JSON". If not then its in the forum post now :)
You can also use the lua variables to get game folder locations:

Here are the general locations when working in the editor and wont be much good in an end game.
  • sky.getDir_AssetLibrary();
  • sky.getDir_DataFolder();
  • sky.getDir_Win32();
  • sky.getDir_Win64();
  • sky.getDir_Scenes();
  • sky.getDir_Presets();
  • sky.getDir_Models();
  • sky.getDir_Materials();
  • sky.getDir_Environements();
  • sky.getDir_Scripts();
  • sky.getDir_VisualModules();
  • sky.getDir_Textures();
The next two functions are used for the Game Directories once its exported to game.
  • sky.getDir_GameAssets(); -- Will retrieve the Assets Folder of the game folder.
  • sky.getDir_GameRoot(); -- Will return the root of the game folder.
If in the editor, then i expect these will go to the Win32_Release folder.

Example:
Code: Select all
    rapidjson.dump(jsonObj, sky.getDir_GameAssets().."/SaveFolder/myfile.json", {pretty=true});
    myData = rapidjson.load(sky.getDir_GameAssets().."/SaveFolder/myfile.json");

If there are any problems with it, then we can take a look.

There's however something that really piss me off at the moment, which is the fact that none of the code editors (lua, rml, rcss) uses a monospaced font... I can deal with Verdana, but coding in Green Arial Italic is a PITA.

lol :P This must be the rml file which is awful to work with haha. We just havent had the time to go looking into fonts at the moment, but if its that bad, we can see if we can fit it in :) Ill speak with StarFire :)
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: Menu system

Postby planetX » 11 May 2017, 11:29

Wow, that's a great example! Thank you very much, I can't wait to put my hands on it. :D

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby StarFire » 11 May 2017, 16:29

Ok on the font PITA :roll:

I have managed to hunt down the syntax highlighter and have made a change or two (no more italic!):

Clipboard Image (1).jpg
Clipboard Image (1).jpg (65.24 KiB) Viewed 6281 times


Do you have a fav font/size? Then we could give it a try for you;)
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1455
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: Menu system

Postby StarFire » 11 May 2017, 16:45

Just nailed the font family:

Clipboard Image (2).jpg
Clipboard Image (2).jpg (42.98 KiB) Viewed 6281 times


This is Font : "Inconsolata" so now can change to any preferred font for you.
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1455
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: Menu system

Postby StarFire » 11 May 2017, 16:51

Looking good now :)

Clipboard Image (3).jpg
Clipboard Image (3).jpg (54.15 KiB) Viewed 6281 times
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1455
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: Menu system

Postby planetX » 11 May 2017, 18:38

Ohhh... this is like a dream made true. :D

Try "Consolas", that's my favorite one. Not sure about the size, maybe 11pt?

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby StarFire » 11 May 2017, 20:37

Pleased this will make you happy :D

Will give "Consolas" a try and the last image is at 11pt ;)
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1455
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: Menu system

Postby StarFire » 11 May 2017, 20:52

I personally prefer the "Inconsolata" font as it looks more modern, what do you think? We can go with either :)
Here an image with "Consolas" @11pt:

Clipboard Image (4).jpg
Clipboard Image (4).jpg (66.46 KiB) Viewed 6274 times
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1455
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: Menu system

Postby planetX » 11 May 2017, 22:21

Hi, take the one you like more, the important thing is the monospacing. Inconsolata looks good to me too. :)

Having all the elements in the same font would be great too, that would make the code more readable. Since you are messing with it, I'd suggest to darken a lil bit the comments in the rml editor, they are really hard to read ATM.

Thanks for taking the time with this. ;)

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby planetX » 12 May 2017, 08:33

Made some progress on the menu, playing with cameras and smooth positioning...

Q: Is there any way to adjust the start/end distances of the fog through script?


My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby SolarPortal » 12 May 2017, 13:47

ahh, i want to see it but the broadband wont let us watch a video until later lol :P
Im not sure if the fog is passed through yet, if not its a quick one to add in :)

As i mentioned in another topic, we will be doing an interim release to get some of the newer changes out before the upgraded core as there has been some complications on the upgrade and a few horrid errors caused.

Will try to fit the fog in :)
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: Menu system

Postby StarFire » 12 May 2017, 15:35

Updated the comment to be a bit darker for you and also added mono-spaced font to the rcss files too :)

This will be in the next update for you :D
Dream the Journey, Live the Experience!
User avatar
StarFire
Skyline Founder
Skyline Founder
 
Posts: 1455
Joined: 03 Jan 2012, 18:50
Location: UK
Skill: Great creative
Skill: Programmer
Skill: 3D Modeller
Skill: 2D Artist
Skill: Level Designer

Re: Menu system

Postby planetX » 12 May 2017, 15:53

Hi, thanks for replies... no rush with the update, I definitely can wait.

Hope you solve you connection problems soon! ;)

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby SolarPortal » 12 May 2017, 17:10

Finally watched the video and nice work! :) Camera transitions are working great.
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: Menu system

Postby SolarPortal » 12 May 2017, 19:45

New fog lua function have been added in a new library also:

  • scene.setFogEnabled(int state);
  • state = scene.isFogEnabled();
  • scene.setFogMode(int mode);
  • scene.setFogDensity(float density);
  • scene.setFogLinearStart(float density);
  • scene.setFogLinearEnd(float density);
  • scene.setFogColour(float r, float g, float b);
  • r,g,b = scene.getFogColour();
  • mode = scene.getFogMode();
  • density = scene.getFogDensity();
  • linearStart = scene.getFogLinearStart();
  • linearEnd = scene.getFogLinearEnd();

Also some new enums to work with the setFogMode function:
  • enum.fog_Linear() returns 0;
  • enum.fog_Exp() returns 1;
  • enum.fog_Exp2() returns 2;

These will be in the next update.
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: Menu system

Postby planetX » 13 May 2017, 08:46

Awesome! Thanks a lot! ;)

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby planetX » 13 May 2017, 18:29

Hi, one question: How can I get the screens coordinates of a 3d object? I want to attach the lock sprite to the car... ;)

And I'm getting weird colors in the text, I want the orange you can see in the circle at the bottom right but I get a light yellow... any clue?


My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby SolarPortal » 13 May 2017, 18:45

you can get screen coords from world pos from these functions:

Code: Select all
x,y = screen.worldPosToScreenPos(x,y,z); -- Returns in 0-1 ... i think.
-- | or
x,y = screen.worldPosToAbsScreenPos(x,y,z); -- return in px


Note: Please bear in mind, that this hasnt been tested on Gen2 yet, but it used to work on Gen1. So i am looking forward to the results :)

As for the orange issue, it could be related to an SRGB problem the gui faces. I'll run some tests when possible :) If you have an image to provide of the colour it should be, then i can make sure it works for you :) but it is probably the same for all images.

It looks like your making leaps and bounds every day :)
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: Menu system

Postby planetX » 13 May 2017, 21:08

Hi SP, thanks! I'm using this, as you suggested...

Code: Select all
lock_x, lock_y = screen.worldPosToAbsScreenPos(car_pos.x, car_pos.y, car_pos.z);
gui.setPosition( page[20], "sprite_lock", lock_x, lock_y );

... where "page[20] = gui.load("menu_20.rml",0,0);" but it doesn't work for some reason. I get the screen coordinates, as I'm printing them, but I can't move the sprite. I know that moving sprites works, as the minimap in the race scene works fine, so I'm probably doing something wrong... :oops:

About the orange, I get a lighter tone as shown in the picture, but I'll check more in deep just in case I'm doing something wrong with the fonts.

Image

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

Re: Menu system

Postby SolarPortal » 13 May 2017, 21:49

ok, some extra info then perhaps :)

If you are loading multiple GUI rml files of the same name, then you will need to use the "gui.loadFromTemplate()" file
page[20] = gui.loadFromTemplate("menu_20.rml",0,0);

as this will generate a unique bodyID for the loaded rml. Basically it adds some extra index to the bodyID to make it unique.

Also, if you are setting the sprite from a relative position then it might cause an issue such as offset, so ensure that it has the whole document to play with. i usually place them in the top left and then move the

If this does not work then there might be something else going wrong. I will give this a quick test myself also :)

As for the orange, that really does look like and SRGB issue, maybe's in the Shader files for librocket. Will get around to it as the FPS hud also suffers the same problem.
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: Menu system

Postby SolarPortal » 13 May 2017, 22:05

ok, found some strange results.

if you are using a png with 16 bit depth, then the texture is not loaded with SRGB causing the colour to be incorrect.
Whereas if you load a png with 8 bits, then the color matches extremely closely.
This is your best best for now using images. Will check font now and edit this post when done.

I might also remove the SRGB on texture load and do it manually in the shader instead to ensure all texture bit depths are supported.

If you test with these 2 files, then you will see what i mean:

Orange_16bit.png
Orange_16bit.png (301 Bytes) Viewed 6185 times


Orange_8bit.png
Orange_8bit.png (446 Bytes) Viewed 6185 times
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: Menu system

Postby planetX » 13 May 2017, 22:22

ok, I just set the css property "position: absolute;" and it worked, so that was the problem. Also changed to loadFromTemplate to avoid issues. Thanks for the suggestion, it would take ages to figure out myself. :D

The orange in the images looks fine (you can see it in the video)... it is just the text.

My specs: Windows 10 - Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz - 16 Gb ram DDR4 - NVIDIA GeForce GTX 960M 4 Gb

planetX
Skyline Mage
 
Posts: 210
Joined: 28 Nov 2016, 18:27
Skill: 3D Modeller
Skill: Level Designer
Skill: Concept artist
Skill: Great creative
Skill: Programmer

PreviousNext

Return to UI

Who is online

Users browsing this forum: No registered users and 1 guest