Jump to content

[SHOWCASE] All of the little things...


Recommended Posts

Post here with all of your code-related achievements, no matter how minor they may be. Got a cool little command made that shows some elegant new feature? Show it off! I'm posting this here because I know that there's been a lot of big advances lately, and minor little bits of polish are always fun to work on.

Screenshots and/or code shown are required.

Link to comment

Here's an example of something new that I have been working on.

 

UI code in particular is something I've been very fond of working on. Despite the code being extremely messy, it provides a very immediate and noticeable effect most of the time. Plus, a lot of the stuff is really cool to tinker with.

In JKG, we had the nasty little issue of sliders. And I friggin hate how JKA handles sliders. So I decided to make .menu files able to customize sliders for listbox objects better.

 

Before:

 

 

JKG%20server%20browser.png

 

 

 

After:

 

 

cool-slider-bar-thing.png

 

 

 

And here's a sample of the listbox object that shows the server data:

 

 

itemDef
{
name serverlist
rect 10 112 620 264
type ITEM_TYPE_LISTBOX
style WINDOW_STYLE_FILLED
elementwidth 120
elementheight 26
font 5
textscale 0.4
textaligny 6
elementtype LISTBOX_TEXT
feeder FEEDER_SERVERS
outlinecolor 1 1 1 .25 //Highlight when item is selected.
visible 1
columns 5 2 40 258 270 40 104 388 5 64 450 20 100 560 20 47
mouseenter
{
setitemcolor serverlist bordercolor .79 .64 .22 1
}
mouseexit
{
setitemcolor serverlist bordercolor 0.2 0.3 0.5 0.5
}
doubleClick
{
uiScript checkpassword
}

// new listbox slider-thingy --eez
useNewSlider // use new slider code
noSliderButtons // do not use up/down arrow buttons
floatingSlider // the background of the slider is
// independent of the thumb
sliderBackground "gfx/ui/mainsub_sliderbarVert" // background shader
foreground "gfx/ui/mainsub_sliderbarVert" // thumb shader
sliderThumbW 15 // thumb width
sliderThumbH 45 // thumb height
sliderBackgroundH 290 // background width (floating only)
sliderBackgroundW 15 // background height (floating only)
sliderTop 124 // slider top Y (floating only)
sliderBottom 360 // slider bottom Y (floating only)
}

 

Sorry for mangled formating.

 

 

I'd like to refactor my code someday for tooltips, so we can do something like this in the itemDef:

 

 

tooltip {
    type TOOLTIP_INVENTORY
}

(for hardcoded tooltips)

 

-or-

 

tooltip {
    type TOOLTIP_CUSTOM
    text "Aim down the sights to improve accuracy.\n^7(default: ^3Mouse 2^7)"
}
Stoiss likes this
Link to comment

 

Here's an example of something new that I have been working on.

 

UI code in particular is something I've been very fond of working on. Despite the code being extremely messy, it provides a very immediate and noticeable effect most of the time. Plus, a lot of the stuff is really cool to tinker with.

In JKG, we had the nasty little issue of sliders. And I friggin hate how JKA handles sliders. So I decided to make .menu files able to customize sliders for listbox objects better.

 

Before:

 

 

JKG%20server%20browser.png

 

 

 

After:

 

 

cool-slider-bar-thing.png

 

 

 

And here's a sample of the listbox object that shows the server data:

itemDef
{
name serverlist
rect 10 112 620 264
type ITEM_TYPE_LISTBOX
style WINDOW_STYLE_FILLED
elementwidth 120
elementheight 26
font 5
textscale 0.4
textaligny 6
elementtype LISTBOX_TEXT
feeder FEEDER_SERVERS
outlinecolor 1 1 1 .25 //Highlight when item is selected.
visible 1
columns 5 2 40 258 270 40 104 388 5 64 450 20 100 560 20 47
mouseenter
{
setitemcolor serverlist bordercolor .79 .64 .22 1
}
mouseexit
{
setitemcolor serverlist bordercolor 0.2 0.3 0.5 0.5
}
doubleClick
{
uiScript checkpassword
}

// new listbox slider-thingy --eez
useNewSlider // use new slider code
noSliderButtons // do not use up/down arrow buttons
floatingSlider // the background of the slider is
// independent of the thumb
sliderBackground "gfx/ui/mainsub_sliderbarVert" // background shader
foreground "gfx/ui/mainsub_sliderbarVert" // thumb shader
sliderThumbW 15 // thumb width
sliderThumbH 45 // thumb height
sliderBackgroundH 290 // background width (floating only)
sliderBackgroundW 15 // background height (floating only)
sliderTop 124 // slider top Y (floating only)
sliderBottom 360 // slider bottom Y (floating only)
}

Sorry for mangled formating.

 

 

I'd like to refactor my code someday for tooltips, so we can do something like this in the itemDef:

tooltip {
    type TOOLTIP_INVENTORY
}

(for hardcoded tooltips)

 

-or-

tooltip {
    type TOOLTIP_CUSTOM
    text "Aim down the sights to improve accuracy.\n^7(default: ^3Mouse 2^7)"
}

 

Woot! Nice work!

Link to comment

Well, I made this some years back:

 

Although its significance and difficulty has become a lot smaller now that we have the full source. But it was a nice feature.

 

I have another video that explains it, but the tldr: Made a way to dynamically add new brush models to the game, and used it for more accurate collision.

Circa likes this
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...