feat(MainWindow): Added gravity gun
This commit is contained in:
parent
29526040c7
commit
9e1465548b
@ -1,4 +1,5 @@
|
||||
#include "backend/looped/looped.hpp"
|
||||
#include "core/enums.hpp"
|
||||
#include "core/globals.hpp"
|
||||
#include "util/entity.hpp"
|
||||
#include "util/math.hpp"
|
||||
@ -16,7 +17,7 @@ namespace big
|
||||
|
||||
void looped::weapons_gravity_gun()
|
||||
{
|
||||
bool bGravityGun = g.weapons.custom_weapon == 0;
|
||||
bool bGravityGun = g.weapons.custom_weapon == CustomWeapons::GRAVITY_GUN;
|
||||
double multiplier = 3.0;
|
||||
|
||||
if (bGravityGun)
|
||||
|
12
BigBaseV2/src/core/data/custom_weapons.hpp
Normal file
12
BigBaseV2/src/core/data/custom_weapons.hpp
Normal file
@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
#include "core/enums.hpp"
|
||||
|
||||
struct custom_weapon {
|
||||
big::CustomWeapons id;
|
||||
const char name[16];
|
||||
};
|
||||
|
||||
const custom_weapon custom_weapons[] = {
|
||||
{ big::CustomWeapons::NONE, "No weapon" },
|
||||
{ big::CustomWeapons::GRAVITY_GUN, "Gravity Gun" }
|
||||
};
|
10
BigBaseV2/src/core/enums.hpp
Normal file
10
BigBaseV2/src/core/enums.hpp
Normal file
@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace big
|
||||
{
|
||||
enum class CustomWeapons
|
||||
{
|
||||
NONE,
|
||||
GRAVITY_GUN
|
||||
};
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
#pragma once
|
||||
#include "enums.hpp"
|
||||
|
||||
#ifndef GLOBALS_H
|
||||
#define GLOBALS_H
|
||||
@ -9,7 +10,7 @@ struct globals {
|
||||
};
|
||||
|
||||
struct weapons {
|
||||
int custom_weapon = -1;
|
||||
big::CustomWeapons custom_weapon = big::CustomWeapons::NONE;
|
||||
};
|
||||
|
||||
self self{};
|
||||
|
37
BigBaseV2/src/gui/window/main/tab_weapons.cpp
Normal file
37
BigBaseV2/src/gui/window/main/tab_weapons.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include "core/data/custom_weapons.hpp"
|
||||
#include "core/globals.hpp"
|
||||
#include "gui/window/main/tabs.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
void tab_main::tab_weapons()
|
||||
{
|
||||
if (ImGui::BeginTabItem("Weapons"))
|
||||
{
|
||||
if (ImGui::TreeNode("Custom Weapons"))
|
||||
{
|
||||
int selected = (int)g.weapons.custom_weapon;
|
||||
|
||||
if (ImGui::BeginCombo("Weapon", custom_weapons[selected].name))
|
||||
{
|
||||
for (custom_weapon weapon : custom_weapons)
|
||||
{
|
||||
if (ImGui::Selectable(weapon.name, weapon.id == (CustomWeapons)selected))
|
||||
{
|
||||
g.weapons.custom_weapon = weapon.id;
|
||||
}
|
||||
|
||||
if (weapon.id == (CustomWeapons)selected)
|
||||
ImGui::SetItemDefaultFocus();
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::TreePop();
|
||||
}
|
||||
|
||||
ImGui::EndTabItem();
|
||||
}
|
||||
}
|
||||
}
|
@ -8,5 +8,6 @@ namespace big
|
||||
public:
|
||||
static void tab_self();
|
||||
static void tab_spawn();
|
||||
static void tab_weapons();
|
||||
};
|
||||
}
|
@ -1,6 +1,5 @@
|
||||
#include "gui/window.hpp"
|
||||
#include "imgui.h"
|
||||
#include "gui/base_tab.h"
|
||||
#include "gui/window/main/tabs.hpp"
|
||||
|
||||
namespace big
|
||||
@ -13,6 +12,7 @@ namespace big
|
||||
ImGui::BeginTabBar("tabbar");
|
||||
tab_main::tab_self();
|
||||
tab_main::tab_spawn();
|
||||
tab_main::tab_weapons();
|
||||
ImGui::EndTabBar();
|
||||
}
|
||||
ImGui::End();
|
||||
|
Reference in New Issue
Block a user