2018-02-16 18:11:26 +01:00
|
|
|
/*
|
|
|
|
* BreakHack - A dungeone crawler RPG
|
|
|
|
* Copyright (C) 2018 Linus Probert <linus.probert@gmail.com>
|
|
|
|
*
|
|
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2017-12-01 16:03:19 +01:00
|
|
|
#ifndef CAMERA_H_
|
|
|
|
#define CAMERA_H_
|
|
|
|
|
2018-02-21 00:29:21 +01:00
|
|
|
#include <SDL.h>
|
2017-12-03 11:09:57 +01:00
|
|
|
|
2017-12-01 16:03:19 +01:00
|
|
|
#include "position.h"
|
2018-05-13 23:32:44 +02:00
|
|
|
#include "timer.h"
|
|
|
|
#include "vector2d.h"
|
2017-12-01 16:03:19 +01:00
|
|
|
|
2018-07-09 19:26:06 +02:00
|
|
|
typedef struct Camera {
|
2017-12-01 16:03:19 +01:00
|
|
|
Position pos;
|
2018-05-13 23:32:44 +02:00
|
|
|
Position basePos;
|
|
|
|
Vector2d velocity;
|
|
|
|
Timer *shakeTimer;
|
2017-12-01 16:03:19 +01:00
|
|
|
SDL_Renderer *renderer;
|
|
|
|
} Camera;
|
|
|
|
|
2018-05-13 23:32:44 +02:00
|
|
|
Camera*
|
|
|
|
camera_create(SDL_Renderer*);
|
2017-12-01 16:03:19 +01:00
|
|
|
|
2018-05-13 23:32:44 +02:00
|
|
|
Position
|
|
|
|
camera_to_camera_position(Camera *cam, Position *pos);
|
|
|
|
|
|
|
|
void
|
|
|
|
camera_follow_position(Camera*, Position*);
|
|
|
|
|
|
|
|
void
|
|
|
|
camera_update(Camera *, float deltatime);
|
|
|
|
|
|
|
|
void
|
|
|
|
camera_shake(Vector2d dir, int intensity);
|
|
|
|
|
|
|
|
void
|
|
|
|
camera_destroy(Camera *);
|
2017-12-03 11:09:57 +01:00
|
|
|
|
2017-12-01 16:03:19 +01:00
|
|
|
#endif // CAMERA_H_
|