Old notes
This file contains some old notes I made in the past. It is largely unstructured.
TODO: could explain stuff using test runner
problems with framework
what is Add vs AddInternal?- How do Clocks work?
- How to make buttons that size to fit content? Optionally size to fit container in X?
- Scroll container, how to stop contents from disappearing when scrolling up?
Notes:
- Button needs to be given an Action
ideas for roslyn analyzer:
- error when BDL is not private
- error if using bad AutoSize- or RelativeSizeAxes
- Error when adding object twice to children?
Framework info
Drawables
TODO (drawable, compositedrawable, etc)
Containers
Namespace: osu.Framework.Graphics.Containers
List of containers (excluding Markdown):
- CompositeDrawable
- Container
- BufferedContainer
- CircularContainer
- ClickableContainer
- DrawSizePreservingFillContainer
- FlowContainer
- FillFlowContainer
- SearchContainer
- TextFlowContainer
- CustomizableTextContainer
- FillFlowContainer
- SafeAreaContainer
- SafeAreaDefiningContainer
- ScrollContainer
- BasicScrollContainer
- TabbableContainer
- VisibilityContainer
- OverlayContainer
- FocusedOverlayContainer
- OverlayContainer
- DelayedLoadWrapper
- DelayedLoadUnloadWrapper
- DrawableAudioWrapper
- AudioContainer
- DrawableSample
- DrawableTrack
- GridContainer
- LifetimeManagementContainer
- ModelBackedDrawable
- RearrangeableListContainer
- RearrangeableListItem (abstract)
- TableContainer
- Container
Up to date as of 25/6/2021.
Markdown
TODO
Screens
A Screen is a CompositeDrawable that implements IScreen and can be used with a ScreenStack.
A Screen can be thought of as a menu in a game: you start with your first screen (eg. the main menu) and when clicking a button you push a new menu on the stack (eg. the options or gameplay screen). A screen can be exited again by popping it off the stack, which will return you to the previous screen. The osu-framework wiki describes this as sheets of papers.
IScreen has some extention methods such as Push(newScreen) and Exit() to easily allow pushing and popping screens.
A base class that inherits from Screen can be made to automatically provide animations when transitioning or to place a permanent back button on the screen.
Input
TODO
Implementing new input methods in your game
Basic required classes:
- A custom
InputHandlerthat generates inputs. - An input class (implements
IInput, can also simply extend fromButtonInput<T>). Denotes a single input, can be applied to anInputState. This could be a simple collection of all current input states, according to the device. - An input state class, to be put in
InputState. Contains information about the entire state of the input device (ie. all individual buttons). - Input state change events, represents the change of an
InputState(extendsInputStateChangeEvent) - UI-level events (extend
UIEvent), gets created in anInputManager. Separate events for different actions like KeyUp, KeyDown, MouseClick, MouseDoubleClick, etc.
Adding from within a game:
- Override
InputStateto add your own state. - Override
UserInputManagerSeeUserInputManagerfor the original implementations.- Override
CreateInitialStatecreates your custom state. - Override
HandleInputStateChangechecks if an event is your custom one (and callsPropagateBlockableEvent) or passes down to the base method. - Override
InputHandlersto add your own input handler.
- Override
- In your
Gameclass, overrideCreateUserInputManagerto return your customUserInputManager.
Resource stores
TODO
Audio
Namespace: osu.Framework.Audio
TODO
AudioManager, AudioManager.Tracks and AudioManager.Samples are added to DI. Tracks and Samples can be retrieved through that ITrackStore and ISampleStore respectively. Tracks and Samples can be stored in the Resources/Tracks and Resources/Samples folders to be automatically accessible.
Every audio component inherits from AudioComponent which provides HasCompleted, IsAlive, IsLoaded.
AdjustableAudioComponent extends AudioComponent and implements IAggregateAudioAdjustment and IAdjustableAudioComponent. Volume, Balance and Frequency can be changed.
TODO: AudioCollectionManager "allows managing multiple AdjustableAudioComponents". Used to keep BASS device in sync?
AudioManager extends AudioCollectionManager. Has ITrackStore Tracks, ISampleStore Samples, BindableDouble VolumeSample, BindableDouble VolumeTrack
IAdjustableResourceStore<T> : IResourceStore<T>, IAdjustableAudioComponent
Sample
Namespace: osu.Framework.Audio.Samples
TODO
Sample extends AudioComponent and is abstract. Its constructor allows passing playback concurrency (polyphony). TODO how to create?
ISampleChannel has Play(bool restart = true), Stop(), bool Playing, bool Played
SampleChannel extends AdjustableAudioComponent and implements ISampleChannel. Is abstract; actual implementation is SampleChannelBass. They expose Play(bool restart = true), Stop(), bool Playing, bool Played, bool IsAlive.
SampleStore extends AudioCollectionManager and ISampleStore. It has a SampleChannel Get(string name) method and an async equivalent.
Track
Namespace: osu.Framework.Audio.Tracks
TODO
ITrack has properties Looping, RestartPoint (for loop or Restart), CurrentTime, Length, IsRunning and methods Reset(), Restart(), ResetSpeedAdjustments(), bool Seek(double seed), Start(), Stop().
Track, implementation is TrackBass
ISampleStore, for some reason in .Audio.Tracks.
ITrackStore
Clocks
Namespace: osu.Framework.Timing.
Clocks are usually used to control the timing of Transitions on Drawables or of audio.
Interfaces
IClock: Read-only clock info. Provides CurrentTime, Rate and IsRunning getters. Other interfaces implement this too.IAdjustableClock: Read/write clock. Can start, stop, reset, seek and its rate can be changedIFrameBasedClock: Has a methodProcessFramewhich will update the clock. ElapsedFrameTime, FramesPerSecond and TimeInfo have stats.ISourceChangeableClock: Allows changing the underlying IClock source. Useful for building on other IClocks
Classes
-
ManualClock: The most basic implementation ofIClockwith all properties writable. Note that this only implementsIClock, notIAdjustableClock. You probably wantStopwatchClockinstead. -
StopwatchClock: A basic clock. Built on theSystem.Diagnostics.Stopwatchclass, implementsIAdjustableClock. -
OffsetClock: A clock that extends another clock, but adds an offset to its CurrentTime. ImplementsIClock. -
FramedClock: An implementation ofIFrameBasedClockwhich extends another clock. It implementsIFrameBasedClockandISourceChangeableClock.FramedOffsetClock: An extension ofFramedClockwhich adds an offset.ThrottledFrameClock: An extension ofFramedClockwhich has a propertyMaximumUpdateHzto throttle the rate at whichProcessFrameis called. It does this by blocking the thread until the next ProcessFrame is allowed to be called. This should probably be used by running ProcessFrame in a loop on another thread. Limiting can be disabled by settingMaximumUpdateHzto be less than or equal to 0.
-
InterpolatingFrameClock: A clock that extends another clock, but "smooths it out". This is can be used on anIFrameBasedClockwith low update rate to make it appear to have a higher update rate. Can also be used on other clocks if they don't update in real-time.DecoupleableInterpolatingFramedClock: An extension ofInterpolatingFrameClockwhich "can keep running even if the underlying source has been stopped or cannot handle the current time range". TODO: what does this mean in practice?
Config
TODO
Dependency injection
TODO
Standard DI items
- TextureStore
- AudioManager
- ITrackStore
- ISampleStore
- ShaderManager
- FontStore
- LocalisationManager
- ISafeArea
- GameHost
- Storage
- FrameworkDebugConfigManager
- FrameworkConfigManager
- InputManager
- YourGame