Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port DmIcon & Image components from TG #26623

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AyIong
Copy link
Contributor

@AyIong AyIong commented Aug 29, 2024

What Does This PR Do

Ports DmIcon from tgstation/tgstation#82533 and early_assets subsystem for it
And Image components from TG (Didn't find PR)

Replacing base64 sprites generated during init with DmIcon in Stack Craft (GrayScale sprites still generates, but it's okay, instead of 300+ icon2base64 calls in Stack Craft, it comes out to about 14)
Replacing Assets with DmIcon in Prize Counter

Added DmIcon support to ImageButton and replaced with Image component

Why It's Good For The Game

The most modern, convenient and fastest way to add any image to the TGUI
So how do I add an image? VERY easy! You just need to pass icon and icon_state of the object to TGUI, and use them in DmIcon or ImageButton
No need to generate images anymore (Unless they are grayscale or built from overlays).

Images of changes

Nothing to show, result the same, maybe UI's shown a little faster, cause it doesn't need to wait images, they load async
But, can show icon2base64 overtime before and after

Before After
image image

Testing

Very many times opened Ui's using DmIcon and normal Image with Assets (Before removing Assets from Prize Counter)
Also tested on Byond 516 with CPU slowdown 20x and in SmartFridge with test UI (Reverted but video bellow)

Smartfridge test UI
dreamseeker_Ex6OdZTnmf.mp4

I fixed all the problems I noticed, but maybe I missed some small things as usual.


Declaration

  • I confirm that I either do not require pre-approval for this PR, or I have obtained such approval and have included a screenshot to demonstrate this below.

Changelog

NPFC

@ParadiseSS13-Bot ParadiseSS13-Bot added -Status: Awaiting type assignment This PR is waiting for its type to be assigned internally TGUI This PR modifies TGUI, will conflict labels Aug 29, 2024
@ParadiseSS13-Bot ParadiseSS13-Bot added -Status: Awaiting review This PR is awaiting review from the review team and removed -Status: Awaiting type assignment This PR is waiting for its type to be assigned internally labels Aug 30, 2024
@github-actions github-actions bot added the Merge Conflict This PR is merge conflicted label Sep 3, 2024
Copy link
Contributor

@lewcc lewcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know too much about what's going on here tbh, just some questions

code/game/objects/items/stacks/stack.dm Show resolved Hide resolved
return GLOB.asset_datums[type] || new type()

/proc/get_asset_datum(type)
var/datum/asset/loaded_asset = GLOB.asset_datums[type] || new type()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth saving this new value to cache if it doesn't exist?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, just copied that from TG.
It just works™️

Works pretty good btw

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Status: Awaiting review This PR is awaiting review from the review team Merge Conflict This PR is merge conflicted TGUI This PR modifies TGUI, will conflict
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants