File: scroller.h

package info (click to toggle)
rockdodger 0.9.2-1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,220 kB
  • ctags: 756
  • sloc: ansic: 5,374; makefile: 159; sh: 21
file content (39 lines) | stat: -rw-r--r-- 1,160 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#ifndef __SCROLLER_H_20130126__
#define __SCROLLER_H_20130126__
#include <SDL/SDL_video.h>


typedef struct Scoller_t {
  SDL_Surface *playfield; //!< scroller surface with the whole text
  float position; //!< position of the scroller
  float speed; //!< default speed multiplier per frame
  Sint16 y; //!< at which position is the scroller?
} Scroller_t;

/*!\brief Intialise a scroller structure
 *
 * Frees memory on errors.
 *
 * \param stext text for scroller
 * \param pos y position of the scroller
 * \param defspeed default speed per frame
 * \param visiwidth visible width of the scroller
 * \return pointer to Scroller_t structure or NULL
 */
Scroller_t *init_scroller(const char *stext, Sint16 pos, float defspeed, Uint16 visiwidth);

/*! \brief Free memory of the scroller
 *
 */
void destroy_scroller(Scroller_t *scroller);


/*! \brief Update scroller and draw it on the target surface
 *
 * \param scroller Scroller_t structure pointer
 * \param target Surface to draw on
 * \param speed Speed fraction per frame, 1.0 = exact framerate was hit
 */
void update_and_draw_scroller(Scroller_t *scroller, SDL_Surface *target, float speed);

#endif