nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
offscreen.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_OFFSCREEN_H_
2#define NANOMMO_CLIENT_OFFSCREEN_H_
3
4#include <raylib.h>
5
6#include <ostream>
7
8#include "client/animator.h"
9#include "client/renderer.h"
10
11namespace nanommo {
12
13struct Pixel {
14 int r = 0;
15 int g = 0;
16 int b = 0;
17 int a = 0;
18
19 bool operator==(const Pixel&) const = default;
20};
21
22std::ostream& operator<<(std::ostream& out, const Pixel& pixel);
23
24class Offscreen {
25 public:
26 Offscreen(int width, int height);
27 ~Offscreen();
28
29 Offscreen(const Offscreen&) = delete;
30 Offscreen& operator=(const Offscreen&) = delete;
31
32 void Render(const Renderer& renderer);
33
34 void RenderPreview(const Renderer& renderer, const Figure& figure,
35 const Camera3D& camera);
36
37 Texture2D texture() const { return target_.texture; }
38
39 Pixel ReadPixel(int x, int y) const;
40
41 private:
42 RenderTexture2D target_;
43};
44
45} // namespace nanommo
46
47#endif // NANOMMO_CLIENT_OFFSCREEN_H_
void RenderPreview(const Renderer &renderer, const Figure &figure, const Camera3D &camera)
Definition offscreen.cc:21
Offscreen(int width, int height)
Definition offscreen.cc:10
Offscreen(const Offscreen &)=delete
Pixel ReadPixel(int x, int y) const
Definition offscreen.cc:28
void Render(const Renderer &renderer)
Definition offscreen.cc:15
Texture2D texture() const
Definition offscreen.h:37
Offscreen & operator=(const Offscreen &)=delete
Definition chat.cc:9
std::ostream & operator<<(std::ostream &out, const Pixel &pixel)
Definition offscreen.cc:5
bool operator==(const Pixel &) const =default