Giter VIP home page Giter VIP logo

Comments (7)

tung avatar tung commented on August 23, 2024

I'll get right on it.

EDIT: I'll need to:

  • make some sort of userdata handle to SDL_Surface structs
  • return the screen surface for SetVideoMode
  • implement BlitSurface, LoadBMP and Flip so I can tell it's all working

from quipkit.

DaVince avatar DaVince commented on August 23, 2024

Will the PNG library be able to work with it once implemented?

from quipkit.

tung avatar tung commented on August 23, 2024

Not for a while: this is really complicated.

I think SDL_Surface is the biggest struct in SDL, so getting it into Lua is a great deal of work. Some SDL_Surfaces must be freed, others must not be, complicating GC. It has a dumb pixel store, meaning that anything you put in there needs to be manually translated into the surface's pixel format, PNGs included. Plus that pixel format is itself another struct. And the non-trivial bitflag-to-Lua-table conversion is going to take quite a while on both of those structs.

For now, I'm putting in just BMP support, because it's built into SDL, skipping the whole pixel format situation that could take dozens of special cases to get right.

from quipkit.

tung avatar tung commented on August 23, 2024

Add very early SDL_Surface support. Closed by 12036cc.

  • SDL functions added: BlitSurface, Flip, FreeSurface, LoadBMP.
  • SetVideoMode now returns an SDL surface usable with the above
    functions.
  • New test: test/blit.lua shows a square smiley for a few seconds.
  • Many things not implemented yet, like loading PNGs into
    surfaces, getting surface flags, width/height, clipping rect.
  • There's no way to access the surface pixel format or pixels
    either. Thought needs to be put into the design.
  • I'm considering porting an existing Lua/SDL binding library. I
    don't want engine development to swamp the project.

from quipkit.

tung avatar tung commented on August 23, 2024

It has a dumb pixel store, meaning that anything you put in there needs to be manually translated into the surface's pixel format, PNGs included.

Actually, it looks like SDL_CreateRGBSurfaceFrom performs some conversion from raw pixel data, so PNG support may be doable after all. Create a new issue if you want it.

from quipkit.

DaVince avatar DaVince commented on August 23, 2024

Very impressive. You're making bounds and leaps here. :)

from quipkit.

tung avatar tung commented on August 23, 2024

Glad you like it. :)

from quipkit.

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.