source: soft/giet_vm/applications/raycast/ctrl.c @ 707

Last change on this file since 707 was 673, checked in by guerin, 9 years ago

raycast: initial port

Raycast is a small game that looks like Wolfenstein 3D. I created
it for my SESI project, on a Cortex M4 devboard.

Imported from
github.com/libcg/tiva-c/tree/master/boards/dk-tm4c129x/upmc_raycast

File size: 855 bytes
Line 
1#include "ctrl.h"
2#include <math.h>
3
4// Exported functions
5
6void ctrlLogic(Game *game)
7{
8        game->player.dir += PLAYER_ROT;
9
10/*
11    if (g_tsTouch) {
12        if (g_tsX > 2 * SCREEN_WIDTH / 3) {
13            // Turn right
14            game->player.dir += PLAYER_ROT;
15        }
16        else if (g_tsX < 1 * SCREEN_WIDTH / 3) {
17            // Turn left
18            game->player.dir -= PLAYER_ROT;
19        }
20        if (g_tsY > 2 * SCREEN_HEIGHT / 3) {
21            // Move forward
22            game->player.x -= PLAYER_MOVE * cosf(game->player.dir);
23            game->player.y -= PLAYER_MOVE * sinf(game->player.dir);
24        }
25        else if (g_tsY < 1 * SCREEN_HEIGHT / 3) {
26            // Move backwards
27            game->player.x += PLAYER_MOVE * cosf(game->player.dir);
28            game->player.y += PLAYER_MOVE * sinf(game->player.dir);
29        }
30    }
31*/
32}
Note: See TracBrowser for help on using the repository browser.