Banjo API 1.0.0-rc.2
Low-level C99 game development API
Loading...
Searching...
No Matches
interpolation.c File Reference
#include <banjo/app.h>
#include <banjo/main.h>
#include <banjo/bitmap.h>
#include <banjo/draw.h>
#include <banjo/event.h>
#include <banjo/system.h>
#include <banjo/window.h>
Include dependency graph for interpolation.c:

Go to the source code of this file.

Macros

#define WIDTH   640
#define HEIGHT   360
#define BALL_R   24
#define SPEED   320.0f /* pixels per second */
#define FIXED_HZ   10 /* deliberately low so the stutter is obvious */
#define TOP_Y   120 /* smooth (interpolated) ball */
#define BOT_Y   240 /* raw (un-interpolated) ball */

Functions

static void fixed_step (struct bj_app *app, struct bj_tick_info tick, void *ud)
static void on_draw (struct bj_window *w, struct bj_render_target *target, const struct bj_rect *dirty, void *user_data)
static void step (struct bj_app *app, struct bj_tick_info tick, void *user_data)
static void * setup (struct bj_app *app, void *init_data)
static void teardown (struct bj_app *app, void *user_data)
int main (int argc, char *argv[])

Variables

static bj_windowwindow = 0
static float prev_x
static float curr_x
static float vx = 320.0f
static float render_alpha

Macro Definition Documentation

◆ BALL_R

#define BALL_R   24
Examples
interpolation.c, and pong.c.

Definition at line 57 of file interpolation.c.

Referenced by draw(), fixed_step(), on_draw(), setup(), and update().

◆ BOT_Y

#define BOT_Y   240 /* raw (un-interpolated) ball */
Examples
interpolation.c.

Definition at line 61 of file interpolation.c.

Referenced by on_draw().

◆ FIXED_HZ

#define FIXED_HZ   10 /* deliberately low so the stutter is obvious */
Examples
interpolation.c.

Definition at line 59 of file interpolation.c.

Referenced by setup().

◆ HEIGHT

#define HEIGHT   360
Examples
interpolation.c.

Definition at line 56 of file interpolation.c.

Referenced by setup().

◆ SPEED

#define SPEED   320.0f /* pixels per second */
Examples
interpolation.c.

Definition at line 58 of file interpolation.c.

Referenced by fixed_step().

◆ TOP_Y

#define TOP_Y   120 /* smooth (interpolated) ball */
Examples
interpolation.c.

Definition at line 60 of file interpolation.c.

Referenced by on_draw().

◆ WIDTH

#define WIDTH   640
Examples
interpolation.c.

Definition at line 55 of file interpolation.c.

Referenced by fixed_step(), and setup().

Function Documentation

◆ fixed_step()

void fixed_step ( struct bj_app * app,
struct bj_tick_info tick,
void * ud )
static
Examples
interpolation.c, physics_kinematics.c, and physics_particle.c.

Definition at line 80 of file interpolation.c.

Referenced by bj_run_app(), and main().

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 142 of file interpolation.c.

◆ on_draw()

void on_draw ( struct bj_window * w,
struct bj_render_target * target,
const struct bj_rect * dirty,
void * user_data )
static

Definition at line 88 of file interpolation.c.

◆ setup()

void * setup ( struct bj_app * app,
void * init_data )
static

Definition at line 121 of file interpolation.c.

◆ step()

void step ( struct bj_app * app,
struct bj_tick_info tick,
void * user_data )
static

Definition at line 110 of file interpolation.c.

◆ teardown()

void teardown ( struct bj_app * app,
void * user_data )
static

Definition at line 136 of file interpolation.c.

Variable Documentation

◆ curr_x

float curr_x
static
Examples
interpolation.c.

Definition at line 69 of file interpolation.c.

Referenced by fixed_step(), on_draw(), and setup().

◆ prev_x

float prev_x
static
Examples
interpolation.c.

Definition at line 68 of file interpolation.c.

Referenced by fixed_step(), on_draw(), and setup().

◆ render_alpha

float render_alpha
static
Examples
interpolation.c.

Definition at line 76 of file interpolation.c.

Referenced by on_draw(), and step().

◆ vx

float vx = 320.0f
static
Examples
interpolation.c.

Definition at line 70 of file interpolation.c.

Referenced by fixed_step().

◆ window

bj_window* window = 0
static

Definition at line 63 of file interpolation.c.