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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.vscode/
*.so
*.o
*.d
obj/
src/Features/Experimental/
docs/images/drawings/
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "external/imgui"]
path = lib/imgui
url = https://github.com/ocornut/imgui
18 changes: 13 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ CXX=g++-10
SDIR=src
ODIR=obj

SRCS=$(shell find $(SDIR) -name '*.cpp')
OBJS=$(patsubst $(SDIR)/%.cpp, $(ODIR)/%.o, $(SRCS))
IMGUI_SRCS=\
lib/imgui/imgui.cpp \
lib/imgui/imgui_draw.cpp \
lib/imgui/imgui_tables.cpp \
lib/imgui/imgui_widgets.cpp

SRCS=$(shell find $(SDIR) -name '*.cpp') $(IMGUI_SRCS)
OBJS=$(SRCS:.cpp=.o)
# OBJS=$(patsubst $(SDIR)/%.cpp, $(ODIR)/%.o, $(SRCS))

VERSION=$(shell git describe --tags)

# Header dependency target files; generated by g++ with -MMD
DEPS=$(OBJS:%.o=%.d)
# DEPS=$(OBJS:%.o=%.d)
DEPS=$(OBJS:.o=.d)

WARNINGS=-Wall -Wno-parentheses -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor -Wno-overloaded-virtual
CXXFLAGS=-std=c++17 -m32 $(WARNINGS) -I$(SDIR) -fPIC -D_GNU_SOURCE -Ilib/ffmpeg/include -Ilib/SFML/include -Ilib/curl/include -Ilib/discord-rpc/include -DSFML_STATIC -DCURL_STATICLIB
CXXFLAGS=-std=c++17 -m32 $(WARNINGS) -I$(SDIR) -Ilib/imgui -fPIC -D_GNU_SOURCE -Ilib/ffmpeg/include -Ilib/SFML/include -Ilib/curl/include -Ilib/discord-rpc/include -DSFML_STATIC -DCURL_STATICLIB
LDFLAGS=-m32 -shared -lstdc++fs -Llib/ffmpeg/lib/linux -lavformat -lavcodec -lavutil -lswscale -lswresample -lx264 -lx265 -lvorbis -lvorbisenc -lvorbisfile -logg -lopus -lvpx -Llib/SFML/lib/linux -lsfml -Llib/curl/lib/linux -lcurl -lssl -lcrypto -lnghttp2 -Llib/discord-rpc/lib/linux -ldiscord-rpc

# Import config.mk, which can be used for optional config
Expand All @@ -29,7 +37,7 @@ clean:
sar.so: src/Version.hpp $(OBJS)
$(CXX) $^ $(LDFLAGS) -o $@

$(ODIR)/%.o: $(SDIR)/%.cpp
%.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) $(CXXFLAGS) -MMD -c $< -o $@

Expand Down
1 change: 1 addition & 0 deletions lib/imgui
Submodule imgui added at 70f02b
4 changes: 3 additions & 1 deletion src/Features/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ float Camera::GetCurrentPathTime() {
//if in drive mode, checks if player wants to control the camera
//for now it requires LMB input (as in demo drive mode)
bool Camera::IsDriving() {
if (!engine->IsGameFocused() || vgui->IsUIVisible()) {
// console->Print("IsGameFocused %d, IsUIVisible %d\n", engine->IsGameFocused(), vgui->IsUIVisible());
if (!engine->IsGameFocused() ) {// || vgui->IsUIVisible()) {
return false;
}

Expand All @@ -104,6 +105,7 @@ bool Camera::IsDriving() {
}

bool userWantsToDrive = sar_cam_drive.GetInt() == 2 || inputSystem->IsKeyDown(ButtonCode_t::MOUSE_LEFT);
// console->Print("sar_cam_drive %d, isMouseLeftDown %d\n", sar_cam_drive.GetInt(), inputSystem->IsKeyDown(MOUSE_LEFT));
if (!userWantsToDrive) {
return false;
}
Expand Down
16 changes: 15 additions & 1 deletion src/Features/Hud/Hud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "InputHud.hpp"
#include "VphysHud.hpp"

#include "Imgui/Hud/ImguiHuds.hpp"

#include <algorithm>
#include <cstdio>
#include <map>
Expand Down Expand Up @@ -110,6 +112,14 @@ bool BaseHud::ShouldDraw() {
return false;
}

for (auto& h : g_imguiHuds) {
if (strcmp(h->GetHandle(), "showpos") == 0) {
if (h->Enabled() && h->ShouldDraw()) {
return false;
}
}
}

if (engine->demoplayer->IsPlaying() || engine->IsOrange()) {
return this->type & HudType_InGame;
}
Expand Down Expand Up @@ -222,7 +232,11 @@ void HudContext::Reset(int slot) {
this->elements = 0;
this->group.fill(0);
this->xPadding = sar_hud_x.GetInt();
this->yPadding = sar_hud_y.GetInt();
if (sar_hud_y.GetInt() < 28) {
this->yPadding = (g_drawImgui ? 28 : sar_hud_y.GetInt());
} else {
this->yPadding = sar_hud_y.GetInt();
}
this->spacing = sar_hud_spacing.GetInt();
this->maxWidth = 0;

Expand Down
7 changes: 7 additions & 0 deletions src/Features/Hud/Hud.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,13 @@ extern bool g_hudPrecisionWarn;

DECL_DECLARE_AUTOCOMPLETION_FUNCTION(HudSetPos);

extern Variable sar_hud_precision;
extern Variable sar_hud_velocity_precision;

extern Variable sar_hud_position;
extern Variable sar_hud_angles;
extern Variable sar_hud_velocity;

#define CON_COMMAND_HUD_SETPOS(name, helpname) \
CON_COMMAND_F_COMPLETION( \
name##_setpos, \
Expand Down
Loading