naev 0.11.5
intro.c File Reference

Handles the introduction sequence. More...

#include "intro.h"
#include "array.h"
#include "conf.h"
#include "font.h"
#include "log.h"
#include "menu.h"
#include "music.h"
#include "ndata.h"
#include "nstring.h"
#include "toolkit.h"

Go to the source code of this file.

Data Structures

struct  intro_img_t
 Intro Image: to be displayed to the side of the scrolling. More...
 
struct  intro_cmd_t
 A display command (operation code and operand if applicable). More...
 

Macros

#define INTRO_SPEED   30.
 
#define SIDE_MARGIN   100.
 
#define IMAGE_WIDTH   300.
 

Enumerations

enum  intro_opcode_t { INTRO_TEXT , INTRO_FADEIN , INTRO_FADEOUT }
 The possible display operations. More...
 

Functions

static int intro_load (const char *text)
 Loads the intro stuff.
 
static void intro_cleanup (void)
 Cleans up the intro stuff.
 
static int intro_event_handler (int *stop, double *offset, double *vel)
 Handle user events (mouse clicks, key presses, etc.).
 
static void initialize_image (intro_img_t *img)
 Initialize an intro_img_t to default values.
 
static void load_image (intro_img_t *img, const char *img_file)
 Initialize an intro_img_t to default values.
 
static void intro_fade_image_in (intro_img_t *side, intro_img_t *transition, const char *img_file)
 Fade an image in.
 
static int intro_draw_text (char **const sb_list, int sb_size, int sb_index, double offset, double line_height)
 Draw intro text onto the screen.
 
int intro_display (const char *text, const char *mus)
 Displays the introduction sequence.
 

Variables

static intro_cmd_tintro_cmds = NULL
 
static char * intro_buf = NULL
 
static glFont intro_font
 
static int has_side_gfx = 0
 

Detailed Description

Handles the introduction sequence.

Todo
Allow handling of images and other fancy things once we get them.

Definition in file intro.c.

Macro Definition Documentation

◆ IMAGE_WIDTH

#define IMAGE_WIDTH   300.

Width to reserve for images on the side.

Definition at line 31 of file intro.c.

◆ INTRO_SPEED

#define INTRO_SPEED   30.

Speed of text in characters / second.

Definition at line 29 of file intro.c.

◆ SIDE_MARGIN

#define SIDE_MARGIN   100.

Minimum space on either side of the text.

Definition at line 30 of file intro.c.

Enumeration Type Documentation

◆ intro_opcode_t

The possible display operations.

Enumerator
INTRO_TEXT 

Plain old text.

INTRO_FADEIN 

Operand is an image to appear next to text.

INTRO_FADEOUT 

Fade out the image next to the text.

Definition at line 42 of file intro.c.

Function Documentation

◆ initialize_image()

static void initialize_image ( intro_img_t * img)
static

Initialize an intro_img_t to default values.

img Image to initialize.

Definition at line 140 of file intro.c.

◆ intro_cleanup()

static void intro_cleanup ( void )
static

Cleans up the intro stuff.

Definition at line 125 of file intro.c.

◆ intro_display()

int intro_display ( const char * text,
const char * mus )

Displays the introduction sequence.

text Path of text file to use.

mus Type of music to use (run through music.lua).

Returns
0 on success.

Definition at line 306 of file intro.c.

◆ intro_draw_text()

static int intro_draw_text ( char **const sb_list,
int sb_size,
int sb_index,
double offset,
double line_height )
static

Draw intro text onto the screen.

sb_list List of text lines.

offset For smooth scrolling.

line_height V-space of the font (plus leading).

Returns
Whether to stop. 1 if no text was rendered, 0 otherwise.

Definition at line 274 of file intro.c.

◆ intro_event_handler()

static int intro_event_handler ( int * stop,
double * offset,
double * vel )
static

Handle user events (mouse clicks, key presses, etc.).

stop Whether to stop the intro.

vel How fast the text should scroll.

Definition at line 210 of file intro.c.

◆ intro_fade_image_in()

static void intro_fade_image_in ( intro_img_t * side,
intro_img_t * transition,
const char * img_file )
static

Fade an image in.

side Present image being displayed.

transition Image in transition or on deck.

img_file Path to the image file on disk.

Definition at line 174 of file intro.c.

◆ intro_load()

static int intro_load ( const char * text)
static

Loads the intro stuff.

Definition at line 76 of file intro.c.

◆ load_image()

static void load_image ( intro_img_t * img,
const char * img_file )
static

Initialize an intro_img_t to default values.

img Image to initialize.

img_file Path to the image file on disk.

Definition at line 156 of file intro.c.

Variable Documentation

◆ has_side_gfx

int has_side_gfx = 0
static

Definition at line 60 of file intro.c.

◆ intro_buf

char* intro_buf = NULL
static

Allocated buffer read from the raw intro-file and modified as we split lines.

Definition at line 58 of file intro.c.

◆ intro_cmds

intro_cmd_t* intro_cmds = NULL
static

Array (array.h): Introduction text lines.

Definition at line 57 of file intro.c.

◆ intro_font

glFont intro_font
static

Introduction font.

Definition at line 59 of file intro.c.