Skip to content

Commit

Permalink
Emscripten baby!
Browse files Browse the repository at this point in the history
  • Loading branch information
gorbit99 committed Apr 2, 2021
1 parent 8ede3ab commit a273023
Show file tree
Hide file tree
Showing 2 changed files with 1,023 additions and 893 deletions.
38 changes: 32 additions & 6 deletions example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class Test : public olc::PixelGameEngine {
}

if (!gamepad->getButton(olc::GPButtons::L2).bHeld) {
DrawRect(10, 10, 30, 10);
FillRect(10, 10, 30, 10, olc::WHITE * gamepad->getAxis(olc::GPAxes::TL));
DrawRect(10, 10, 30, 10, olc::RED);
} else {
FillRect(10, 10, 30, 10);
FillRect(10, 10, 30, 10, olc::WHITE * gamepad->getAxis(olc::GPAxes::TL));
DrawRect(10, 10, 30, 10, olc::BLUE);
}

if (!gamepad->getButton(olc::GPButtons::L1).bHeld) {
Expand All @@ -35,9 +37,11 @@ class Test : public olc::PixelGameEngine {
}

if (!gamepad->getButton(olc::GPButtons::R2).bHeld) {
DrawRect(360, 10, 30, 10);
FillRect(360, 10, 30, 10, olc::WHITE * gamepad->getAxis(olc::GPAxes::TR));
DrawRect(360, 10, 30, 10, olc::RED);
} else {
FillRect(360, 10, 30, 10);
FillRect(360, 10, 30, 10, olc::WHITE * gamepad->getAxis(olc::GPAxes::TR));
DrawRect(360, 10, 30, 10, olc::BLUE);
}

if (!gamepad->getButton(olc::GPButtons::R1).bHeld) {
Expand Down Expand Up @@ -100,9 +104,31 @@ class Test : public olc::PixelGameEngine {
FillRect(60, 110, 10, 10);
}

FillCircle(20 + gamepad->getAxis(olc::GPAxes::LX) * 10, 70 + gamepad->getAxis(olc::GPAxes::LY) * 10, 10);
if (!gamepad->getButton(olc::GPButtons::SELECT).bHeld) {
DrawRect(150, 30, 30, 10);
} else {
FillRect(150, 30, 30, 10);
}

if (!gamepad->getButton(olc::GPButtons::START).bHeld) {
DrawRect(200, 30, 30, 10);
} else {
FillRect(200, 30, 30, 10);
}

DrawLine(80, 115, gamepad->getAxis(olc::GPAxes::DX) * 10 + 80, gamepad->getAxis(olc::GPAxes::DY) * 10 + 115);

FillCircle(320 + gamepad->getAxis(olc::GPAxes::RX) * 10, 100 + gamepad->getAxis(olc::GPAxes::RY) * 10, 10);
if (gamepad->getButton(olc::GPButtons::L3).bHeld) {
FillCircle(20 + gamepad->getAxis(olc::GPAxes::LX) * 10, 70 + gamepad->getAxis(olc::GPAxes::LY) * 10, 10);
} else {
DrawCircle(20 + gamepad->getAxis(olc::GPAxes::LX) * 10, 70 + gamepad->getAxis(olc::GPAxes::LY) * 10, 10);
}

if (gamepad->getButton(olc::GPButtons::R3).bHeld) {
FillCircle(320 + gamepad->getAxis(olc::GPAxes::RX) * 10, 100 + gamepad->getAxis(olc::GPAxes::RY) * 10, 10);
} else {
DrawCircle(320 + gamepad->getAxis(olc::GPAxes::RX) * 10, 100 + gamepad->getAxis(olc::GPAxes::RY) * 10, 10);
}
return true;
}
};
Expand Down
Loading

0 comments on commit a273023

Please sign in to comment.