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

Major Refactor 2024 #40

Merged
merged 15 commits into from
Sep 30, 2024
Merged

Major Refactor 2024 #40

merged 15 commits into from
Sep 30, 2024

Conversation

smack0007
Copy link
Owner

@smack0007 smack0007 commented Sep 10, 2024

Before the release of SDL 3 is upon us there are a few things I would like to implement. These points will be implemented as a series of pull requests in no specific order.

  • Automatic error checking in functions.

    • Error codes should be checked automatically and throw an exception if needed. Infrastructure should be implemented but may not be enabled in all functions due to lacking tests.
  • Output parameters should be returned as tuples.

    • Functions like SDL_CreateWindowAndRenderer should return the output parameters (i.e. window and renderer in this case) as a tuple instead of having to create Box(es) and giving them to the functions.
  • Remove custom number types (u8, i32, etc.) and instead just use the same types as SDL (Uint8, int).

    • Currently the names of some types from SDL are being mapped to names in SDL_ts. This is just confusing and unnecessary. Just leave the names of the types the same as in SDL and create types in SDL_ts with the same name. (i.e. export type Uint8 = number;)
  • Make Box<T> of private. Don't export it.

    • Once points 1 and 2 are implemented Box<T> should become unnecessary for consumers of the API.
  • Remove Memory.

    • Once points 1 and 2 are implemented Memory should become unnecessary for consumers of the API.
  • Investigate removing or making private Pointer<T> .

    • Similar to the previous point, once 1 and 2 are implemented Pointer<T> should start to slowly become irrelevant for consumers of the API.
  • BoxArray => StructArray

    • BoxArray was really only necessary in order to be able to send multiple structs to the native side.
  • Make Opaque Structs just simple branded types again.

    • Opaque Struct(s) should just be a branded type instead of a complete class definition.

@smack0007 smack0007 changed the title Major Refactor Step 1 / N Major Refactor 2024 Sep 18, 2024
@smack0007 smack0007 merged commit 88799ce into main Sep 30, 2024
1 check passed
@smack0007 smack0007 deleted the major-refactor-1 branch September 30, 2024 10:37
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.

1 participant