Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ When Haggle mods are used with Peggle, they are loaded into the Peggle executabl
The Mod Loader performs this operation. Follow these steps to install the Mod Loader.
1. Obtain the Mod Loader `Haggle.exe` file:
1. Download from the [Haggle Mod Loader Github releases page](https://github.com/PeggleCommunity/haggle-mod-loader/releases) or
2. Compile from the [`mod-loader` project files](https://github.com/PeggleCommunity/haggle-mod-loader/tree/main/src/). Refer to the [Compiling](#compiling) section for details.
2. Compile from the [mod-loader](https://github.com/PeggleCommunity/haggle-mod-loader/tree/main). Refer to the [Compiling](#compiling) section for details.
2. Copy the `Haggle.exe` file into your game directory. For Steam, right click the game in your library, hover over "Manage", and click on "Browse local files".

<details>
Expand All @@ -40,7 +40,7 @@ The Mod Loader performs this operation. Follow these steps to install the Mod Lo

### Installing mods into the mods folder
1. Create a folder called "mods" in the Peggle installation directory.
2. Place the mod's file(s) into the created folder. A mod file will usually have a `.dll` or `.asi` extension.
2. Place the mod's file(s) into the created folder. A mod file will usually have a `.dll` or `.asi` extension. (put `haggle-sdk.dll` next to the haggle.exe and mods folder)
3. Test that the mod has been installed correctly.
1. Launch Peggle, having already completed the [Installing the Mod Loader](#installing-the-mod-loader) step.
2. In the Haggle Mod Loader window, the Mod Loader identifies which mods it loads.
Expand Down
14 changes: 8 additions & 6 deletions src/example-mod/main.cpp
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#include <random>
#include "sdk/SexySDK.hpp"
#include "callbacks/callbacks.hpp"
#include "sdk/Sexy/callbacks/callbacks.hpp"

HMODULE self = 0;

using namespace Sexy;

void Example_Callbacks(void);
void Example_AutoShoot(void);

void init()
{
// Example Mod stuff

callbacks::init();
Example_Callbacks();
Example_AutoShoot();
}
Expand All @@ -20,12 +22,12 @@ void Example_Callbacks(void)
// Example generic callback
callbacks::on(callbacks::type::begin_turn_2, []()
{
Sexy::LogicMgr::AddStandardText("Begin Turn!", 330.0f, 150.0f, 48);
Sexy::LogicMgr::AddStandardText(std::string("Begin Turn!"), 330.0f, 150.0f, 48);
});

callbacks::on_begin_shot([](auto logic_mgr, auto a2)
{
Sexy::LogicMgr::AddStandardText("Shoot!", 100.0f, 25.0f, 48);
Sexy::LogicMgr::AddStandardText(std::string("Shoot!"), 100.0f, 25.0f, 48);
});

// Example callback for peg hit
Expand All @@ -34,7 +36,7 @@ void Example_Callbacks(void)
Sexy::PhysObj_* phys_obj_ = (Sexy::PhysObj_*)phys_obj;
double pos_x = ((double(__thiscall*)(Sexy::PhysObj*)) * (std::uint32_t*)(*(std::uint32_t*)phys_obj_->data + 120))(phys_obj);
double pos_y = ((double(__thiscall*)(Sexy::PhysObj*)) * (std::uint32_t*)(*(std::uint32_t*)phys_obj_->data + 124))(phys_obj);
Sexy::LogicMgr::AddStandardText("Peg Hit!", pos_x, pos_y, 50);
Sexy::LogicMgr::AddStandardText(std::string("Peg Hit!"), pos_x, pos_y, 50);
});

callbacks::on_load_level([](auto board, auto level_name)
Expand All @@ -57,7 +59,7 @@ void Example_AutoShoot(void)
{
callbacks::on(callbacks::type::main_loop, []()
{
static float angleIncrement = 8.0f;
static float angleIncrement = 1.0f;
static constexpr int MOVE_DELAY_MS = 1000 / 60;
static constexpr float ANGLE_BOUNDS[] = { -93.0f, 93.0f };
static bool isMovingLeft = false;
Expand Down