Comments (7)
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.
Will the PNG library be able to work with it once implemented?
from quipkit.
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.
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.
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.
Very impressive. You're making bounds and leaps here. :)
from quipkit.
Glad you like it. :)
from quipkit.
Related Issues (20)
- Free OpenGL textures used by sprites HOT 2
- New sprite library can't find instance methods HOT 1
- Remove event hooks from game.lua HOT 1
- Add reference documentation for libs HOT 1
- Support more image formats HOT 1
- Improve SFont support with game.lua HOT 1
- sfont.glFont draws text at wrong x position HOT 1
- Let gamelets call hooks in gamelets below it HOT 1
- Game screen doesn't redraw when switching windows HOT 1
- Refactor SDL surface to OpenGL texture conversion HOT 1
- Refactor gamelets to use Lua packages HOT 1
- Add TrueType font support HOT 1
- Add high-level audio API HOT 1
- Sprites turn white after a while HOT 1
- Add asset support
- Build sdlgl for Windows HOT 1
- Compile luagl.dll and luaglu.dll for Windows HOT 1
- lib/sdlgl/sdlgl.c:236 creates table for 1 entry, but has 2
- Rename ltcl.so to libltcl.so and ltk.so to libltk.so
- luasocket doesn't compile on Ubuntu HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quipkit.