Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nene rework #2

Merged
merged 96 commits into from
Aug 3, 2021
Merged

Nene rework #2

merged 96 commits into from
Aug 3, 2021

Conversation

Andre-LA
Copy link
Owner

@Andre-LA Andre-LA commented May 1, 2021

work in progress rework of Nene, to make it more organized and modular.

Andre-LA added 30 commits April 29, 2021 20:44
The major change is that `Nene.Core` really acts more like a "Core",
that is, it doesn't depends on any other Nene module (except `Nene.Math`
and `Nene.Color`) and only holds the minimum information it needs to
work.

The removed functions will be moved to others modules in future commits.

Signed-off-by: André Luiz Alvares <[email protected]>
`Nene.Main` will get some responsibilities that was part of `Nene.Core`
module, especially "load_music" and similar methods.

It isn't required by any other modules, but it requires all of them.

It also will feature some resource management to make Nene more easier
to work with.

If `Main` doesn't fit your needs, you can also make your own "Main",
since it just a record after all.

Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Wrapped functions:
* SDL_SetTextureColorMod
* SDL_QueryTexture
* SDL_RenderCopy

(I made a mistake committing, this commit should have come before the
previous commit, sorry)

Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Also some code cleanup and improved documentation.

Signed-off-by: André Luiz Alvares <[email protected]>

Signed-off-by: André Luiz Alvares <[email protected]>
Also add documentation about it.

Signed-off-by: André Luiz Alvares <[email protected]>
More functions will be added once I start the refactor of other modules

Signed-off-by: André Luiz Alvares <[email protected]>

Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Many (if not all) SDL functions returns `0` on success, not on fail

Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
WIP: it actually not require everything yet, I'll add
the other modules with time.

Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
It works! However, it isn't using `TextTexture` yet.

Signed-off-by: André Luiz Alvares <[email protected]>
* `load` function try to load a font from a filename and return a new
`Nene.Font`;
* `get` methods does a check to avoid using a `nilptr` data;
* `destroy` free the font and it's contents, also sets data to `nilptr`.

Signed-off-by: André Luiz Alvares <[email protected]>
Also, the `text` field wasn't been updated, this is fixed now.

Signed-off-by: André Luiz Alvares <[email protected]>
Signed-off-by: André Luiz Alvares <[email protected]>
Otherwise SDL wrappers complains about Nene being uninitialized.

Signed-off-by: André Luiz Alvares <[email protected]>
Andre-LA added 29 commits July 15, 2021 21:26
get_renderer_info end up unused, but is probably better to not remove
it since it's a wrapper.
It's just better to use `Texture.create_texture` in the end
Animation implementation will go to animation.
The shapes image is used on example, but it can also be helpful for
prototype development.
Also adds some functions for MixWrapper and docs improvements.
* Both `is_point_intersecting` and `is_rect_intersecting` got merged in
`is_intersecting` function

* `is_vec` property renamed to `is_vec2`
… example

The algorhythm is simple, but it works, I'll add some more details
about it later.

Also added a new example, it shows:
* rect (line and filled) drawing
* rect intersection
* rect from simple collision
@Andre-LA Andre-LA merged commit 142ac0b into main Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants