[Scummvm-devel] OSystem API?

Max Horn max at quendi.de
Fri Aug 1 15:31:03 CEST 2003


Am Samstag, 02.08.03 um 00:01 Uhr schrieb Marcus Comstedt:

[...]

First off, note that I didn't "design" this API (I don't think it was 
designed anyway, it grew :-)


> Which reminds me.  Would you like to clarify the semantic difference
> between these two?  On the Dreamcast, they will both currently move
> the mouse pointer to the specified position.  Should one of them do
> something else?  In that case, what and why?  The comments in system.h
> says that "set_mouse_pos only informs the backend of the mouse
> cursor's current position", but that doesn't make any sense; the
> engine only knows the mouse cursor's current position because the
> backend informed it in the first place, so the notion that the backend
> should be "informed" about this is absurd.
>
It's only absurd if your system's mouse cursor = the game engine mouse 
cursor. Which might be the case on Dreamcast and Intent, but isn't the 
case in the SDL backend. In the case of SDL, the system's mouse cursor 
is hidden, and inside the game window a mouse cursor is drawn at the 
position where the hidden HW cursor is. set_mouse_pos() affects the 
position of this "soft" mouse cursor, while warp_mouse modifies the 
position of the "real" mouse cursor.

Now you could still argue "why is set_mouse_pos" necessary. Well, maybe 
it isn't necessary any more. Historically, ScummVM only had a SDL 
backend, and there we always had to draw a "soft" cursor. Then later 
the backend API was abstracted via OSystem, but the OSystem API was 
very closely tied to the way SDL worked (since initially it was the 
only backend, this is no surprise to me). So back then, it probably 
made sense to keep this.
Nowadays, we probably could get rid of set_mouse_pos and require the 
backend to move the mouse cursor appropriately (no matter whether it is 
virtual or real). Techincally speaking, the abstraction level would be 
rised by this. But I say "probably" because I can only speak for the 
Scumm part of the code, and only for the SDL backend. But I don't 
believe there are any problems in the rest of the front&backends


Cheers,

Max





More information about the Scummvm-devel mailing list