This repository has been archived on 2022-10-27. You can view files and clone it, but cannot push or open issues or pull requests.
2022-02-03 22:33:33 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "libmath.hpp"
|
|
|
|
|
|
|
|
class Camera final {
|
|
|
|
public:
|
|
|
|
const Mat44& GetView() const { return viewMat_; }
|
|
|
|
void Move(const Point& offset);
|
|
|
|
void MoveTo(const Point& pos);
|
|
|
|
/* scale screen in [1.0, 2.0] */
|
|
|
|
void Scale(const Point& scale);
|
2022-02-09 16:44:09 +08:00
|
|
|
void SetAnchor(const Point& anchor);
|
2022-02-03 22:33:33 +08:00
|
|
|
bool TryCalcView();
|
2022-02-15 22:50:31 +08:00
|
|
|
const Point& GetPosition() const { return position_; }
|
2022-02-03 22:33:33 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
Mat44 viewMat_;
|
2022-02-05 20:52:01 +08:00
|
|
|
Point position_ = {0, 0};
|
|
|
|
Point scale_ = {1, 1};
|
2022-02-09 16:44:09 +08:00
|
|
|
Point anchor_ = {0, 0};
|
|
|
|
bool dirty_ = true;
|
2022-02-03 22:33:33 +08:00
|
|
|
};
|