-
Notifications
You must be signed in to change notification settings - Fork 0
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
Remove redundant functions from API #88
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pi was providing pi.Time() function in order to be compatible with Pico-8. Additionally, Pi provided pi.TimeSeconds with the same value. I made a decision to remove redundancy from the API. This commit removes the pi.Time function, and replaces it with variable pi.Time.
elgopher
force-pushed
the
api-cleanup
branch
3 times, most recently
from
August 13, 2023 05:54
5a014ca
to
315a920
Compare
elgopher
changed the title
API cleanup [experimental]
Remove redundant functions from API [experimental]
Aug 13, 2023
Pi was providing pi.Camera() and pi.CameraReset() functions in order to be compatible with Pico-8. Additionally, Pi provided pi.ScreenCamera. I made a decision to remove redundancy from the API. This commit removes the pi.Camera() and pi.CameraReset() function. Now game developer can use pi.Camera variable instead. I added two methods to pi.Position which can be very handy: * Set(x,y) * Reset()
In order to be compatible with Pico-8, Pi was resetting the clipping region in Cls() and ClsCol() functions. This is misleading and violates the single responsibility principle. That's why I decided to remove this behaviour.
elgopher
changed the title
Remove redundant functions from API [experimental]
Remove redundant functions from API
Aug 13, 2023
elgopher
force-pushed
the
api-cleanup
branch
2 times, most recently
from
August 13, 2023 10:39
c028e6f
to
a867370
Compare
…Reset These 5 functions are redundant. Programmer can use public variables for draw and display palette or color transparency. This commits also renames pi.DrawPalette to pi.Pal, pi.DisplayPalette to pi.Pald, and pi.ColorTransparency to pi.Palt. Shorter names are better, especially when writing the code by hand in REPL terminal. This commit also adds two new types: pi.PalMapping and pi.Transparency. Both provide Reset() method.
…sePos Using functions which returns two parameters is sometimes cumbersome. That's why I removed pi.MousePos(). Another reason for removing pi.MousePos() was that there were two sources of the same information - pi.MousePosition var and pi.MousePos().
Reorganize file, so public functions are on the top.
Pi is using similar concepts to Pico-8, but not same names or same function signatures. For example: pi.Pal is a variable in Pi, but in Pico-8 it is a function.
Add info how to acquire resources object.
…i.Sget pi.Sset and pi.Sget is used very rarely. And programmer could run pi.SprSheet().Set() instead. The effect will be the same. pi.Pset and pi.Pget have misleading names. They should propably have names using 2 capital letters eg. PSet. After pi.Sset is removed, then I can safely use pi.Set which is great name to remember.
Use specific type name, so the user can quickly find out in the docs what are the values of given type.
This resolution is no longer possible to use for the screen size. Max is 64KB (eg 256x256).
Add type to pi.Palette var, even though it can be inferred by compiler. This is needed to generate better godoc documentation.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
To keep compatiblity with Pico-8, Pi provides a lot of redundant functions. This make API big and harder to understand. Users might be confused which function/variable should they use. Also from the Pi developer point of view - more code need to be maintained.