Well, thank you very much for putting a label on me. If I seem emo to you that's because I usually quite passionate about things.
I am a human being, not a Terminator, for Christ sake.
Second, I certainly don't share the "code first - think later" approach! If I seem hyperactive - it's just because my mode of work is a “full-time, highly-productive” and it differs from most fan/forum/opensource projects with their lazy attitude and catastrophic lack of time, resulting in one minor build every two years or so... But this doesn't mean I am coding, coding, coding. I try to limit coding time to at most 1/3 of the whole time, because the whole essence of programming is thinking. So currently most of the time I am thinking, thinking, thinking
BTW, "must read" article for every programmer, I am 100% agree with Wil here:
http://www.wilshipley.com/blog/2005/02/ ... every.html
So, that covered, let's go to details.
I don’t think it’s a good idea to put device-dependent code into Image, Font, etc. They don’t need to know about all the ugly device details (and it will be messy to connect them and device together).
They should represent platform and device-independent data. One exception may be the File class (as I have coded it) – this class directly uses PhysFS for reading and writing. But it’s because it is simpler in this case. And PhysFS is already platform-independent.
Then, since Image, Font, etc. must be independent we need to develop our own internal, simple formats for such data. We can’t handle images internally as PNG or anything. Each file format will be decoded by “a format driver”, or loader, into our internal format (for example, very simple, like {Width, Height, BPP, data}).
Next, the way I see the whole architecture. In my opinion, the most flexible way to do it – is to create “drivers” or “plugins” as dynamically-loaded modules. These modules will expose an object (table) and methods to Lua scripts.
For example, if you specify in config the following line:
“use=vid_direct9;snd_direct8;inp_winmsg;usr_game;”
the Love Machine will load these DLL’s (or SO’s) from the “plugins” folder and register them internally. This means that each driver will be available via its own object in Lua, like:
video.setMode(800,600)
snd.playSound(“aaa”)
inp.getMouseX()
etc.
Now you may think that it’s bad to allow drivers to expose any methods they want, but actually it is most simple, unified and flexible configuration. We will need some conventions about most common methods, of course.
User may extend Love functionality by writing his own DLL that will be exposed the very same way to Lua scripts.
I didn’t yet investigated how to make it best technically, but I think it won’t be very hard.
Another thing – about resource identification.
The common practice is to use a special handle, like:
vera = loadFont(“vera.font”)
setFont(vera)
I suggest to use names directly:
load(“vera.font”) // this will call appropriate format driver and automatically create an internal object of type Font. Should be inside Init() function
use(“vera.font”) // this will recognize that this is, indeed, a font and use it correctly.
Enough for now