annotate include/mb_so.h @ 657:32d0eef1ee46

Force type-casting for member variables. For some member that need a casting for the type is that what we want. For example, casting a void * type to a struct pointer type. This force will skip type checking, but it works for the variables with a generic type and we want to specialize its type.
author Thinker K.F. Li <thinker@branda.to>
date Sat, 31 Jul 2010 14:37:19 +0800
parents 6f63aa67ed83
children 586e50f82c1f
rev   line source
209
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
1 /*! \file
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
2 * \brief Define types for sprite shared objects.
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
3 *
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
4 * A sprite shared object includes definitions of multiple sprite factories.
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
5 * Sprite factories are used to create sprites for MadButterfly.
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
6 *
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
7 * \see http://en.wikipedia.org/wiki/Sprite_(computer_graphics)
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
8 */
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
9 #ifndef __MB_SO_H_
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
10 #define __MB_SO_H_
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
11
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
12 /*! \brief Name of the variable that define contents in a shared object. */
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
13 #define MB_SPRITE_SO_SYM "mb_sprite_so_def"
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
14
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
15 typedef struct _mb_sprite_so mb_sprite_so_t;
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
16 typedef struct _sprite_factory sprite_factory_t;
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
17
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
18
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
19 /*! \brief Define content of a sprite shared object.
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
20 *
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
21 * The type of symbol with name, defined by \ref MB_SPRITE_SO_SYM, in
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
22 * a sprite shared object. It define content of a sprite object, a.k.a.
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
23 * an array of sprite factories (\ref sprite_factory_t).
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
24 */
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
25 struct _mb_sprite_so {
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
26 const char *soname;
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
27 int num_factories;
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
28 sprite_factory_t *factories;
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
29 };
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
30
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
31 /*! \brief Define a factory to create sprites.
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
32 */
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
33 struct _sprite_factory {
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
34 const char *name;
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
35 sprite_t *(*new)(coord_t*);
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
36 };
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
37
6f63aa67ed83 Define types for sprite shared object.
Thinker K.F. Li <thinker@branda.to>
parents:
diff changeset
38 #endif /* __MB_SO_H_ */