Skip to content

Instantly share code, notes, and snippets.

View kilbith's full-sized avatar
💭
To do things right, first you need love, then technique

Jean-Patrick Guerrero kilbith

💭
To do things right, first you need love, then technique
View GitHub Profile
@kilbith
kilbith / max.diff
Created January 24, 2023 15:46
Maximize window by default
diff --git a/src/client/renderingengine.cpp b/src/client/renderingengine.cpp
index a58b0efe6..1aebaa4e0 100644
--- a/src/client/renderingengine.cpp
+++ b/src/client/renderingengine.cpp
@@ -146,6 +146,7 @@ RenderingEngine::RenderingEngine(IEventReceiver *receiver)
auto skin = createSkin(m_device->getGUIEnvironment(),
gui::EGST_WINDOWS_METALLIC, driver);
m_device->getGUIEnvironment()->setSkin(skin);
+ m_device->maximizeWindow();
skin->drop();
@kilbith
kilbith / build.sh
Created January 22, 2023 19:31
Improved MinGW Build Script
#!/bin/bash
set -e
clear
GITURL=https://github.com/minetest
CORE_GIT=$GITURL/minetest
CORE_BRANCH=master
CORE_NAME=minetest
@kilbith
kilbith / 1.patch
Created November 16, 2022 01:12
core.get_pixel_color(texture_path, x, y)
commit 4ec99632b153a9a3ecf6cf123353f675ba12b1d6
Author: Jean-Patrick Guerrero <kilbith@users.noreply.github.com>
Date: Wed Nov 16 01:58:15 2022 +0100
Add core.get_pixel_color()
diff --git a/src/script/lua_api/l_server.cpp b/src/script/lua_api/l_server.cpp
index a5daae346..a0b90087c 100644
--- a/src/script/lua_api/l_server.cpp
+++ b/src/script/lua_api/l_server.cpp
cam1:set_viewport{x = 100, y = 50, w = 800, h = 600}
cam2:set_viewport{x = 2700, y = 1500, w = 800, h = 600}
player:attach_camera(cam1:get_id())
player:set_active_camera(cam1:get_id())
player:set_active_camera(cam2:get_id())
@kilbith
kilbith / init.lua
Created August 30, 2022 13:53
Camera API: Client-Side Interpolation
local vec = vector.new
local vec_round = vector.round
local cam, player
local hud, init_hud, smiley
local old_rot
minetest.register_on_joinplayer(function(player)
player = player
init_hud = player:hud_add {
@kilbith
kilbith / local_vs_global.lua
Created November 15, 2021 20:07
Lua - local vs global performance
local NUMBER_OF_CALLS = 20
x = {}
for i = 1, 1e4 do
x[string.char(math.random(128))] = "foo"
end
function x.test()
local o = {}
diff --git a/src/client/camera.cpp b/src/client/camera.cpp
index 46464404..5426b9df 100644
--- a/src/client/camera.cpp
+++ b/src/client/camera.cpp
@@ -234,7 +234,7 @@ void Camera::addArmInertia(f32 player_yaw)
m_last_cam_pos.X = player_yaw;
m_wieldmesh_offset.X = rangelim(m_wieldmesh_offset.X,
- WIELDMESH_OFFSET_X - 7.0f, WIELDMESH_OFFSET_X + 7.0f);
+ WIELDMESH_OFFSET_X - 3.0f, WIELDMESH_OFFSET_X + 3.0f);
diff --git a/src/client/camera.cpp b/src/client/camera.cpp
index 46464404..5426b9df 100644
--- a/src/client/camera.cpp
+++ b/src/client/camera.cpp
@@ -234,7 +234,7 @@ void Camera::addArmInertia(f32 player_yaw)
m_last_cam_pos.X = player_yaw;
m_wieldmesh_offset.X = rangelim(m_wieldmesh_offset.X,
- WIELDMESH_OFFSET_X - 7.0f, WIELDMESH_OFFSET_X + 7.0f);
+ WIELDMESH_OFFSET_X - 3.0f, WIELDMESH_OFFSET_X + 3.0f);