summaryrefslogtreecommitdiff
path: root/src/koopatlas/camera.h
blob: 836c81989a8bc7500a7f9a8759f06e1b16cc41b2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __KOOPATLAS_CAMERA_H
#define __KOOPATLAS_CAMERA_H

#include "koopatlas/core.h"

#define STD_ZOOM 2.8f

class dWorldCamera_c : public dBase_c {
	public:
		int onCreate();
		int onDelete();
		int onExecute();
		int onDraw();

		dWorldCamera_c();

		EGG::Screen screen;
		EGG::LookAtCamera camera3d;

		EGG::ProjectOrtho projection2d;
		EGG::LookAtCamera camera2d;

		Vec camPos, camTarget, camUp;

		float currentX, currentY, zoomLevel;

		void calculateScreenGeometry();


		float zoomDivisor, screenLeft, screenTop, screenWidth, screenHeight;

		bool followPlayer;
		void panToBounds(float left, float top, float right, float bottom);
		void panToPosition(float x, float y, float zoom=STD_ZOOM);
		bool panning;
		float panFromX, panFromY, panToX, panToY;
		float panFromZoom, panToZoom;
		float panCurrentStep;
		float panTotalSteps;

		void doStuff(float);
		void generateCameraMatrices();
		void updateCameras();

		static dWorldCamera_c *build();
		static dWorldCamera_c *instance;
};

#endif