refacto: Hud: make driver, client, player, inventory, tsrc private & drop unused guienv
also fix c_content.h, on client it includes the src/client/hud.h instead of src/hud.h, which leads to wrong file dependency on the lua stackmaster
parent
a47a00228b
commit
ccdd886e27
|
@ -1389,7 +1389,7 @@ bool Game::createClient(const GameStartData &start_data)
|
||||||
player->hurt_tilt_timer = 0;
|
player->hurt_tilt_timer = 0;
|
||||||
player->hurt_tilt_strength = 0;
|
player->hurt_tilt_strength = 0;
|
||||||
|
|
||||||
hud = new Hud(guienv, client, player, &player->inventory);
|
hud = new Hud(client, player, &player->inventory);
|
||||||
|
|
||||||
mapper = client->getMinimap();
|
mapper = client->getMinimap();
|
||||||
|
|
||||||
|
|
|
@ -45,11 +45,10 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
#define OBJECT_CROSSHAIR_LINE_SIZE 8
|
#define OBJECT_CROSSHAIR_LINE_SIZE 8
|
||||||
#define CROSSHAIR_LINE_SIZE 10
|
#define CROSSHAIR_LINE_SIZE 10
|
||||||
|
|
||||||
Hud::Hud(gui::IGUIEnvironment *guienv, Client *client, LocalPlayer *player,
|
Hud::Hud(Client *client, LocalPlayer *player,
|
||||||
Inventory *inventory)
|
Inventory *inventory)
|
||||||
{
|
{
|
||||||
driver = RenderingEngine::get_video_driver();
|
driver = RenderingEngine::get_video_driver();
|
||||||
this->guienv = guienv;
|
|
||||||
this->client = client;
|
this->client = client;
|
||||||
this->player = player;
|
this->player = player;
|
||||||
this->inventory = inventory;
|
this->inventory = inventory;
|
||||||
|
@ -315,7 +314,7 @@ bool Hud::calculateScreenPos(const v3s16 &camera_offset, HudElement *e, v2s32 *p
|
||||||
{
|
{
|
||||||
v3f w_pos = e->world_pos * BS;
|
v3f w_pos = e->world_pos * BS;
|
||||||
scene::ICameraSceneNode* camera =
|
scene::ICameraSceneNode* camera =
|
||||||
RenderingEngine::get_scene_manager()->getActiveCamera();
|
client->getSceneManager()->getActiveCamera();
|
||||||
w_pos -= intToFloat(camera_offset, BS);
|
w_pos -= intToFloat(camera_offset, BS);
|
||||||
core::matrix4 trans = camera->getProjectionMatrix();
|
core::matrix4 trans = camera->getProjectionMatrix();
|
||||||
trans *= camera->getViewMatrix();
|
trans *= camera->getViewMatrix();
|
||||||
|
@ -475,7 +474,7 @@ void Hud::drawLuaElements(const v3s16 &camera_offset)
|
||||||
|
|
||||||
// Angle according to camera view
|
// Angle according to camera view
|
||||||
v3f fore(0.f, 0.f, 1.f);
|
v3f fore(0.f, 0.f, 1.f);
|
||||||
scene::ICameraSceneNode *cam = RenderingEngine::get_scene_manager()->getActiveCamera();
|
scene::ICameraSceneNode *cam = client->getSceneManager()->getActiveCamera();
|
||||||
cam->getAbsoluteTransformation().rotateVect(fore);
|
cam->getAbsoluteTransformation().rotateVect(fore);
|
||||||
int angle = - fore.getHorizontalAngle().Y;
|
int angle = - fore.getHorizontalAngle().Y;
|
||||||
|
|
||||||
|
|
|
@ -35,13 +35,6 @@ struct ItemStack;
|
||||||
class Hud
|
class Hud
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
video::IVideoDriver *driver;
|
|
||||||
gui::IGUIEnvironment *guienv;
|
|
||||||
Client *client;
|
|
||||||
LocalPlayer *player;
|
|
||||||
Inventory *inventory;
|
|
||||||
ITextureSource *tsrc;
|
|
||||||
|
|
||||||
video::SColor crosshair_argb;
|
video::SColor crosshair_argb;
|
||||||
video::SColor selectionbox_argb;
|
video::SColor selectionbox_argb;
|
||||||
|
|
||||||
|
@ -54,7 +47,7 @@ public:
|
||||||
|
|
||||||
bool pointing_at_object = false;
|
bool pointing_at_object = false;
|
||||||
|
|
||||||
Hud(gui::IGUIEnvironment *guienv, Client *client, LocalPlayer *player,
|
Hud(Client *client, LocalPlayer *player,
|
||||||
Inventory *inventory);
|
Inventory *inventory);
|
||||||
~Hud();
|
~Hud();
|
||||||
|
|
||||||
|
@ -105,6 +98,12 @@ private:
|
||||||
void drawCompassRotate(HudElement *e, video::ITexture *texture,
|
void drawCompassRotate(HudElement *e, video::ITexture *texture,
|
||||||
const core::rect<s32> &rect, int way);
|
const core::rect<s32> &rect, int way);
|
||||||
|
|
||||||
|
Client *client = nullptr;
|
||||||
|
video::IVideoDriver *driver = nullptr;
|
||||||
|
LocalPlayer *player = nullptr;
|
||||||
|
Inventory *inventory = nullptr;
|
||||||
|
ITextureSource *tsrc = nullptr;
|
||||||
|
|
||||||
float m_hud_scaling; // cached minetest setting
|
float m_hud_scaling; // cached minetest setting
|
||||||
float m_scale_factor;
|
float m_scale_factor;
|
||||||
v3s16 m_camera_offset;
|
v3s16 m_camera_offset;
|
||||||
|
|
|
@ -39,7 +39,7 @@ extern "C" {
|
||||||
#include "itemgroup.h"
|
#include "itemgroup.h"
|
||||||
#include "itemdef.h"
|
#include "itemdef.h"
|
||||||
#include "c_types.h"
|
#include "c_types.h"
|
||||||
#include "hud.h"
|
#include "../../hud.h"
|
||||||
|
|
||||||
namespace Json { class Value; }
|
namespace Json { class Value; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue