RE: [AD] Fwd: Suggestions & Problems

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> Are there default arguments in ANSI C? I could ensure backwards 
> compatibiity 
> by passing a static structure (FLI or FLC?)to the functions. 
> Something like:
> 
> (type) play_fli(FLI *movie = global_struct) { ... }

Not directly. What you should so is pass a NULL pointer for default, in
which case the routine will use a set of default parameters, which should
be a static struct defined in the function (if possible). This should be
the clean way to do it I think.

> > > >2. Maybe Make the frame_rate of the FLI/FLC adjustable.
> >
> >yup

I was wondering ... Do FLI/FLC files have an embedded frame rate field,
or is Allegro just choosing one arbitrarily ?

> > > >3. Make a set_window_icon(int resource_id) function or
> > > allegro_window_icon.

[...]

> Okay, I can start working on this if no one objects. It should be fairly 
> easy to add.

If you do, please do this by adding an entry in the system driver, put
all these entries to NULL except for windows, which will point to your
routine. This way other platforms can have the same behavior too. X and
BeOS come to mind.

> Yeah, Peter W. told me that the GUI restores the text mode now, 
> but I think 
> it might be useful for the user to have a way to push/pop it too. For my 
> game, I hacked Allegro and made my own.

not sure there. it's a bit application dependant, and while i agree it
would be nice to have it, it requires a stack. dynamically allocating it
for just text mode values seems overkill, and having a fixed size static
stack loses a bit ... and this is only one line of code to add to a
program (and one to change :)).
i'm waiting for other people to give their opinion :)

> MSVC reads the header and source files. When I type "myBitmap.", 
> it pops up 
> a list showing all the members of the struct BITMAP. When I type 
> "myFunction(", it shows the return type, as well as what the pararmeters 
> needed are. When it's all macro-fied, MSVC can't parse the 
> functions, only 
> the struct's.

oh i see what you mean. it's something i found so annoying when it did
that ... (i mean, thrashing two seconds after you type a dot is a tiny
bit annoying when you type fast ^_^)
will it then fail for every program that defines its own macros for
linkage type ? this is pretty common.
in any case, this could get hairy with the file juggling, as you want
the original file to still be there (make clean and friends).

> >i'm not sure if this is good programming practice anyway, since 
> any failure
> >won't be reported, since you can't even try/catch with this kind of
> >objects. you'll have to implement some kind of error query, so you might
> >as well call an init function there.
> >if you really need it, you can call allegro_init if it was not done
> >before (just have a global flag). ugly, but it should work.
> 
> That's a good idea. But would I need a global flag? Doesn't 
> Allegro keep in 
> internal count?

yes, i think so. but this should not be included in Allegro. one, Allegro
is C, and two, static ctors should be used for a good reason. It is easy
enough to do that in your code.

> I think maybe if I #undef _WINDOWS_ it might work. I'll have to see.
Dunno. Can't remember what i did exactly. and it's likely to be something
different in this case anyway.

-- 
Lyrian 



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/