Skip to content

Instantly share code, notes, and snippets.

View enci's full-sized avatar

Bojan Endrovski enci

View GitHub Profile
class Grid {
construct new(w, h, z) {
_width = w
_height = h
_grid = List.new()
for(i in 0...(w * h)) {
_grid.add(z)
}
}
@enci
enci / game.wren
Created November 4, 2022 13:45
HexGrid
import "xs" for Input, Render, Data
class Vec2 {
construct new(x, y) {
_x = x
_y = y
}
x=(value) { _x = value }
x { _x }
@enci
enci / game.wren
Created November 4, 2022 13:13
Turn based movement on a grid
import "xs" for Render, Data, Input
import "xs_math" for Bits, Vec2, Math
import "grid" for Grid
import "random" for Random
class Type {
static none { 0 << 0 }
static player { 1 << 0 }
static enemy { 1 << 1 }
static bomb { 1 << 2 }
// This is an independent project of an individual developer. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++, C#, and Java: http://www.viva64.com
#include <Pch.h>
#include <Physics/Physics2D.h>
#include <Core/Entity.h>
#include <Core/World.h>
#include <Core/Transform.h>
#include <algorithm>
#include <vector>
#include <Graphics/DebugRenderer.h>
@enci
enci / Visit.cpp
Created March 11, 2022 11:45
visit_struct demo
#include <iostream>
#include <string>
#include <fstream>
#include "include/visit_struct/visit_struct.hpp"
#include "include/json.hpp"
using namespace std;
using namespace nlohmann;
struct vec3 {
#pragma once
#include <map>
#include <memory>
#include <string>
#include <unordered_map>
#include <Core/Resource.h>
namespace Osm
{
#include <Graphics/Mesh.h>
#include <Graphics/Model.h>
#include <Graphics/Uniforms.h>
#include <Graphics/OpenGL.h>
using namespace Osm;
static uint32_t CalculateDataTypeSize(fx::gltf::Accessor const& accessor) noexcept;
@enci
enci / gist:475bed6a5653541f56ca6ed65ddc30ce
Created August 26, 2020 15:33
Light a dark theme for ImGui. Screenshot posted here: https://github.com/ocornut/imgui/issues/3075
void SetStyleLight()
{
// General
auto* style = &ImGui::GetStyle();
style->FrameRounding = 2.0f;
style->WindowPadding = ImVec2(4.0f, 3.0f);
style->FramePadding = ImVec2(4.0f, 4.0f);
style->ItemSpacing = ImVec2(4.0f, 3.0f);
style->IndentSpacing = 12;
style->ScrollbarSize = 12;