GithubHelp home page GithubHelp logo

Custom Resource loader about tgui HOT 4 CLOSED

texus avatar texus commented on May 30, 2024
Custom Resource loader

from tgui.

Comments (4)

texus avatar texus commented on May 30, 2024

Moving the resource handing out of the widgets has one big problem: the texture manager.
If you load with custom code then the texture manager can't keep track of what you have loaded already and which part it still has to read from the disk.

I have been thinking about this before. The best option probably to provide a method to pass a sf::Texture instead of a filename. Then you just have to store the sf::Texture yourself and keep it alive.

I will be looking at theme files in v0.7 anyway.
I am already planning to allow custom loaders. You would be able to load the theme file yourself (thus choose your own syntax) and then pass the needed information to the widget renderer.
This would allow you to load stuff from the zip archive yourself, load it in a Texture and then pass that Texture to tgui (you will probably have to keep the texture alive yourself somehow).
But writing such a loader would contain pretty ugly code. But at least it would be reusable by other people and it allows doing custom stuff.

from tgui.

fkrauthan avatar fkrauthan commented on May 30, 2024

Yeah or you implement a standard loader within the GUI library which still works with a simple Resource folder variable and manages the textures. And if people like me need there own loader they have to take care of that. (Most game developers have a TextureManager anyways so there is no real need for the GUI library to implement it too).

from tgui.

texus avatar texus commented on May 30, 2024

Since tgui v0.7 will come with a built-in white theme which doesn't require any external images, it should be doable to move the loading code (and perhaps also the texture manager) to a separate file which you include optionally.

There will probably be almost a year between now and the actual implementation. I will just see what I end up with, so many other changes have to be made first.

from tgui.

texus avatar texus commented on May 30, 2024

It hasn't really been tested yet, but this should be possible with the new loading system.

from tgui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.