Compare commits

...

3 Commits

Author SHA1 Message Date
Jill 5f20d0e906 pull from upstream 2022-09-29 01:12:22 +03:00
Jill 451097adb6 document __raw 2022-09-29 00:50:08 +03:00
Jill fd1a0b0427 profiler documentation 2022-09-29 00:42:36 +03:00
2 changed files with 30 additions and 1 deletions

View File

@ -24,6 +24,7 @@ Uranium Template originally formed during the creation of a currently unreleased
- [How do I start writing code?](#how-do-i-start-writing-code)
- [Defining actors](#defining-actors)
- [Initializing actors](#initializing-actors)
- [Accessing raw actors](#accessing-raw-actors)
- [Actor-specific notes](#actor-specific-notes)
- [`ActorFrameTexture`](#actorframetexture)
- [`ActorFrame`](#actorframe)
@ -120,6 +121,7 @@ Uranium Template originally formed during the creation of a currently unreleased
- [`rng:jump(): void`](#rngjump-void)
- [`rng:longJump(): void`](#rnglongjump-void)
- [`ease`](#ease)
- [`profiler`](#profiler)
- [`util`](#util)
- [`aft`](#aft)
- [`noautplay`](#noautplay)
@ -231,6 +233,27 @@ sprite:addcommand('Init', function(self)
end)
```
### Accessing raw actors
As you may have noticed, when you print an actor defined with Uranium, it won't show up as an actor - it'll show up as a "proxy" of an actor. This is because we can't actually get actors created on demand in NotITG - what happens instead is you get an object that _acts_ like an actor by calling all the same methods you pass into it, but isn't really one.
```lua
local q = Quad()
print(q) --> 'Proxy of Quad'
```
Typically, this doesn't matter; however, in certain contexts, it may be required for you to get the raw actor from a proxy actor. You can do this by accessing `__raw` on the actor - this is defined on all actors and is only available _post-initialization_.
```lua
local q = Quad()
print(q.__raw) --> nil
q:addcommand('Init', function()
print(q.__raw) --> 'Sprite (168F7F78)'
end)
```
For most things that require this, there exist simple abstractions - applying shaders has `setShader`, `setShaderfuck`, etc., however in rare circumstances this may be useful. _Please let me know if there's a use-case that I haven't accounted for!_
### Actor-specific notes
#### `ActorFrameTexture`
@ -986,6 +1009,12 @@ _Exports globals_
A direct copy of [Mirin Template's `ease.lua`](https://github.com/XeroOl/notitg-mirin/blob/master/template/ease.lua), for convinience. See the docs for those [**here**](https://xerool.github.io/notitg-mirin/docs/eases.html).
### `profiler`
_Defines callbacks_
A simple profiler for Uranium Template's callback system. Require it and it'll display in the left-top corner of your screen, showing what callback functions are taking the longest to run.
### `util`
_Exports globals_

@ -1 +1 @@
Subproject commit 4e8ba205621df4df01643dc6eea181656fc23bf8
Subproject commit 8262b62e4c991658661581d9b52b7ebb3b3f585f