Super Derpy: Muffin Attack
 All Classes Files Functions Variables Enumerations Macros
Macros | Functions | Variables
main.c File Reference

Main file of SuperDerpy engine. More...

#include <stdio.h>
#include <math.h>
#include <getopt.h>
#include <locale.h>
#include "menu.h"
#include "loading.h"
#include "about.h"
#include "intro.h"
#include "map.h"
#include "level.h"
#include "pause.h"
#include "disclaimer.h"
#include "config.h"

Macros

#define PRELOAD_STATE(state, name)
 Macro for preloading gamestate.
#define UNLOAD_STATE(state, name)
 Macro for unloading gamestate.
#define LOAD_STATE(state, name)
 Macro for loading gamestate.
#define KEYDOWN_STATE(state, name)   else if (game.gamestate==state) { if (name ## _Keydown(&game, &ev)) break; }
 Macro for sending keydown events to gamestate.
#define DRAW_STATE(state, name)
 Macro for drawing active gamestate.

Functions

void PrintConsole (struct Game *game, char *format,...)
 Print some message on game console.
void DrawConsole (struct Game *game)
 Draws console bitmap on screen.
void PreloadGameState (struct Game *game, void(*progress)(struct Game *, float))
 Preloads gamestate set in game->loadstate.
void UnloadGameState (struct Game *game)
 Unloads gamestate set in game->gamestate.
void LoadGameState (struct Game *game)
 Loads gamestate set in game->loadstate.
void DrawGameState (struct Game *game)
 Draws frame from current gamestate.
void ScaleBitmap (ALLEGRO_BITMAP *source, int width, int height)
 Scales bitmap using software linear filtering method to current target.
ALLEGRO_BITMAP * LoadScaledBitmap (char *filename, int width, int height)
 Loads bitmap into memory and scales it with software linear filtering.
float tps (struct Game *game, float t)
 Draws console bitmap on screen.
int Shared_Load (struct Game *game)
 Load shared resources.
void Shared_Unload (struct Game *game)
 Unload shared resources.
int main (int argc, char **argv)

Variables

double old_time = 0
double fps
int frames_done = 0

Detailed Description

Main file of SuperDerpy engine.


Macro Definition Documentation

#define DRAW_STATE (   state,
  name 
)
Value:
case state:\
name ## _Draw(game); break;

Macro for drawing active gamestate.

#define LOAD_STATE (   state,
  name 
)
Value:
case state:\
PrintConsole(game, "Load %s...", #state); name ## _Load(game); break;

Macro for loading gamestate.

Loading of state means setting it as active and running it.

#define PRELOAD_STATE (   state,
  name 
)
Value:
case state:\
PrintConsole(game, "Preload %s...", #state); DrawConsole(game); al_flip_display(); name ## _Preload(game, progress); break;

Macro for preloading gamestate.

Preloading of state happens when loading screen is displayed.

#define UNLOAD_STATE (   state,
  name 
)
Value:
case state:\
PrintConsole(game, "Unload %s...", #state); name ## _Unload(game); break;

Macro for unloading gamestate.

Unloading of state happens after it's fadeout.


Function Documentation

void PrintConsole ( struct Game game,
char *  format,
  ... 
)

Print some message on game console.

Draws message on console bitmap, so it'll be displayed when calling DrawConsole. If game->debug is true, then it also prints given message on stdout. It needs to be called in printf style.