Skip to content

Commit

Permalink
Fix non_walkable_areas
Browse files Browse the repository at this point in the history
Clean up imports
  • Loading branch information
pinguin999 committed Dec 17, 2024
1 parent de57e01 commit 9445eb2
Show file tree
Hide file tree
Showing 12 changed files with 4 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/background.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ bool Background::is_walkable(jngl::Vec2 position) const
{
for (const auto &obj : _game->gameObjects)
{
auto *non_walkable = spine::spSkeletonBounds_containsPointMatchingName(obj->bounds, "non_walkable_area", static_cast<float>(position.x), static_cast<float>(position.y));
auto *non_walkable = spine::spSkeletonBounds_containsPointMatchingName(obj->bounds, "non_walkable_area", static_cast<float>(position.x) - static_cast<float>(obj->getPosition().x), static_cast<float>(position.y) - static_cast<float>(obj->getPosition().y));
if (non_walkable)
{
return false;
Expand Down
3 changes: 0 additions & 3 deletions src/background.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@

#include "spine_object.hpp"

#include <array>
#include <jngl.hpp>
#include <list>
#include <map>
#include <deque>

struct Node
Expand Down
2 changes: 0 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

#include <algorithm>
#include <cmath>
#include <map>
#include <string>
#include <iostream>
#include <chrono>
#include <thread>

#include <spine/spine.h>
#include "pointer.hpp"
#include "interactable_object.hpp"
#include "scene_fade.hpp"

#if (!defined(NDEBUG) && !defined(ANDROID) && (!defined(TARGET_OS_IOS) || TARGET_OS_IOS == 0) && !defined(EMSCRIPTEN))
Expand Down
1 change: 0 additions & 1 deletion src/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include <filesystem>
#include <jngl.hpp>
#include <set>
#include <vector>
#include <sol/sol.hpp>
#if (!defined(NDEBUG) && !defined(ANDROID) && (!defined(TARGET_OS_IOS) || TARGET_OS_IOS == 0) && !defined(EMSCRIPTEN))
Expand Down
2 changes: 1 addition & 1 deletion src/interactable_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ bool InteractableObject::step(bool force)
jngl::Vec2 click_position = _game->pointer->getWorldPosition();
if (abs_position)
{
click_position -= _game->getCameraPosition();
click_position = _game->pointer->getPosition();
}

auto *collision = spSkeletonBounds_containsPoint(bounds, static_cast<float>(click_position.x) - static_cast<float>(position.x), static_cast<float>(click_position.y) - static_cast<float>(position.y));
Expand Down
1 change: 0 additions & 1 deletion src/interactable_object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "spine_object.hpp"

#include <array>
#include <jngl.hpp>
#include <sol/sol.hpp>

Expand Down
2 changes: 0 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <jngl/init.hpp>
#include "game.hpp"

#include <fstream>

#ifndef NDEBUG
void pac_unload_file(const char* path)
{
Expand Down
1 change: 0 additions & 1 deletion src/player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

#include "spine_object.hpp"

#include <array>
#include <deque>
#include <jngl.hpp>
#include <sol/sol.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include "game.hpp"

#include <cmath>
#include <cassert>
#include <spine/spine.h>

Pointer::Pointer(std::shared_ptr<Game> game, const std::string &spine_file) : SpineObject(game, spine_file, "Pointer", .5)
Expand Down
1 change: 0 additions & 1 deletion src/pointer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
#include "spine_object.hpp"
#include "input/control.hpp"

#include <array>
#include <jngl.hpp>
#include <memory>

Expand Down
1 change: 0 additions & 1 deletion src/scene.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "scene.hpp"

#include <fstream>
#include <streambuf>
#include "interactable_object.hpp"
#include "game.hpp"
#include "player.hpp"
Expand Down
4 changes: 2 additions & 2 deletions src/skeleton_drawable.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include "skeleton_drawable.hpp"
#include "game.hpp"

#ifndef SPINE_MESH_VERTEX_COUNT_MAX
#define SPINE_MESH_VERTEX_COUNT_MAX 1000
Expand Down Expand Up @@ -185,7 +184,8 @@ void SkeletonDrawable::draw(const jngl::Mat3& modelview) const {
bbname.setText(box->super.super.name);
bbname.setAlign(jngl::Alignment::CENTER);
bbname.setCenter(bbvertices[0], bbvertices[1]);
bbname.draw();
jngl::setFontColor(jngl::Rgba(0,1,0,1));
bbname.draw(modelview);
}
#endif
}
Expand Down

0 comments on commit 9445eb2

Please sign in to comment.