Re: SFML2 Demo Dilema
- Posted by Shian_Lee May 09, 2015
- 2631 views
The problem with wrapping the sfVideoMode and sfEvent is that they're structs. I'm not exactly sure how I'd go about wrapping structs.
I'm not a C programmer and I never had time to use it (some people still have to pick tomatoes...), so I've never used a C struct.
But long time ago, when memory was very limited, I had to create my own efficient data type in BASIC. So I've created a very short library with about 5 functions, that accepts a string argument, start_bit argument, and end_bit argument, for example:
data = "xyz"
data string was treated by my library simply as 24 bits (3 bytes * 8 bits).
if start_bit,end_bit arguments were, for example 6,12 then my library returned an integer of 7 bits (bits 6,7,8,9,10,11,12), which actually started at the first byte ('x') and ended at the second byte ('y').
This library was very short and efficient, using only a fast bit manipulation code.
In this way I could store in a string of any length, as many variables as I needed, including single bits, nibbles, integers, floating points (in IEEE format), other strings, actually any type of variable that exists on earth.
Creating such library is very easy, you need only few utility functions to create, modify, retrieve, and even search for specific data within a string (string in this case is treated at the bit level of course).
I don't know how complex is your C struct. But with that library I did magics, in memory and on disk.