C++ Logo

sg13

Advanced search

Re: [SG13] Device info and acquisition: some suggestions of API design directions.

From: Rene Rivera <grafikrobot_at_[hidden]>
Date: Wed, 31 Jul 2019 13:01:30 -0500
On Wed, Jul 31, 2019 at 12:16 PM Tony V E via SG13 <sg13_at_[hidden]>
wrote:

>
> On Wed, Jul 31, 2019 at 9:40 AM Klaim - Joël Lamotte via SG13 <
> sg13_at_[hidden]> wrote:
>
>>
>> 3. Device information should always be acquired through callbacks and
>> helpers built around them.
>>
>>
> Not always. For some devices, this would require polling, as the device
> doesn't have a push model.
>

+1
That's just about all devices game devs care about.


> Also think of a device connected over a network - do you want a constant
> data stream, or just get data when needed.
>
> I guess pull-model devices could use a callback model where you set up the
> callbacks and then call device.check_for_changes() or something like that.
>

They could, and in game dev we mostly achieve that through an event system.
But really important: If you are going to mandate the push model, please
also mandate that it be externally driven. Not having control over that
causes all kinds of nightmare concurrency interactions (I'm looking at you
UIKit).

-- 
-- Rene Rivera
-- Grafik - Don't Assume Anything
-- Robot Dreams - http://robot-dreams.net

Received on 2019-07-31 13:03:39