Mandelbrot explorer

This commit is contained in:
Ben
2019-01-31 17:30:19 +00:00
parent 70acbd8c54
commit 30f09d95f6
11 changed files with 2221 additions and 53 deletions

View File

@@ -4,39 +4,32 @@
#include <iostream>
Rect rect;
bool isHoverd = false;
class RaysApp : public olc::PixelGameEngine {
public:
RaysApp() {
RaysApp()
: rect() {
sAppName = "Rays";
}
bool OnUserCreate() override {
rect.SetRect(100, 100, 200, 100);
return true;
}
bool OnUserUpdate(float fElapsedTime) override {
Clear(olc::BLACK);
if (!isHoverd) {
DrawRect(rect.x, rect.y, rect.w, rect.h, olc::RED);
} else {
if (rect.Contains(new Vec2<int>(GetMouseX(), GetMouseY()))) {
FillRect(rect.x, rect.y, rect.w, rect.h, olc::RED);
} else {
DrawRect(rect.x, rect.y, rect.w, rect.h, olc::RED);
}
std::cout << "MouseX: " << GetMouseX() << " MouseY: " << GetMouseY() << std::endl;
if (rect.Contains(new Vec2<int>(GetMouseX(), GetMouseY()))) {
isHoverd = true;
} else {
isHoverd = false;
}
return true;
}
Rect rect;
};
int main(int argc, char** argv) {