Skip to content

Commit

Permalink
Refactored crates around and added generics
Browse files Browse the repository at this point in the history
Co-authored-by: Shark <[email protected]>

This is a rather large commit that was needed in order to let the
gosub_html5 and gosub_css3 crates to be dependend on eachother. The
problem was that they both need eachother and resulted in a cyclic
dependency. We solve this usually by moving stuff to the gosub_shared
crate, but in this case it would mean we practically move EVERYTHING to
that crate.

So instead we created a lot of traits in the gosub_shared that can be
used by the other crates. This way, both html5 and css3 crates do not
need to be depenended on eachother, but only on the gosub_shared crate.

However, it crates a lot of extra efford in getting this up and running,
the traits and generics means that A LOT of code must be refactored into
this system, during which we found out that a lot of code is not on the
correct places. We moved around much of the code so it kinda makes sense
again.

This resulted in the removal of the gosub_styling crate, which was a
sort of bridge between the css3-system and other things, which now lives
in the css3 crate (which we now properly could manage).

There are still problems we're facing, but overal the refactoring looks
good.

Note that creating this trait setup resulted in redesigning a new engine
architecture (unimaginably named "engine_v2"), in which we are
redesigning the way we deal with all components. It should resolve all
the trait bottlenecks we currently have and hopefully we will be able to
refactor the current engine into that one. For now, we keep on working
on this system.
  • Loading branch information
jaytaph committed Sep 29, 2024
1 parent b9d339d commit d5504b0
Show file tree
Hide file tree
Showing 244 changed files with 9,703 additions and 10,860 deletions.
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ local/
settings.db

# C API tests (ignore everything but source files)
*/gosub_bindings/tests/*
!*/gosub_bindings/tests/*.c
*.dSYM
4 changes: 0 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ In the root directory, run `make format` to have clippy automatically fix some o
### Running Benchmarks
In the root directory, run `make bench` to run the benchmarks.

### Building C API Bindings
In the `crates/gosub_bindings` directory, run `make bindings` to build the C static libraries. For more information on this, see the [README](crates/gosub-bindings/README.md).

Can also run `make test` in the same directory to build and run the tests for the C bindings.

## Code Style
We use cargo's built-in formatter. When running `make test`, the formatter will also run (after all the tests) and display any issues in a `git diff`-like output in the terminal. Please resolve these formatting issues prior to pushing any code! This is validated in our CI when creating a pull request.
Expand Down
Loading

0 comments on commit d5504b0

Please sign in to comment.