D:/WorkAround/prequengine/trunk/src/sdlengine.c File Reference

This file contains SDL engine routines. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <SDL/SDL.h>
#include <SDL/SDL_thread.h>
#include <SDL/SDL_mixer.h>
#include "sdlengine.h"
#include "main.h"
#include "images.h"
#include "music.h"
#include "lbaengine.h"
#include "debug.h"

Include dependency graph for sdlengine.c:

Go to the source code of this file.

Defines

#define ORIGINAL_GAME_FREQUENCY   11025
#define HIGH_QUALITY_FREQUENCY   44100

Functions

static void atexit_callback (void)
void sdl_close ()
int sdl_initialize ()
void fps_cycles (int fps)
void delay (unsigned int time)
void set_palette (unsigned char *palette)
void fade_black_2_white ()
void flip ()
void copy_block_phys (int left, int top, int right, int bottom)
void init_screen_buffer (unsigned char *buffer, int width, int height)
void cross_fade (unsigned char *buffer, unsigned char *palette)
void toggle_fullscreen ()
void read_keys ()

Variables

SDL_Surface * screen = NULL
SDL_Surface * screenBuffer = NULL
SDL_Color screenColors [256]
SDL_Surface * surfaceTable [16]
short int skipedKey
short int pressedKey
short int skipIntro
short int currentKey
short int key


Detailed Description

This file contains SDL engine routines.

Prequengine: a Little Big Adventure engine

Copyright (C) 2008 Prequengine team
Copyright (C) 2002-2007 The TwinEngine team

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

Definition in file sdlengine.c.


Define Documentation

#define HIGH_QUALITY_FREQUENCY   44100

High quality audio frequency

Definition at line 50 of file sdlengine.c.

Referenced by sdl_initialize().

#define ORIGINAL_GAME_FREQUENCY   11025

Original audio frequency

Definition at line 48 of file sdlengine.c.

Referenced by sdl_initialize().


Function Documentation

static void atexit_callback ( void   )  [static]

SDL exit callback

Definition at line 79 of file sdlengine.c.

References stop_midi_music(), and stop_track_music().

Referenced by sdl_close().

void copy_block_phys ( int  left,
int  top,
int  right,
int  bottom 
)

Blit surface in the screen in a determinate area

Parameters:
left left position to start copy
top top position to start copy
right right position to start copy
bottom bottom position to start copy

Definition at line 264 of file sdlengine.c.

References screen, and screenBuffer.

Referenced by draw_button_gfx(), and flip_redraw_areas().

void cross_fade ( unsigned char *  buffer,
unsigned char *  palette 
)

Cross fade feature

Parameters:
buffer screen buffer
palette new palette to cross fade

Definition at line 289 of file sdlengine.c.

References delay(), screen, SCREEN_HEIGHT, SCREEN_WIDTH, and surfaceTable.

Referenced by fade_in(), play_fla_movie(), and redraw_engine_actions().

void delay ( unsigned int  time  ) 

Deplay certain seconds till proceed

Parameters:
time time in seconds to delay

Definition at line 209 of file sdlengine.c.

References lbaTime, read_keys(), and skipIntro.

Referenced by adeline_logo(), cross_fade(), and load_image_delay().

void fade_black_2_white (  ) 

Fade screen from black to white

Definition at line 237 of file sdlengine.c.

References screen.

void flip (  ) 

Blit surface in the screen

Definition at line 253 of file sdlengine.c.

References screen, and screenBuffer.

Referenced by advoptions_menu(), main_menu(), options_menu(), play_fla_movie(), redraw_engine_actions(), savemanage_menu(), and volume_menu().

void fps_cycles ( int  fps  ) 

Frames per second sdl delay

Parameters:
fps frames per second

Definition at line 201 of file sdlengine.c.

References lbaTime.

Referenced by draw_button(), fade_2_black(), fade_2_pal(), game_engine_loop(), giveup_menu(), main_menu(), and play_fla_movie().

void init_screen_buffer ( unsigned char *  buffer,
int  width,
int  height 
)

Create SDL screen surface

Parameters:
buffer screen buffer to blit surface
width screen width size
height screen height size

Definition at line 281 of file sdlengine.c.

References SCREEN_WIDTH, and screenBuffer.

Referenced by allocate_video_memory().

void read_keys (  ) 

Handle keyboard pressed keys

Definition at line 361 of file sdlengine.c.

References leftMouse, pressedKey, pressedKeyCharMap, pressedKeyMap, rightMouse, skipedKey, skipIntro, and toggle_fullscreen().

Referenced by delay(), play_fla_movie(), process_menu(), and run_game_engine().

void sdl_close (  ) 

Close everything in the game

Definition at line 88 of file sdlengine.c.

References atexit_callback(), stop_midi_music(), and stop_track_music().

Referenced by main(), and sdl_initialize().

int sdl_initialize (  ) 

SDL initializer

Returns:
SDL init state

Definition at line 97 of file sdlengine.c.

References cfgfile, ConfigFile::Debug, HIGH_QUALITY_FREQUENCY, ORIGINAL_GAME_FREQUENCY, screen, SCREEN_HEIGHT, SCREEN_WIDTH, sdl_close(), surfaceTable, and ConfigFile::UseHQSnd.

Referenced by init_engine().

void set_palette ( unsigned char *  palette  ) 

Set a new palette in the SDL screen buffer

Parameters:
palette palette to set

Definition at line 227 of file sdlengine.c.

References screen, and screenBuffer.

Referenced by adjust_palette(), black_2_white(), fade_2_pal(), load_image(), load_menu_image(), play_fla_movie(), set_back_pal(), and toggle_fullscreen().

void toggle_fullscreen (  ) 

Switch between window and fullscreen modes

Definition at line 337 of file sdlengine.c.

References cfgfile, convert_pal_2_RGBA(), copy_screen(), frontVideoBuffer, ConfigFile::FullScreen, palette, paletteRGBA, screen, SCREEN_HEIGHT, SCREEN_WIDTH, set_palette(), and workVideoBuffer.

Referenced by init_engine(), and read_keys().


Variable Documentation

short int currentKey

Current key value

Definition at line 70 of file sdlengine.c.

short int key

Auxiliar key value

Definition at line 72 of file sdlengine.c.

Referenced by process_menu().

short int pressedKey

Pressed key - printTextVar12

Definition at line 65 of file sdlengine.c.

Referenced by process_menu(), and read_keys().

SDL_Surface* screen = NULL

Main SDL screen surface buffer

Definition at line 53 of file sdlengine.c.

Referenced by copy_block_phys(), cross_fade(), draw_character(), fade_black_2_white(), flip(), sdl_initialize(), set_palette(), and toggle_fullscreen().

SDL_Surface* screenBuffer = NULL

Auxiliar SDL screen surface buffer

Definition at line 55 of file sdlengine.c.

Referenced by copy_block_phys(), flip(), init_screen_buffer(), and set_palette().

SDL_Color screenColors[256]

SDL screen color

Definition at line 57 of file sdlengine.c.

short int skipedKey

Skipped key - key1

Definition at line 63 of file sdlengine.c.

Referenced by process_menu(), and read_keys().

short int skipIntro

Skip intro variable

Definition at line 68 of file sdlengine.c.

Referenced by delay(), play_fla_movie(), process_menu(), read_keys(), redraw_engine_actions(), run_game_engine(), and show_giveup_menu().

SDL_Surface* surfaceTable[16]

Auxiliar surface table

Definition at line 59 of file sdlengine.c.

Referenced by cross_fade(), and sdl_initialize().


Generated on Thu Sep 18 14:14:49 2008 for Prequengine by  doxygen 1.5.5