render.c File Reference

The C source file for a fairly optimized 2D rendering system built on SDL. More...

#include "render.h"
#include <string.h>
#include <stdlib.h>
#include <assert.h>

Include dependency graph for render.c:

Go to the source code of this file.

Data Structures

struct  UpdateList_t
 Contains a list of rectangles that must be updated. More...

Defines

#define _restrict_
#define rounddivup(n, d)   ((((n) % (d)) > 0) ? ((int)(n) / (d) + 1) : ((int)(n) / (d)))

Functions

void AddRenderItem (RenderItem *item, int layer)
 Adds a new RenderItem to the world list of a Layer.
static void AddToUpdateLists (RenderItem *item, SDL_Rect *rect)
 Adds a rectangle to the update lists.
void ClearRenderItem (RenderItem *item)
 Makes an item no longer visible until the next PlaceRenderItem() call on the item.
static Bool FindNextCollision (RenderItem *item)
 Finds the next rectangle in the update list that the given item collides with and sets the physDest field to the overlapping region.
void ForceDirtyFrame ()
 Set the dirty flag to force the renderer to perform a partial redraw for the next frame.
void ForceRenderAll ()
 Force everything to be redrwan for the next frame.
void GenericSurfaceRenderer (SDL_Surface *dest, RenderItem *item)
 Renders a surface pointed to by item->data.
void PlaceRenderItem (RenderItem *item)
 Places a render item on the physical display based on information set within the item.
void RemoveRenderItem (RenderItem *item)
 Removes a RenderItem from a Layer.
void Render ()
 Renders a frame.
void RenderClearStates (Uint8 numStates)
 Clears all display state information and optionally changes the number of states to use.
Bool RenderInit (Uint16 numRects, Uint8 numStates)
 Initalizes the rendering system.
void RenderUninit ()
 Uninitializes the rendering system.
Bool RenderWillRenderAll ()
 Tells if the next call to Render() will render an entire frame rather than just a changed portion.
Bool ResizeWindow (Uint16 w, Uint16 h)
 A utility function for resizing the program's window.
void SetLayerOffset (Layer *layer, Sint16 x, Sint16 y)
 Changes the layer's offset from the physical display.
void SolidFillRenderer (SDL_Surface *dest, RenderItem *item)
 Renders a solid rectangle who's color is stored at item->data.

Variables

DisplayInfo_t dInfo
 Global information about the display.
Layer layers [6]
 The global set of Layers.
static struct UpdateList_t updateList
 Contains a list of rectangles that must be updated.
Uint32 videoFlags = 0
 The SDL video flags used in all calls to SDL_SetVideoMode().


Detailed Description

The C source file for a fairly optimized 2D rendering system built on SDL.

Author:
Jeff Jackowski (jeffj@ro.com)
Copyright (C) 2007 Jeff Jackowski

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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Or visit their website at: http://www.gnu.org/

Definition in file render.c.


Define Documentation

#define _restrict_

Definition at line 36 of file render.c.

Referenced by AddToUpdateLists(), FindNextCollision(), PlaceRenderItem(), Render(), and SetLayerOffset().

#define rounddivup ( n,
 )     ((((n) % (d)) > 0) ? ((int)(n) / (d) + 1) : ((int)(n) / (d)))

Definition at line 825 of file render.c.


Variable Documentation

Uint32 videoFlags = 0

The SDL video flags used in all calls to SDL_SetVideoMode().

Definition at line 823 of file render.c.

Referenced by main().


Generated on Mon May 28 04:41:40 2007 for Retro Tank Super Attack by  doxygen 1.5.2