Compare commits

...
7 Commits
Author SHA1 Message Date
syedm cdb473c071 Start writing a devlog. 2026-11-04 09:14:28 +00:00
syedm 431ecd31d8 Add fields to EWorld class. 2026-11-04 09:09:22 +00:00
syedm 74557e5647 Added a class to hold ruby objects. 2026-11-04 09:08:59 +00:00
syedm 1eba06f19b Basic ECS setup.
- Added std::variant to pch.h
2026-11-04 09:08:38 +00:00
syedm cd8ecb09c0 Cleanup on API plans. 2026-11-04 09:07:20 +00:00
syedm cbb77ecf49 Fix wrong pointer type in Vec2_free 2026-11-04 09:06:56 +00:00
syedm 1a04e0bcd9 Minor cleanup. 2026-11-04 09:06:25 +00:00
13 changed files with 654 additions and 42 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ CFLAGS_DEBUG := \
-std=c++20 -Wall -Wextra \
-Og -g -fno-omit-frame-pointer \
-I./include -I./libs/mruby/build/host/include \
$(SDL_CFLAGS) $(MRUBY_CFLAGS)
$(SDL_CFLAGS) $(MRUBY_CFLAGS) $(C_SANITIZER)
CFLAGS_RELEASE := \
-std=c++20 -O3 -mtune=generic \
+14 -4
View File
@@ -2,6 +2,7 @@
#define ELEMENTS_H
#include "bindings/ruby.h"
#include "ecs/ecs.h"
#include "localization/localization.h"
#include "utils.h"
#include "window/window.h"
@@ -84,14 +85,23 @@ struct ERect : Element {
};
struct EWorld : Element {
#warning need to implement ecs system first before implementing this
uint64_t world_id = UINT64_MAX;
EWorld(uint64_t world_id) : Element(Type::WORLD), world_id(world_id) {}
EWorld() : Element(Type::WORLD) {}
Vec2<float> size() override;
void render(uint64_t) override;
Vec2<float> cam_pos;
float cam_rotation = 0;
Vec2<float> cam_scale = {1, 1};
using V = std::variant<int64_t, double, bool, Ruby::RubyObject>;
void add_component(
std::string_view name,
std::unordered_map<std::string, Component::Type, V> fields,
std::unordered_map<std::string, Component::Type, V> globals
);
};
inline Pool<Element> element_pool;
+29
View File
@@ -88,6 +88,35 @@ struct Block {
}
};
struct RubyObject {
mrb_value val;
RubyObject(mrb_value val) : val(val) {
mrb_gc_register(mrb, val);
}
RubyObject() : val(mrb_nil_value()) {}
~RubyObject() {
if (!mrb_nil_p(val))
mrb_gc_unregister(mrb, val);
}
void set_proc(mrb_value new_proc) {
if (!mrb_nil_p(val))
mrb_gc_unregister(mrb, val);
val = new_proc;
mrb_gc_register(mrb, val);
}
RubyObject(const RubyObject &) = delete;
RubyObject &operator=(const RubyObject &) = delete;
mrb_value get() {
return val;
}
};
inline void run_string(const char *code, size_t length) {
int ai = mrb_gc_arena_save(mrb);
mrb_load_nstring(mrb, code, length);
+18 -5
View File
@@ -1,14 +1,27 @@
#ifndef ECS_H
#define ECS_H
#include "bindings/ruby.h"
#include "utils.h"
struct Entity {};
struct Component;
struct System;
struct Entity {
Vec2<float> position;
std::unordered_map<std::string, size_t> components;
};
struct EntityPool {
Entity entities[];
struct Component {
enum struct Type {
Int,
Float,
Boolean,
RubyObject
};
std::unordered_map<std::string, std::variant<int64_t, double, bool, Ruby::RubyObject>> globals;
std::vector<std::tuple<std::string, Type, void *>> table;
};
struct System {
Ruby::Block function;
};
#endif
+1
View File
@@ -69,6 +69,7 @@
#include <unistd.h>
#include <unordered_map>
#include <unordered_set>
#include <variant>
#include <vector>
#endif
+47 -27
View File
@@ -39,22 +39,27 @@ world = ElementWorld.new
# this is a custom component
world.component :health do |c|
field :health, int: 100
allow_redefine [:health]
# one of int or float or boolean which use c stuff and generally faster
# also allow for bulk operations to be done in hotloops.
# can use `any` which allows for any ruby value but uses runtime gc etc and so is worse to use performance wise for each entity.
field :health, :int, 100 # stored for each entity it is attached to.
field :max_health, :int, 100, global: true # stored only once per component
end
world.spawn do |e| # Name is optional
e.tags = [:enemy]
e.z = 0.5
e.position = {x: 100, y: 100} # entities always have a position, even if they don't have a body component, this is useful for rendering and for entities that don't need physics but still need to be positioned in the world
e.position = {x: 100, y: 100} # entities always have a position, even if they don't have
# a body component, this is useful for rendering and for entities
# that don't need physics but still need to be positioned in the world
e.add_component :body do |c|
c.shape = :rectangle
c.size = {width: 50, height: 50}
c.angle = 0
c.mass = 1
c.velocity = {x: 0, y: 0}
c.collision = true
c.collision_layer = 1
end
e.add_component :sprite do |c|
tiles = Tiles.from "assets/sprite.png", tile_width: 50, tile_height: 50
@@ -76,6 +81,7 @@ end
world.spawn "Trap Preview" do |e|
e.position = {x: 0, y: 0}
e.z = 0
e.tags = [:trap_preview]
e.active = false
e.add_component :sprite do |c|
@@ -84,10 +90,12 @@ world.spawn "Trap Preview" do |e|
c.animations = {idle: animation1}
c.current_animation = :idle
end
# e.remove_component :sprite # compoenents can also be removed
end
# systems are called on the world every update frame, some systems are built into the engine for things like physics, rendering, etc, but you can also create your own custom systems for things like trap placement, enemy spawning, etc
# systems are called on the world every update frame, some systems
# are built into the engine for things like physics, rendering, etc,
# but you can also create your own custom systems for things like
# trap placement, enemy spawning, etc
# systems can be created on queries
# the query can be for compoenents or tags or both
@@ -96,24 +104,27 @@ end
# for entities it does similarly
# mouse state can be read in systems always
query = Query.from(tag(:enemy) & component(:health, true) & anti(name("Trap Preview", true)))
query = Query.from(tag(:enemy) & component(:health, capture: true) & anti(name("Trap Preview")))
# in the match name will return just the one entity
# tag and componet return list-like tables but they will be parallel and in order
# empty columns will be filled with nil (not possible if only & is used)
# the last part is to show how anti() works
# it doesnt actually do anything as tag(:enemy) and component(:health) will never match name("Trap Preview") but it shows how you can use anti() to negate a query
# it doesnt actually do anything as tag(:enemy) and component(:health) will
# never match name("Trap Preview") but it shows how you can use anti() to negate a query
world.system :health_regen, for: query do |match, dt| # no trigger means always
# example of a simple health regeneration system that regenerates health for all entities with a health component
healths = query.get[0] # get the first component in the query, in this case health, this will be a list of all health components for entities that match the query
healths.add_scalar! :health, 1 * dt
healths.clamp! :health, 0, 100
healths = match[0] # get the first component in the query, in this case health
# , this will be a list of all health components for
# entities that match the query
healths[:health].add! 1 * dt
healths[:health].clamp! 0, :max_health
end
trigger = [:place]
trigger = Trigger.from(key(:place))
world.system :trap_placement, trigger: trigger do |dt|
return unless world.holding_trap?
return unless world.globals.holding_trap?
world.spawn do |e|
e.tags = [:trap]
@@ -126,39 +137,44 @@ world.system :trap_placement, trigger: trigger do |dt|
c.current_animation = :idle
end
e.add_component :body do |c|
c.shape = :rectangle
c.size = {width: 50, height: 50}
c.angle = 0
c.mass = 1
c.velocity = {x: 0, y: 0}
c.collision = true
c.collision_layer = 0 # layer 0 doesnt collide.
end
end
end
name_query = Query.from(name("Trap Preview", true) & component(:sprite, true))
name_query = Query.from(name("Trap Preview") & component(:sprite, capture: true))
# could be done as so or
world.system :trap_preview do |match, dt| # example from teh game mist trying to be made with this engine
world.system :trap_preview, for: name_query do |dt, matches| # example from the game mist trying to be made with this engine
# do trap placement logic when a trap is held
return unless world.holding_trap?
return unless world.globals.holding_trap?
# show a preview of the trap at the mouse position, you can use the mouse position relative to the world for this
e = name_query.get[0] # get the first entity that matches the name query, in this case the trap preview entity, this will be nil if no entity matches
e = matches[0] # get the first entity that matches the name query, in
# this case the trap preview entity, this will be nil if no entity matches
e.position = world.mouse_position_world
e.active = true # enable the trap preview entity to show it at the mouse position
end
# OR, this one isnt the exact same but shows that .active works on both entites and components
world.system :trap_preview, for: name("Trap Preview", true) & component(:sprite, true) do |match, dt|
return unless world.holding_trap?
world.system :trap_preview, for: name("Trap Preview", capture: true) & component(:sprite, capture: true) do |dt, matches|
return unless world.globals.holding_trap?
# if | was used between teh queries then the arrays would still be parallel but empty rows fit with nil
# for & between they will always match and so the arrays will always be the same length and so you can just use the first one to set the position of the entity and then use the second one to set the active of the sprite component, etc (without nil check)
match.second.each_with_index do |s, i|
match.first[i].position = world.mouse_position_world
# for & between they will always match and so the arrays
# will always be the same length and so you can just use
# the first one to set the position of the entity and then
# use the second one to set the active of the sprite component,
# etc (without nil check)
matches.second.each_with_index do |s, i|
matches.first[i].position = world.mouse_position_world
s.active = true
end
end
## ------ ##
world.shader :fog do |shader|
@@ -174,12 +190,16 @@ world.shader :fog do |shader|
}
frame do |shader|
# example of custom shader code for this shader, this is called every frame and is where you would update the shader data based on the current state of the world or whatever
# example of custom shader code for this shader, this is called every
# frame and is where you would update the shader data based on the
# current state of the world or whatever
shader.set_data :time, Time.now.to_f
shader.set_data :resolution, {x: width, y: height}
end
z = 100 # shaders always appear above normal sprites but z is used to sort them relative to each other, so a shader with z 100 will appear above a shader with z 50, but both will appear above normal sprites
z = 100 # shaders always appear above normal sprites but z is used to
# sort them relative to each other, so a shader with z 100 will
# appear above a shader with z 50, but both will appear above normal sprites
end
App.start menu_scene # first scene to show when the game starts, stops the loading bg
View File
+2 -2
View File
@@ -8,9 +8,9 @@ struct Vec2Wrapper : public Wrapper {
void Vec2_free(mrb_state *mrb, void *ptr) {
UNUSED(mrb);
uint64_t id = ((Wrapper *)ptr)->id;
uint64_t id = ((Vec2Wrapper *)ptr)->id;
app::element_pool.release(id);
delete (Wrapper *)ptr;
delete (Vec2Wrapper *)ptr;
}
const struct mrb_data_type Vec2_type = {"Vec2", Vec2_free};
+4 -1
View File
@@ -652,5 +652,8 @@ void Window::compute_transform() {
bool Window::mouse_in_window(const Vec2<float> real_position, Vec2<float> &virtual_position) {
virtual_position = (real_position - offset) / scale;
return virtual_position.x >= 0 && virtual_position.x <= virtual_size.x && virtual_position.y >= 0 && virtual_position.y <= virtual_size.y;
return virtual_position.x >= 0
&& virtual_position.x <= virtual_size.x
&& virtual_position.y >= 0
&& virtual_position.y <= virtual_size.y;
}
+1 -1
View File
@@ -359,7 +359,7 @@ But if i instead use a library that automatically detects and uses the appropria
This engine does not use a UI based builder. And so all gameplay logic, entity behaviour, definitions etc. must be implemented directly through code.
Because of this it is important to use a well established language in which the developer can write their code.
Embedded scripting languages are programming lanaguges that are designed to be embedded in a host programming language. The embedded language is often an interpreted language which the host is a compiled static typed language. They allow adding code to the program that can be modified and interpreted at runtime. They are often used to extend on the functionality of the host language. And they also allow using functions defined in the host language which are usually much more performance optimized.
Embedded scripting languages are programming lanaguges that are designed to be embedded in a host programming language. The embedded language is often an interpreted language while the host is a compiled static typed language. They allow adding code to the program that can be modified and interpreted at runtime. They are often used to extend on the functionality of the host language. And they also allow using functions defined in the host language which are usually much more performance optimized.
They are usually very lightweight (so that the final binary doesn't get bloated and runs fast enough). They are very useful for cuztom DSL/syntax.
+1 -1
View File
@@ -9,4 +9,4 @@
- about mruby/json scripting
- and usage of packer
(architectural design and file structure etc. of teh project itself)
(architectural design and file structure etc. of the project itself)
+531
View File
@@ -0,0 +1,531 @@
# Project Misth devlog.
### Initial setup
> Apr 29, 2026, 9:54 PM
Added files:
- `pch.h` this file imports all the libraries I use.
- `utils.h` This file adds helper functions to be used across the project:
- `MIN`, a macro that takes 2 numbers and returns the smaller one.
- `MAX`, a macro that takes 2 numbers and returns the larger one.
- `Color`, a struct with 8 bit fields for red, green, blue and alpha (transparency).
- `Vec2<T>`, a struct with 2 number fields used to store a vector
- It has the methods:
- `*` Scalar multiplier.
- `/` Scalar division.
- `+` Vector addition.
- `-` vector subtraction.
- `dot` Vector dot product.
- `dist` distance to another vector.
- `normalized` normalizes a vector.
- `angle_to` returns angle to another vector (in radians).
- `Line`, a (struct) set of 2 vectors start, end.
- Adds function: `intersects` returns true if it intersects given line, else false.
- `Rect`, a sturct, stores a single Line (its diagonal).
- Adds functions:
- `contains` returns if a point given is in the rectangle.
- `intersects` returns true if given rectangle or line intersects with any side.
- `window.h` & `window.cc`, this file adds an api layer over sdl to extract all the useful functions from sdl.
- `Font`, a struct to store and reference a font.
- `Event`, a struct to represent an sdl event in a more generic format.
- TODO: add list of actual events here.
- `Window`, the main class binding sdl functions to my project.
- It adds the functions: (TODO: explain each.)
- `load_image`
- `unload_image`
- `load_font`
- `unload_font`
- `create_text`
- `unload_text`
- `write`
- `draw`
- `draw_rect`
- `render`
- `clear`
- `poll`
- `consume`
- `start_text_input`
- `stop_text_input`
- `paste`
- `get_time`
- `delta_time`
- And a few more private ones.
- `Makefile`, The compilation commands.
### Sample files
> May 3, 2026, 11:04 PM
Added test files of how the final API should behave.
- `main.rb` & `button.rb`
## Dependency
> May 3, 2026, 23:04
Added the library mruby as a depenedancy.
## Setup C++ classes.
> May 3, 2026, 23:04
Files added:
- `ruby.h`
- Defines class to hold a ruby block called `Block`
- Defines a global variable `mrb` that stores a pointer to the running mrb instance.
- `app.h`
- Defines the class `Element`, an element stores the data of a particular object on the screen.
- with fields:
- `Vec2 position`
- `float rotation`
- `Vec2 scale`
- `float z` front/back
- `Ruby::Block on_click` - runs attached function on click
- `Ruby::Block on_update`
- `Ruby::Block on_hover`
- Defines the class `Scene`, a scene is a collection of elements.
- has field:
- `vector<Element> elements`
- Defines the class `App`, which owns the scenes, current scene and the actual display information (`Window`).
- Added a lot of stdlib dependencies to `pch.h` to not need importing every now and then and speed up compilation.
## Add basic interface
> May 4, 2026, 15:49
Major changes made:
Added a `Pool` class that can be used to store a performance efficient set of elements (compared to a `std::vector`).
- It has methods:
- `operator[]` to index a particular element by id.
- `all` to get the entire set as a std::vector.
- `aquire` to store an object.
- `release` to release an object.
In `window.h` added types for - `ImageID`, `FontID` & `TextID`
And used the pool system to recyle and gc these resources.
`window.cc` updated to reflect this change.
Added `localization.h` and localization semantics:
- defines a localization key as a 16bit integer.
- has a mapping from string to keys, the programmer refers to the keys by their string name.
- defines a language as a 32bit integer.
- a global variable for the current language.
- A mapping from a key+language to actual text.
- The function `get(Key)` that gtes a text based on the given key and current language.
In `app.h` updated `Element` class:
- Added defaults for the position, rotation, scale & z values.
- Added a field `click_through` to specify if object is mouse interactable.
- Added virtual functions:
- `~Element` destructor.
- `render` called each frame with frame time and a reference to the window object.
- `size` returns the current actual size of element (for click testing).
And Added class `Image` that inherits from and is an `Element`:
- Adds the fields:
- `animation` stores an ID to the animation displayed for this image.
- `alpha` a float that defines the opacity of the image.
- And definitions forthe virtual functions `size` and `render`
And added class `Text` which also inherits from `Element`:
- Adds the fields:
- `key` a localization key.
##
```
55f4b4d Add basic app interface
include/app/app.h | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
include/binding/ruby.h | 15 +++++++++++++-
include/localization/localization.h | 28 ++++++++++++++++++++++++++
include/utils.h | 54 +++++++++++++++++++++++++++++++++++++++++++++++++
include/window/window.h | 41 +++++++++++++++++++------------------
samples/button.rb | 2 +-
samples/main.rb | 17 ++++++++--------
src/main.cc | 6 +++---
src/window/window.cc | 100 +++++++++++++++++++++++++++---------------------------------------------------------------
9 files changed, 334 insertions(+), 113 deletions(-)
a51eb90 Fix main loop, add example and cleanup
include/app/app.h | 64 ++++++++++++++++++++++++++++++++++++++++------------------------
include/binding/ruby.h | 2 +-
include/utils.h | 9 ++-------
include/window/window.h | 19 +++++++++++++------
samples/button.rb | 8 ++++++--
samples/main.rb | 18 +++++++++---------
src/main.cc | 70 +++++++++++-----------------------------------------------------------
src/window/window.cc | 65 +++++++++++++++++++++++++++++++++++++++++++++--------------------
8 files changed, 127 insertions(+), 128 deletions(-)
1b15f51 Finish basic ui binding to ruby
include/app/app.h | 48 +++++++++++++++++--
include/binding/ruby.h | 16 +++++++
include/localization/localization.h | 43 +++++++++++++++--
include/pch.h | 3 ++
include/utils.h | 2 +-
samples/button.rb | 20 +++++---
samples/main.rb | 2 +-
src/main.cc | 423 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
src/window/window.cc | 1 +
tst.rb | 1 +
10 files changed, 536 insertions(+), 23 deletions(-)
6a29c11 Refractor
include/binding/ruby.h | 65 ++++++++++++++++++++++++++++-
src/main.cc | 408 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------------------------------------------------------
2 files changed, 216 insertions(+), 257 deletions(-)
d362bbc Refractor and cleanup binding logic
.clang-format | 3 +-
include/app/app.h | 2 ++
include/binding/definitions.h | 327 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/binding/ruby.h | 15 ++++++++
include/utils.h | 16 ++++-----
src/main.cc | 294 ++--------------------------------------------------------------------------------------------------------------------------------------------------------
src/window/window.cc | 6 ++--
7 files changed, 357 insertions(+), 306 deletions(-)
0da950c Fix major incorrect usage of mrb class definitions causing segfaults
Makefile | 4 +--
include/app/app.h | 47 ++++++++------------------------
include/binding/definitions.h | 258 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------
include/binding/ruby.h | 33 +++++++++++++++-------
include/pch.h | 16 +++++++++++
include/utils.h | 63 ++++++++++++++++++++++++++++++++----------
include/window/window.h | 12 +++++++-
samples/button.rb | 19 +++++++++----
src/window/window.cc | 73 ++++++++++++++++++++++++++++++-------------------
9 files changed, 383 insertions(+), 142 deletions(-)
306a053 Fix textures/font lifetimes
include/app/app.h | 33 ++++++++++++++++++++++++++-------
include/binding/definitions.h | 17 +++++++++--------
include/window/window.h | 40 ++++++++++++++++++++++++++--------------
src/window/window.cc | 38 --------------------------------------
4 files changed, 61 insertions(+), 67 deletions(-)
7e9a5a7 Cleanup / refractor
include/app/app.h | 6 +-----
include/binding/definitions.h | 13 +------------
src/window/window.cc | 6 ------
3 files changed, 2 insertions(+), 23 deletions(-)
08a642e Resolve macros and cleanup
include/binding/definitions.h | 640 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------------------------------------------
include/binding/ruby.h | 28 --------
samples/button.rb | 53 +++++++++++++++
3 files changed, 457 insertions(+), 264 deletions(-)
3894b90 Make pools with generations and bind mouse position logic
include/app/app.h | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------
include/binding/definitions.h | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
include/binding/ruby.h | 4 +++-
include/pch.h | 1 +
include/utils.h | 52 +++++++++++++++++++++++++++++++---------------------
include/window/window.h | 23 ++++++++++++-----------
samples/button.rb | 20 +++++++++++---------
src/window/window.cc | 55 ++++++++++++++++++++++++++++++-------------------------
8 files changed, 221 insertions(+), 125 deletions(-)
65109cc Add ruby bindings for internal structures, allow better controlled localization
include/app/app.h | 45 +++++---
include/binding/definitions.h | 941 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
include/binding/ruby.h | 2 +
include/localization/localization.h | 92 +++++++++++++++--
include/utils.h | 6 +-
include/window/window.h | 13 ++-
samples/button.rb | 39 +++----
src/window/window.cc | 27 +++--
8 files changed, 1049 insertions(+), 116 deletions(-)
a77f75d Cleanup
src/app/app.cc | 0
src/test.c++ | 110 --------------------------------------------------------------------------------------------------------------
2 files changed, 110 deletions(-)
0f693a5 Fix inputs and add methods
include/app/app.h | 34 ++++++++++++++++++++++++-
include/binding/definitions.h | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
include/window/window.h | 239 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------
samples/button.rb | 50 +++++++++---------------------------
src/window/window.cc | 37 +++++----------------------
tests/a.out | Bin 0 -> 97008 bytes
tests/array_vs_hash.cc | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/benchmark.csv | 31 +++++++++++++++++++++++
tests/benchmark.png | Bin 0 -> 152360 bytes
tests/grapher.py | 24 ++++++++++++++++++
tests/o0-N20.png | Bin 0 -> 148198 bytes
tests/o0-N3.png | Bin 0 -> 145431 bytes
12 files changed, 499 insertions(+), 92 deletions(-)
820d6c1 analysis outline
notes.md | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
1a1d399 Analysis update
notes.md | 16 ----------------
samples/main.rb | 6 ++----
writeup/analysis.md | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 153 insertions(+), 20 deletions(-)
14e5cca Update analysis doc
writeup/analysis.md | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 79 insertions(+), 17 deletions(-)
8ddc314 Analysis update
writeup/analysis.md | 79 +++++++++++++++++++++++++++++++++++++++++++++----------------------------------
1 file changed, 45 insertions(+), 34 deletions(-)
a692bfb Analysis suvey addition
writeup/analysis.md | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------
1 file changed, 68 insertions(+), 22 deletions(-)
7bdb74e trynna fix click handler being garbage collected
include/app/app.h | 5 +++--
include/binding/ruby.h | 11 +----------
samples/main.rb | 7 +++++++
src/main.cc | 2 ++
writeup/analysis.md | 25 +++++++++++++++++++++++++
5 files changed, 38 insertions(+), 12 deletions(-)
1a33760 Fix gc issue
include/app/app.h | 5 +----
include/binding/ruby.h | 11 +++++++++--
2 files changed, 10 insertions(+), 6 deletions(-)
7d48b22 Fix loop to be more accuratly timed, and added custom ruby libs inclusion setup
.gitignore | 4 +-
Makefile | 16 ++-
include/app/app.h | 22 ++--
include/binding/ruby.h | 10 ++
include/window/window.h | 4 +-
libs/l_mgems/compile.sh | 40 +++++++
libs/l_mgems/pp.rb | 1010 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
samples/button.rb | 29 ++++--
src/main.cc | 1 +
src/window/window.cc | 7 +-
writeup/analysis.md | 1 +
11 files changed, 1117 insertions(+), 27 deletions(-)
75b1bc5 Added .inspect and .to_s for debug help
include/binding/definitions.h | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
include/localization/localization.h | 8 ++++++++
include/utils.h | 2 +-
3 files changed, 64 insertions(+), 3 deletions(-)
6ff16e3 Added proper hit test with rotation and pivoting
include/app/app.h | 54 +++++++++++++++++++++++++++++++++++++-----------------
include/binding/definitions.h | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----
include/binding/ruby.h | 1 +
include/utils.h | 9 +++++++--
include/window/window.h | 7 ++++---
samples/button.rb | 6 ++++--
src/window/window.cc | 30 ++++++++++++++++++++++++------
7 files changed, 181 insertions(+), 35 deletions(-)
2bff3eb Improve loop with fps control
include/app/app.h | 33 +++++++++++++++++++++++----------
include/binding/definitions.h | 24 ++++++++++++++++++++++--
include/window/window.h | 3 +--
samples/button.rb | 12 ++++++++----
src/window/window.cc | 11 -----------
5 files changed, 54 insertions(+), 29 deletions(-)
72304ee Add better click through semantics
include/app/app.h | 15 ++++++++++-----
include/binding/definitions.h | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------------
include/binding/ruby.h | 5 ++++-
samples/button.rb | 12 ++++++------
samples/main.rb | 9 ---------
writeup/analysis.md | 31 ++++++++++++++++++++++++++++---
6 files changed, 180 insertions(+), 57 deletions(-)
e1d1874 Add global update loop, and cleanup
include/app/app.h | 13 ++++++++++---
include/binding/definitions.h | 26 ++++++++++++++++++++++----
samples/button.rb | 27 +++++++++++++++++++--------
writeup/analysis.md | 2 ++
4 files changed, 53 insertions(+), 15 deletions(-)
582b2fc Make localization parameters better, and add a single frame animation helper
include/app/app.h | 21 ++++++---------------
include/binding/definitions.h | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------
include/binding/ruby.h | 6 ++++++
include/localization/localization.h | 11 ++++-------
samples/button.rb | 9 +++++----
5 files changed, 122 insertions(+), 50 deletions(-)
872d878 bugs and perfomance cleanup.
include/app/app.h | 14 ++++++++++----
include/binding/definitions.h | 6 ++++--
include/binding/ruby.h | 2 --
include/localization/localization.h | 2 +-
include/utils.h | 6 +++++-
samples/stress.rb | 129 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 149 insertions(+), 10 deletions(-)
dcb8b46 chore: split monolithic header to proper program files, add vec2 ruby class to proxy element position etc., other cleanup
Makefile | 39 ++--
include/app/app.h | 2 +-
include/binding/definitions.h | 1986 --------------------------------------------------------------------------------------------------------------------------------------------------------------------
include/bindings/definitions.h | 63 ++++++
include/{binding => bindings}/ruby.h | 2 +-
include/bindings/ruby_compiled.h | 1038 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
libs/l_mgems/compile.sh | 4 +-
samples/button.rb | 7 +-
samples/stress.rb | 8 +-
src/bindings/animation.cc | 187 ++++++++++++++++
src/bindings/app.cc | 206 +++++++++++++++++
src/bindings/element_image.cc | 326 +++++++++++++++++++++++++++
src/bindings/element_rect.cc | 349 +++++++++++++++++++++++++++++
src/bindings/element_text.cc | 411 ++++++++++++++++++++++++++++++++++
src/bindings/font.cc | 72 ++++++
src/bindings/image.cc | 78 +++++++
src/bindings/params.cc | 68 ++++++
src/bindings/scene.cc | 199 +++++++++++++++++
src/bindings/vec2.cc | 90 ++++++++
src/main.cc | 2 +-
writeup/analysis.md | 53 ++---
21 files changed, 3153 insertions(+), 2037 deletions(-)
c24285b Refractor headers and split code into program files for app & localization files. Split keybinds from window.h file. General cleanup
include/app/app.h | 332 ++++------------------------------------------------------------------------------------------------------------------------------------------------------------------
include/app/elements.h | 87 ++++++++++++++++++++++++++++++++++++++++++++
include/app/scene.h | 33 +++++++++++++++++
include/localization/localization.h | 116 ++++++----------------------------------------------------
include/window/keybinds.h | 221 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
include/window/window.h | 215 +----------------------------------------------------------------------------------------------------------
samples/stress.rb | 4 +-
src/app/app.cc | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/app/elements.cc | 77 +++++++++++++++++++++++++++++++++++++++
src/app/scene.cc | 91 ++++++++++++++++++++++++++++++++++++++++++++++
src/localization/localization.cc | 114 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
11 files changed, 755 insertions(+), 646 deletions(-)
55241b9 Fix missing function declaration.
include/localization/localization.h | 2 ++
1 file changed, 2 insertions(+)
e7418fd Added pixel texture element
include/app/elements.h | 34 ++++++++++++++++++--
include/bindings/definitions.h | 3 ++
include/window/window.h | 29 +++++++++++++++--
samples/button.rb | 14 +++++++--
samples/main.rb | 10 +++---
src/bindings/element_script.cc | 291 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/bindings/scene.cc | 76 ++++++++++++++++++++++++++++++++++-----------
src/window/window.cc | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
writeup/analysis.md | 2 +-
9 files changed, 567 insertions(+), 30 deletions(-)
419e95a Remove element script and allow images to be pixel updated for similar behaviour
include/app/elements.h | 31 +------------------
include/bindings/definitions.h | 3 --
include/window/window.h | 22 ++-----------
samples/button.rb | 26 ++++++++++------
src/bindings/animation.cc | 7 ++---
src/bindings/element_script.cc | 291 ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------
src/bindings/image.cc | 47 +++++++++++++++++++++++++---
src/bindings/scene.cc | 14 ---------
src/window/window.cc | 252 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------------------------------
9 files changed, 176 insertions(+), 517 deletions(-)
821255a Add tileset loading
include/bindings/ruby.h | 2 ++
include/window/window.h | 1 +
samples/button.rb | 9 ++++++++-
src/bindings/image.cc | 45 ++++++++++++++++++++++++++++++++++++++++++++-
src/window/window.cc | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
writeup/analysis.md | 4 ----
6 files changed, 118 insertions(+), 6 deletions(-)
4c53e5f Setup ecs system scaffolding
include/app/elements.h | 14 +++++++++++++-
include/ecs/ecs.h | 10 ++++++++++
writeup/analysis.md | 2 ++
3 files changed, 25 insertions(+), 1 deletion(-)
dd34bc6 Updare writeup and gitignore
.gitignore | 4 +++-
writeup/analysis.md | 37 +++++++++++++++++++++++++------------
2 files changed, 28 insertions(+), 13 deletions(-)
11135a5 Writeup update
writeup/analysis.md | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
5e1b92e Rearrange writeup
writeup/analysis.md | 45 ++++++++++++++++++++++-----------------------
1 file changed, 22 insertions(+), 23 deletions(-)
4eae85c Add design stage and touch up analysis writeup
writeup/analysis.md | 10 +++++++++-
writeup/design.md | 12 ++++++++++++
2 files changed, 21 insertions(+), 1 deletion(-)
9620b57 Merge notes and analysis
notes.md | 103 -----------------------------------------------------------------------------
writeup/analysis.md | 243 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------------------------
2 files changed, 189 insertions(+), 157 deletions(-)
fabcad8 Add flake.nix
.gitignore | 2 +-
Makefile | 8 +-
flake.lock | 27 +++++
flake.nix | 41 +++++++
include/bindings/ruby_compiled.h | 1038 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------
libs/mruby | 2 +-
6 files changed, 74 insertions(+), 1044 deletions(-)
9bd1ee7 Cleanup
setup.rb | 4 ++--
tst.rb | 1 -
2 files changed, 2 insertions(+), 3 deletions(-)
8f73f09 Remove setup script
.gitignore | 2 +-
Makefile | 9 +--------
flake.nix | 1 +
include/app/scene.h | 2 +-
setup.rb | 14 --------------
5 files changed, 4 insertions(+), 24 deletions(-)
7a9b44a Fix clangd
.gitignore | 4 ++++
Makefile | 4 ++--
flake.nix | 1 +
include/pch.h | 3 +--
src/main.cc | 2 +-
5 files changed, 9 insertions(+), 5 deletions(-)
a9054b3 Cleanup
flake.nix | 23 +++++++++++++++--------
include/app/elements.h | 4 ++--
include/ecs/ecs.h | 8 ++++++--
samples/button.rb | 8 +++++++-
src/app/app.cc | 2 +-
5 files changed, 31 insertions(+), 14 deletions(-)
1935be5 try fixing flake
Makefile | 33 ++++++++++++++++-----------------
flake.nix | 152 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-------------------------------------
libs/changes.patch | 30 ++++++++++++++++++++++++++++++
{libs/l_mgems => scripts}/compile.sh | 6 +++---
{libs/l_mgems => scripts}/pp.rb | 0
5 files changed, 164 insertions(+), 57 deletions(-)
edad8ff Refractor directory name
Makefile | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
9f4c345 Fix nix flake and use gcc as compiler
.gitignore | 2 ++
Makefile | 16 +++++++---------
flake.nix | 67 +++++++++++++++++++++++++++++--------------------------------------
3 files changed, 38 insertions(+), 47 deletions(-)
2006ee5 Remove clang specific warning
Makefile | 2 --
1 file changed, 2 deletions(-)
2f70c44 Fix incorrect comparision
include/utils.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
f82ab71 Make fread call error handle
src/main.cc | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
d484db4 Format files (using clang-format)
include/app/app.h | 2 +-
include/bindings/definitions.h | 2 +-
include/bindings/ruby.h | 2 +-
include/localization/localization.h | 2 +-
include/window/keybinds.h | 2 +-
src/app/elements.cc | 2 +-
src/app/scene.cc | 2 +-
src/bindings/element_image.cc | 2 +-
src/bindings/element_rect.cc | 2 +-
src/bindings/element_text.cc | 2 +-
src/bindings/font.cc | 2 +-
src/bindings/image.cc | 2 +-
src/bindings/params.cc | 2 +-
src/bindings/vec2.cc | 2 +-
src/localization/localization.cc | 2 +-
src/ruby/query.rb | 2 +-
src/window/window.cc | 2 +-
17 files changed, 17 insertions(+), 17 deletions(-)
e0994b4 Add some useful mgems
.gitmodules | 9 +++++++++
libs/changes.patch | 23 +++++++++++++++++++++++
libs/mgems/mruby-env | 1 +
libs/mgems/mruby-marshal-c | 1 +
libs/mgems/mruby-process | 1 +
samples/button.rb | 2 +-
6 files changed, 36 insertions(+), 1 deletion(-)
e188501 Setup python env
flake.nix | 11 +++++++++++
tests/grapher.py | 2 +-
2 files changed, 12 insertions(+), 1 deletion(-)
8a3da07 (HEAD -> main, origin/main) Cleanup
src/main.cc | 1 +
1 file changed, 1 insertion(+)
```
+5
View File
@@ -0,0 +1,5 @@
implement a virtual file system for assets / scripts:
that can use either:
1. file system, when used with `misth run ./input.rb`
2. .misthpack file when used with `misth run ./input.misthpack` (produced with `misth build ./input.json`)