Mandelbrot explorer
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user