├── .gitattributes
├── nuget.config
├── Vignette.Desktop
├── vignette.ico
├── vignette-insiders.ico
├── Program.cs
├── VignetteGameDesktop.cs
└── Vignette.Desktop.csproj
├── Vignette.Camera.Tests
├── Resources
│ ├── earth.mp4
│ └── TestResources.cs
├── Program.cs
├── CameraVirtualTest.cs
├── TestCameraVirtual.cs
├── Visual
│ ├── TestSceneDrawableCameraDevice.cs
│ └── TestSceneSharedCamera.cs
├── CameraManagerTest.cs
├── Vignette.Camera.Tests.csproj
└── VisualTestGame.cs
├── Vignette.Game.Resources
├── Fonts
│ ├── Vignette.fnt
│ ├── Vignette_0.png
│ ├── SegoeUI
│ │ ├── SegoeUI.fnt
│ │ ├── SegoeUI_0.png
│ │ ├── SegoeUI-Black.fnt
│ │ ├── SegoeUI-Bold.fnt
│ │ ├── SegoeUI-Light.fnt
│ │ ├── SegoeUI-Black_0.png
│ │ ├── SegoeUI-Bold_0.png
│ │ ├── SegoeUI-Italic.fnt
│ │ ├── SegoeUI-Light_0.png
│ │ ├── SegoeUI-BoldItalic.fnt
│ │ ├── SegoeUI-Italic_0.png
│ │ ├── SegoeUI-SemiBold.fnt
│ │ ├── SegoeUI-SemiBold_0.png
│ │ ├── SegoeUI-SemiLight.fnt
│ │ ├── SegoeUI-BlackItalic.fnt
│ │ ├── SegoeUI-BoldItalic_0.png
│ │ ├── SegoeUI-LightItalic.fnt
│ │ ├── SegoeUI-SemiLight_0.png
│ │ ├── SegoeUI-BlackItalic_0.png
│ │ ├── SegoeUI-LightItalic_0.png
│ │ ├── SegoeUI-SemiBoldItalic.fnt
│ │ ├── SegoeUI-SemiLightItalic.fnt
│ │ ├── SegoeUI-SemiBoldItalic_0.png
│ │ └── SegoeUI-SemiLightItalic_0.png
│ ├── Spartan
│ │ ├── Spartan-Bold.fnt
│ │ └── Spartan-Bold_0.png
│ └── SegoeFluent
│ │ ├── SegoeFluent-Regular.fnt
│ │ ├── SegoeFluent-Regular_00.png
│ │ ├── SegoeFluent-Regular_01.png
│ │ ├── SegoeFluent-Regular_02.png
│ │ ├── SegoeFluent-Regular_03.png
│ │ ├── SegoeFluent-Regular_04.png
│ │ ├── SegoeFluent-Regular_05.png
│ │ ├── SegoeFluent-Regular_06.png
│ │ ├── SegoeFluent-Regular_07.png
│ │ ├── SegoeFluent-Regular_08.png
│ │ ├── SegoeFluent-Regular_09.png
│ │ ├── SegoeFluent-Regular_10.png
│ │ ├── SegoeFluent-Regular_11.png
│ │ ├── SegoeFluent-Regular_12.png
│ │ ├── SegoeFluent-Regular_13.png
│ │ ├── SegoeFluent-Regular_14.png
│ │ ├── SegoeFluent-Regular_15.png
│ │ ├── SegoeFluent-Regular_16.png
│ │ ├── SegoeFluent-Regular_17.png
│ │ ├── SegoeFluent-Regular_18.png
│ │ ├── SegoeFluent-Regular_19.png
│ │ ├── SegoeFluent-Regular_20.png
│ │ ├── SegoeFluent-Regular_21.png
│ │ ├── SegoeFluent-Regular_22.png
│ │ ├── SegoeFluent-Regular_23.png
│ │ ├── SegoeFluent-Regular_24.png
│ │ ├── SegoeFluent-Regular_25.png
│ │ └── SegoeFluent-Regular_26.png
├── Textures
│ └── branding.png
└── VignetteResources.cs
├── Vignette.Game.Tests
├── Resources
│ ├── Textures
│ │ └── test-wallpaper.jpg
│ └── TestResources.cs
├── Visual
│ ├── Typesetting
│ │ ├── TestSceneSpartan.cs
│ │ ├── TestSceneSegoeUI.cs
│ │ └── FontUsageTestScene.cs
│ ├── UserInterface
│ │ ├── TestSceneColourPicker.cs
│ │ ├── TestSceneSpinner.cs
│ │ ├── TestSceneFileBrowser.cs
│ │ ├── TestSceneScrollbar.cs
│ │ ├── TestSceneTooltip.cs
│ │ ├── TestSceneDropdown.cs
│ │ ├── UserInterfaceTestScene.cs
│ │ ├── TestSceneTextFlowContainer.cs
│ │ ├── TestSceneSlider.cs
│ │ ├── TestSceneBreadcrumbControl.cs
│ │ ├── TestSceneMarkdown.cs
│ │ ├── TestSceneNumberBox.cs
│ │ └── TestSceneTextBox.cs
│ ├── Screens
│ │ ├── TestSceneStageScreen.cs
│ │ ├── TestSceneSplashScreen.cs
│ │ └── ScreenTestScene.cs
│ ├── Sprites
│ │ └── TestSceneSpriteNoise.cs
│ ├── TestSceneVignetteGame.cs
│ ├── VignetteTestScene.cs
│ └── ThemeProvidedTestScene.cs
├── Program.cs
├── TemporaryNativeStorage.cs
├── VisualTestGame.cs
├── Vignette.Game.Tests.csproj
└── Configuration
│ └── JsonConfigManagerTest.cs
├── Vignette.Live2D.Tests
├── Resources
│ ├── Models
│ │ └── Hiyori
│ │ │ ├── Hiyori.moc3
│ │ │ ├── textures
│ │ │ ├── texture_00.png
│ │ │ └── texture_01.png
│ │ │ ├── Hiyori.pose3.json
│ │ │ └── Hiyori.userdata3.json
│ └── TestResources.cs
├── Visual
│ ├── Controllers
│ │ ├── TestSceneBreathController.cs
│ │ ├── TestSceneEyeblinkController.cs
│ │ └── TestScenePhysicsController.cs
│ ├── Rendering
│ │ ├── TestSceneLayouts.cs
│ │ └── TestSceneColours.cs
│ └── Model
│ │ └── TestSceneCubismModel.cs
├── Cubism
│ ├── CubismMocTest.cs
│ └── CubismCoreTest.cs
├── Vignette.Live2D.Tests.csproj
└── Program.cs
├── .vscode
├── extensions.json
└── settings.json
├── Vignette.Live2D
├── Resources
│ ├── Shaders
│ │ ├── sh_FragShaderSrcPremultipliedAlpha.fs
│ │ ├── sh_VertShaderSrc.vs
│ │ ├── sh_FragShaderSrc.fs
│ │ ├── sh_VertShaderSrcSetupMask.vs
│ │ ├── sh_VertShaderSrcMasked.vs
│ │ ├── sh_FragShaderSrcSetupMask.fs
│ │ ├── sh_FragShaderSrcMaskPremultipliedAlpha.fs
│ │ ├── sh_FragShaderSrcMaskInvertedPremultipliedAlpha.fs
│ │ ├── sh_FragShaderSrcMask.fs
│ │ └── sh_FragShaderSrcMaskInverted.fs
│ └── CubismResources.cs
├── Motion
│ ├── Segments
│ │ ├── ISegment.cs
│ │ ├── SegmentType.cs
│ │ ├── SteppedSegment.cs
│ │ ├── InverseSteppedSegment.cs
│ │ ├── Segment.cs
│ │ ├── LinearSegment.cs
│ │ └── BezierSegment.cs
│ ├── CubismMotionTarget.cs
│ ├── CubismExpressionBlending.cs
│ ├── CubismMotionEvent.cs
│ ├── ControlPoint.cs
│ ├── CubismExpressionParameter.cs
│ ├── ICubismMotion.cs
│ └── Curve.cs
├── ICubismId.cs
├── Physics
│ ├── CubismPhysicsSource.cs
│ ├── CubismPhysicsNormalization.cs
│ ├── CubismPhysicsParticle.cs
│ └── CubismPhysicsRig.cs
├── IO
│ └── Serialization
│ │ ├── ICubismJsonSetting.cs
│ │ ├── CubismPoseSetting.cs
│ │ ├── CubismAuxDisplaySetting.cs
│ │ ├── CubismExpressionSetting.cs
│ │ ├── CubismUserdataSetting.cs
│ │ └── Converters
│ │ └── JsonVector2Converter.cs
├── CubismId.cs
├── Vignette.Live2D.csproj
├── CubismConstantFlags.cs
├── CubismDynamicFlags.cs
├── CubismVersion.cs
├── Utils
│ └── CubismUtils.cs
├── Graphics
│ ├── CubismPart.cs
│ ├── CubismParameter.cs
│ └── Controllers
│ │ └── CubismController.cs
├── Externsions
│ └── IntPtrExtensions.cs
└── Model
│ └── CubismMocVersion.cs
├── Vignette.Game
├── Screens
│ ├── Stage
│ │ ├── BackgroundType.cs
│ │ ├── VideoBackground.cs
│ │ ├── TexturedBackground.cs
│ │ ├── SolidBackground.cs
│ │ └── CubismModelAvatar.cs
│ ├── SplashScreen.cs
│ └── VignetteScreen.cs
├── Graphics
│ ├── Sprites
│ │ ├── IHasIcon.cs
│ │ ├── ThemableSprite.cs
│ │ ├── ThemableSpriteIcon.cs
│ │ ├── ThemableSpriteText.cs
│ │ └── CheapThemableSpriteText.cs
│ ├── Typesets
│ │ ├── Spartan.cs
│ │ ├── VignetteFont.cs
│ │ └── SegoeUI.cs
│ ├── UserInterface
│ │ ├── FluentEnumDropdown.cs
│ │ ├── FluentTextBox.cs
│ │ ├── FluentDirectorySelectorParentDirectory.cs
│ │ ├── Spinner.cs
│ │ ├── FluentDirectorySelector.cs
│ │ ├── FluentPopover.cs
│ │ ├── FluentMenuDivider.cs
│ │ ├── ScreenBreadcrumbControl.cs
│ │ ├── NavigationHorizontalTabControl.cs
│ │ ├── FluentDirectorySelectorDirectory.cs
│ │ └── NavigationVerticalTabControl.cs
│ ├── Themeing
│ │ ├── IThemeSource.cs
│ │ ├── IThemable.cs
│ │ └── Theme_Generator.cs
│ ├── Containers
│ │ ├── FluentContextMenuContainer.cs
│ │ ├── ThemableTextFlowContainer.cs
│ │ ├── IView.cs
│ │ ├── View.cs
│ │ └── FluentScrollContainer.cs
│ ├── Shapes
│ │ ├── ThemableBox.cs
│ │ ├── ThemableEffectBox.cs
│ │ └── ThemableCircle.cs
│ └── VignetteColour.cs
├── Settings
│ ├── Components
│ │ ├── SettingsSwitch.cs
│ │ ├── SettingsEnumDropdown.cs
│ │ ├── SettingsTextBox.cs
│ │ ├── SettingsDropdown.cs
│ │ ├── SettingsButton.cs
│ │ ├── SettingsSlider.cs
│ │ ├── OpenSubPanelButton.cs
│ │ └── SettingsColourPicker.cs
│ ├── SettingsExpandedControl.cs
│ ├── SettingsSubPanel.cs
│ ├── SettingsPanel.cs
│ ├── SettingsControl.cs
│ ├── SettingsNavigation.cs
│ ├── SettingsMainPanel.cs
│ ├── SettingsInteractableItem.cs
│ ├── StatefulSettingsSubSection.cs
│ └── Sections
│ │ ├── FooterSection.cs
│ │ └── KeyboardSection.cs
├── Configuration
│ ├── Converters
│ │ ├── EnumKeyBindingConverter.cs
│ │ └── StringKeyBindingConverter.cs
│ ├── InMemoryConfigManager.cs
│ ├── VignetteDevelopmentConfigManager.cs
│ └── SessionConfigManager.cs
├── Vignette.Game.csproj
├── Extensions
│ ├── DrawableExtensions.cs
│ └── IViewExtensions.cs
├── IO
│ ├── ICanAcceptFiles.cs
│ ├── MonitoredLargeTextureStore.cs
│ ├── RecursiveNativeStorage.cs
│ ├── UserResources.cs
│ └── MonitoredResourceStore.cs
├── Bindables
│ ├── BindableColour4.cs
│ └── BindableVector2.cs
├── Input
│ └── VignetteKeyBindManager.cs
└── VignetteGame.cs
├── Vignette.Camera
├── CameraInfo.cs
├── ICameraVirtual.cs
├── Vignette.Camera.csproj
├── ICameraDevice.cs
├── Platform
│ ├── WindowsCameraManager.cs
│ └── LinuxCameraManager.cs
├── EncodingFormat.cs
└── Graphics
│ └── DrawableCameraVirtual.cs
├── CODE_OF_CONDUCT.md
├── Directory.Build.props
├── .github
├── workflows
│ ├── report.yml
│ ├── get-version.ps1
│ └── ci.yml
└── FUNDING.yml
├── LICENSE-Live2D
└── LICENSE-Camera
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text=auto
2 | *.cs eol=lf
3 | *.csproj eol=lf
4 |
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
--------------------------------------------------------------------------------
/Vignette.Desktop/vignette.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Desktop/vignette.ico
--------------------------------------------------------------------------------
/Vignette.Desktop/vignette-insiders.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Desktop/vignette-insiders.ico
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/Resources/earth.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Camera.Tests/Resources/earth.mp4
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/Vignette.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/Vignette.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/Vignette_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/Vignette_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Textures/branding.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Textures/branding.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Black.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Black.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Bold.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Bold.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Light.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Light.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/Spartan/Spartan-Bold.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/Spartan/Spartan-Bold.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Black_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Black_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Bold_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Bold_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Italic.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Italic.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Light_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Light_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/Spartan/Spartan-Bold_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/Spartan/Spartan-Bold_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Resources/Textures/test-wallpaper.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Tests/Resources/Textures/test-wallpaper.jpg
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Resources/Models/Hiyori/Hiyori.moc3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Live2D.Tests/Resources/Models/Hiyori/Hiyori.moc3
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-BoldItalic.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-BoldItalic.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Italic_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-Italic_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiBold.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiBold.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiBold_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiBold_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiLight.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiLight.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-BlackItalic.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-BlackItalic.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-BoldItalic_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-BoldItalic_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-LightItalic.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-LightItalic.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiLight_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiLight_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-BlackItalic_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-BlackItalic_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-LightItalic_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-LightItalic_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiBoldItalic.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiBoldItalic.fnt
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiLightItalic.fnt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiLightItalic.fnt
--------------------------------------------------------------------------------
/.vscode/extensions.json:
--------------------------------------------------------------------------------
1 | {
2 | "recommendations": [
3 | "ms-dotnettools.csharp",
4 | "editorconfig.editorconfig",
5 | "psioniq.psi-header"
6 | ]
7 | }
8 |
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiBoldItalic_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiBoldItalic_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiLightItalic_0.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeUI/SegoeUI-SemiLightItalic_0.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_00.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_01.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_02.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_02.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_03.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_03.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_04.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_04.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_05.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_05.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_06.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_06.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_07.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_07.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_08.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_08.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_09.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_09.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_10.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_11.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_12.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_13.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_14.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_15.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_16.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_17.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_17.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_18.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_18.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_19.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_19.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_20.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_20.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_21.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_21.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_22.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_22.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_23.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_23.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_24.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_24.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_25.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_25.png
--------------------------------------------------------------------------------
/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_26.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Game.Resources/Fonts/SegoeFluent/SegoeFluent-Regular_26.png
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Resources/Models/Hiyori/textures/texture_00.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Live2D.Tests/Resources/Models/Hiyori/textures/texture_00.png
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Resources/Models/Hiyori/textures/texture_01.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/vmfunc/vignette/master/Vignette.Live2D.Tests/Resources/Models/Hiyori/textures/texture_01.png
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Resources/Models/Hiyori/Hiyori.pose3.json:
--------------------------------------------------------------------------------
1 | {
2 | "Type": "Live2D Pose",
3 | "FadeInTime": 0.5,
4 | "Groups": [
5 | [
6 | {
7 | "Id": "PartArmA",
8 | "Link": []
9 | },
10 | {
11 | "Id": "PartArmB",
12 | "Link": []
13 | }
14 | ]
15 | ]
16 | }
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_FragShaderSrcPremultipliedAlpha.fs:
--------------------------------------------------------------------------------
1 | #include "sh_Utils.h"
2 |
3 | varying vec2 v_texCoord;
4 | uniform sampler2D s_texture0;
5 | uniform vec4 u_baseColor;
6 |
7 | void main()
8 | {
9 | gl_FragColor = toSRGB(texture2D(s_texture0 , v_texCoord)) * u_baseColor;
10 | }
--------------------------------------------------------------------------------
/Vignette.Game/Screens/Stage/BackgroundType.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | namespace Vignette.Game.Screens.Stage
5 | {
6 | public enum BackgroundType
7 | {
8 | Colour,
9 | Image,
10 | Video,
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_VertShaderSrc.vs:
--------------------------------------------------------------------------------
1 | attribute vec4 a_position;
2 | attribute vec2 a_texCoord;
3 | varying vec2 v_texCoord;
4 | uniform mat4 u_matrix;
5 |
6 | void main()
7 | {
8 | gl_Position = u_matrix * a_position;
9 | v_texCoord = a_texCoord;
10 | v_texCoord.y = 1.0 - v_texCoord.y;
11 | }
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_FragShaderSrc.fs:
--------------------------------------------------------------------------------
1 | #include "sh_Utils.h"
2 |
3 | varying vec2 v_texCoord;
4 | uniform sampler2D s_texture0;
5 | uniform vec4 u_baseColor;
6 |
7 | void main()
8 | {
9 | vec4 color = toSRGB(texture2D(s_texture0 , v_texCoord)) * u_baseColor;
10 | gl_FragColor = vec4(color.rgb * color.a, color.a);
11 | }
--------------------------------------------------------------------------------
/Vignette.Game.Resources/VignetteResources.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Reflection;
5 |
6 | namespace Vignette.Game.Resources
7 | {
8 | public static class VignetteResources
9 | {
10 | public static Assembly ResourceAssembly => typeof(VignetteResources).Assembly;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Sprites/IHasIcon.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Sprites;
6 |
7 | namespace Vignette.Game.Graphics.Sprites
8 | {
9 | public interface IHasIcon : IDrawable
10 | {
11 | IconUsage Icon { get; set; }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Typesets/Spartan.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics.Sprites;
5 |
6 | namespace Vignette.Game.Graphics.Typesets
7 | {
8 | public static class Spartan
9 | {
10 | public static FontUsage Bold => new FontUsage("SegoeUI", 16, "Bold");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_VertShaderSrcSetupMask.vs:
--------------------------------------------------------------------------------
1 | attribute vec4 a_position;
2 | attribute vec2 a_texCoord;
3 | varying vec2 v_texCoord;
4 | varying vec4 v_myPos;
5 | uniform mat4 u_clipMatrix;
6 |
7 | void main()
8 | {
9 | gl_Position = u_clipMatrix * a_position;
10 | v_myPos = u_clipMatrix * a_position;
11 | v_texCoord = a_texCoord;
12 | v_texCoord.y = 1.0 - v_texCoord.y;
13 | }
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Typesets/VignetteFont.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics.Sprites;
5 |
6 | namespace Vignette.Game.Graphics.Typesets
7 | {
8 | public static class VignetteFont
9 | {
10 | public static IconUsage Logo => new IconUsage((char)0xe900, "Vignette");
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_VertShaderSrcMasked.vs:
--------------------------------------------------------------------------------
1 | attribute vec4 a_position;
2 | attribute vec2 a_texCoord;
3 | varying vec2 v_texCoord;
4 | varying vec4 v_clipPos;
5 | uniform mat4 u_matrix;
6 | uniform mat4 u_clipMatrix;
7 | void main()
8 | {
9 | gl_Position = u_matrix * a_position;
10 | v_clipPos = u_clipMatrix * a_position;
11 | v_texCoord = a_texCoord;
12 | v_texCoord.y = 1.0 - v_texCoord.y;
13 | }
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Components/SettingsSwitch.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using Vignette.Game.Graphics.UserInterface;
5 |
6 | namespace Vignette.Game.Settings.Components
7 | {
8 | public class SettingsSwitch : SettingsControl
9 | {
10 | protected override FluentSwitch CreateControl() => new FluentSwitch();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/Typesetting/TestSceneSpartan.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using Vignette.Game.Graphics.Typesets;
5 |
6 | namespace Vignette.Game.Tests.Visual.Typesetting
7 | {
8 | public class TestSceneSpartan : FontUsageTestScene
9 | {
10 | public TestSceneSpartan()
11 | {
12 | AddText(Spartan.Bold);
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Vignette.Camera/CameraInfo.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | namespace Vignette.Camera
5 | {
6 | public struct CameraInfo
7 | {
8 | public string Name { get; set; }
9 | public string Path { get; set; }
10 |
11 | public CameraInfo(string name, string path)
12 | {
13 | Name = name;
14 | Path = path;
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Vignette.Desktop/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework;
5 |
6 | namespace Vignette.Desktop
7 | {
8 | public static class Program
9 | {
10 | public static void Main(string[] args)
11 | {
12 | using var host = Host.GetSuitableHost("vignette");
13 | host.Run(new VignetteGameDesktop());
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Code of Conduct
2 |
3 | This project adheres to No Code of Conduct. We are all adults. We accept anyone's contributions. Nothing else matters.
4 |
5 | For more information please visit the [No Code of Conduct](https://github.com/domgetter/NCoC) homepage.
6 |
7 | However if you feel that you are being targeted, or has been subject of discrimination, we will take corrective action. You may [email the core developers](mailto:community@vignette-project.atlassian.net).
8 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/FluentEnumDropdown.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 |
6 | namespace Vignette.Game.Graphics.UserInterface
7 | {
8 | public class FluentEnumDropdown : FluentDropdown
9 | where T : struct, Enum
10 | {
11 | public FluentEnumDropdown()
12 | {
13 | Items = (T[])Enum.GetValues(typeof(T));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/Segments/ISegment.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion.Segments
7 | {
8 | public interface ISegment
9 | {
10 | double ValueAt(double time);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 | 9.0
4 | true
5 | true
6 |
7 |
8 | true
9 | true
10 |
11 |
12 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using osu.Framework;
5 | using osu.Framework.Platform;
6 |
7 | namespace Vignette.Camera.Tests
8 | {
9 | public static class Program
10 | {
11 | public static void Main(string[] args)
12 | {
13 | using GameHost host = Host.GetSuitableHost(@"vignette");
14 | host.Run(new VisualTestGame());
15 | }
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Vignette.Camera/ICameraVirtual.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | namespace Vignette.Camera
5 | {
6 | ///
7 | /// A virtual camera device instantiated from a file.
8 | ///
9 | public interface ICameraVirtual
10 | {
11 | bool Loop { get; set; }
12 |
13 | int FrameCount { get; }
14 |
15 | int Position { get; }
16 |
17 | void Seek(int frame);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/FluentTextBox.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | namespace Vignette.Game.Graphics.UserInterface
5 | {
6 | ///
7 | /// A text input variant that displays a simple textbox.
8 | ///
9 | public class FluentTextBox : FluentTextInput
10 | {
11 | public FluentTextBox()
12 | {
13 | AddInternal(Input);
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Vignette.Live2D/ICubismId.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Graphics
7 | {
8 | public interface ICubismId
9 | {
10 | string Name { get; }
11 |
12 | int ID { get; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Physics/CubismPhysicsSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Physics
7 | {
8 | public enum CubismPhysicsSource
9 | {
10 | X,
11 | Y,
12 | Angle,
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework;
6 |
7 | namespace Vignette.Game.Tests
8 | {
9 | public static class Program
10 | {
11 | [STAThread]
12 | public static void Main(string[] args)
13 | {
14 | using (var host = Host.GetSuitableHost("vignette"))
15 | host.Run(new VisualTestGame());
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneColourPicker.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osuTK;
5 | using Vignette.Game.Graphics.UserInterface;
6 |
7 | namespace Vignette.Game.Tests.Visual.UserInterface
8 | {
9 | public class TestSceneColourPicker : UserInterfaceTestScene
10 | {
11 | public TestSceneColourPicker()
12 | {
13 | Add(new FluentColourPicker());
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneSpinner.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osuTK;
5 | using Vignette.Game.Graphics.UserInterface;
6 |
7 | namespace Vignette.Game.Tests.Visual.UserInterface
8 | {
9 | public class TestSceneSpinner : UserInterfaceTestScene
10 | {
11 | public TestSceneSpinner()
12 | {
13 | Add(new Spinner { Size = new Vector2(64) });
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Vignette.Live2D/IO/Serialization/ICubismJsonSetting.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.IO.Serialization
7 | {
8 | public interface ICubismJsonSetting
9 | {
10 | int Version { get; set; }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Components/SettingsEnumDropdown.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using Vignette.Game.Graphics.UserInterface;
6 |
7 | namespace Vignette.Game.Settings.Components
8 | {
9 | public class SettingsEnumDropdown : SettingsDropdown
10 | where T : struct, Enum
11 | {
12 | protected override FluentDropdown CreateControl() => new FluentEnumDropdown { Width = 125 };
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Components/SettingsTextBox.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using Vignette.Game.Graphics.UserInterface;
6 |
7 | namespace Vignette.Game.Settings.Components
8 | {
9 | public class SettingsTextBox : SettingsExpandedControl
10 | {
11 | protected override FluentTextBox CreateControl() => new FluentTextBox { RelativeSizeAxes = Axes.X };
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/CubismMotionTarget.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion
7 | {
8 | public enum CubismMotionTarget
9 | {
10 | Model,
11 | Parameter,
12 | PartOpacity,
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/Screens/TestSceneStageScreen.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using Vignette.Game.Screens;
5 |
6 | namespace Vignette.Game.Tests.Visual.Screens
7 | {
8 | public class TestSceneStageScreen : ScreenTestScene
9 | {
10 | public override void SetupSteps()
11 | {
12 | base.SetupSteps();
13 | AddStep("load screen", () => LoadScreen(new StageScreen()));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/CubismExpressionBlending.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion
7 | {
8 | public enum CubismExpressionBlending
9 | {
10 | Add,
11 | Multiply,
12 | Overwrite,
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/Screens/TestSceneSplashScreen.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using Vignette.Game.Screens;
5 |
6 | namespace Vignette.Game.Tests.Visual.Screens
7 | {
8 | public class TestSceneSplashScreen : ScreenTestScene
9 | {
10 | public override void SetupSteps()
11 | {
12 | base.SetupSteps();
13 | AddStep("load screen", () => LoadScreen(new SplashScreen()));
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/.github/workflows/report.yml:
--------------------------------------------------------------------------------
1 | name: Report
2 | on:
3 | workflow_run:
4 | workflows: [ 'Continuous Integration' ]
5 | types:
6 | - completed
7 |
8 | jobs:
9 | report:
10 | runs-on: ubuntu-latest
11 | if: ${{ github.event.workflow_run.conclusion != 'cancelled' }}
12 | steps:
13 | - name: Report
14 | uses: dorny/test-reporter@v1.4.2
15 | with:
16 | artifact: TestResults-Vignette.Game.Tests
17 | name: Test Results
18 | path: "*.trx"
19 | reporter: dotnet-trx
20 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/Resources/TestResources.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using System.IO;
5 | using osu.Framework.IO.Stores;
6 |
7 | namespace Vignette.Camera.Tests.Resources
8 | {
9 | public static class TestResources
10 | {
11 | public static DllResourceStore GetStore() => new DllResourceStore(typeof(TestResources).Assembly);
12 |
13 | public static Stream GetStream(string name) => GetStore().GetStream($"Resources/{name}");
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/CubismMotionEvent.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion
7 | {
8 | public struct CubismMotionEvent
9 | {
10 | public double Time { get; set; }
11 |
12 | public string Value { get; set; }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/Segments/SegmentType.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion.Segments
7 | {
8 | public enum SegmentType
9 | {
10 | Linear,
11 | Bezier,
12 | Stepped,
13 | InverseStepped
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Vignette.Live2D/CubismId.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 | using Vignette.Live2D.Graphics;
6 |
7 | namespace Vignette.Live2D
8 | {
9 | public class CubismId : ICubismId
10 | {
11 | public string Name { get; init; }
12 |
13 | public int ID { get; init; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_FragShaderSrcSetupMask.fs:
--------------------------------------------------------------------------------
1 | varying vec2 v_texCoord;
2 | varying vec4 v_myPos;
3 | uniform sampler2D s_texture0;
4 | uniform vec4 u_channelFlag;
5 | uniform vec4 u_baseColor;
6 |
7 | void main()
8 | {
9 | float isInside =
10 | step(u_baseColor.x, v_myPos.x / v_myPos.w) *
11 | step(u_baseColor.y, v_myPos.y / v_myPos.w) *
12 | step(v_myPos.x / v_myPos.w, u_baseColor.z) *
13 | step(v_myPos.y / v_myPos.w, u_baseColor.w);
14 | gl_FragColor = u_channelFlag * texture2D(s_texture0 , v_texCoord).a * isInside;
15 | }
--------------------------------------------------------------------------------
/Vignette.Live2D/Vignette.Live2D.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net5.0
4 | true
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Themeing/IThemeSource.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Bindables;
6 |
7 | namespace Vignette.Game.Graphics.Themeing
8 | {
9 | ///
10 | /// An interface denoting that this is capable of providing a theme to s.
11 | ///
12 | public interface IThemeSource
13 | {
14 | Action ThemeChanged { get; set; }
15 |
16 | Bindable Current { get; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Containers/FluentContextMenuContainer.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Cursor;
6 | using osu.Framework.Graphics.UserInterface;
7 | using Vignette.Game.Graphics.UserInterface;
8 |
9 | namespace Vignette.Game.Graphics.Containers
10 | {
11 | public class FluentContextMenuContainer : ContextMenuContainer
12 | {
13 | protected override Menu CreateMenu() => new FluentMenu(Direction.Vertical);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/CubismResources.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System.Reflection;
7 |
8 | namespace Vignette.Live2D.Resources
9 | {
10 | public static class CubismResources
11 | {
12 | public static Assembly ResourceAssembly => typeof(CubismResources).Assembly;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Resources/TestResources.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.IO;
5 | using osu.Framework.IO.Stores;
6 |
7 | namespace Vignette.Game.Tests.Resources
8 | {
9 | public static class TestResources
10 | {
11 | public static ResourceStore GetStore() => new NamespacedResourceStore(new DllResourceStore(typeof(TestResources).Assembly), "Resources");
12 |
13 | public static Stream GetStream(string name) => GetStore().GetStream(name);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneFileBrowser.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using Vignette.Game.Graphics.UserInterface;
5 |
6 | namespace Vignette.Game.Tests.Visual.UserInterface
7 | {
8 | public class TestSceneFileBrowser : UserInterfaceTestScene
9 | {
10 | public TestSceneFileBrowser()
11 | {
12 | Add(new FluentFileSelector
13 | {
14 | Width = 600,
15 | Height = 150,
16 | });
17 |
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/Sprites/TestSceneSpriteNoise.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osuTK;
5 | using Vignette.Game.Graphics.Sprites;
6 |
7 | namespace Vignette.Game.Tests.Visual.Sprites
8 | {
9 | public class TestSceneSpriteNoise : VignetteTestScene
10 | {
11 | public TestSceneSpriteNoise()
12 | {
13 | Add(new SpriteNoise
14 | {
15 | Size = new Vector2(512),
16 | Resolution = new Vector2(50),
17 | });
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Shapes/ThemableBox.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Shapes;
6 | using Vignette.Game.Graphics.Themeing;
7 |
8 | namespace Vignette.Game.Graphics.Shapes
9 | {
10 | public class ThemableBox : ThemableDrawable
11 | {
12 | public ThemableBox(bool attached = true)
13 | : base(attached)
14 | {
15 | }
16 |
17 | protected override Box CreateDrawable() => new Box { RelativeSizeAxes = Axes.Both };
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Vignette.Camera/Vignette.Camera.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Library
5 | net5.0
6 |
7 |
8 |
9 | Vignette.Application.Camera
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/CameraVirtualTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using System.IO;
5 | using NUnit.Framework;
6 |
7 | namespace Vignette.Camera.Tests
8 | {
9 | [TestFixture]
10 | public class CameraVirtualTest
11 | {
12 | [Test]
13 | public void TestFileCaching()
14 | {
15 | var camera = new TestCameraVirtual();
16 | Assert.IsTrue(File.Exists(camera.FilePath));
17 |
18 | camera.Dispose();
19 | Assert.IsFalse(File.Exists(camera.FilePath));
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/TemporaryNativeStorage.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Platform;
6 |
7 | namespace Vignette.Game.Tests
8 | {
9 | public class TemporaryNativeStorage : NativeStorage, IDisposable
10 | {
11 | public TemporaryNativeStorage(string path, GameHost host = null)
12 | : base(path, host)
13 | {
14 | GetFullPath("./", true);
15 | }
16 |
17 | public void Dispose()
18 | {
19 | DeleteDirectory(string.Empty);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Vignette.Game/Configuration/Converters/EnumKeyBindingConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Input.Bindings;
6 |
7 | namespace Vignette.Game.Configuration.Converters
8 | {
9 | public class EnumKeyBindingConverter : KeybindingConverter
10 | where T : struct, Enum
11 | {
12 | protected override string StringifyAction(IKeyBinding keybind) => keybind.GetAction().ToString();
13 |
14 | protected override bool TryGetAction(string name, out T value) => Enum.TryParse(name, out value);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/Vignette.Game/Configuration/Converters/StringKeyBindingConverter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Input.Bindings;
5 |
6 | namespace Vignette.Game.Configuration.Converters
7 | {
8 | public class StringKeyBindingConverter : KeybindingConverter
9 | {
10 | protected override string StringifyAction(IKeyBinding keybind) => keybind.Action.ToString();
11 |
12 | protected override bool TryGetAction(string name, out string value)
13 | {
14 | value = name;
15 | return true;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Vignette.Game/Configuration/InMemoryConfigManager.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Configuration;
6 |
7 | namespace Vignette.Game.Configuration
8 | {
9 | public class InMemoryConfigManager : ConfigManager
10 | where T : struct, Enum
11 | {
12 | public InMemoryConfigManager()
13 | {
14 | InitialiseDefaults();
15 | }
16 |
17 | protected override void PerformLoad()
18 | {
19 | }
20 |
21 | protected override bool PerformSave() => true;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Game/Vignette.Game.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 | net5.0
4 | Library
5 | 0.0.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_FragShaderSrcMaskPremultipliedAlpha.fs:
--------------------------------------------------------------------------------
1 | #include "sh_Utils.h"
2 |
3 | varying vec2 v_texCoord;
4 | varying vec4 v_clipPos;
5 | uniform sampler2D s_texture0;
6 | uniform sampler2D s_texture1;
7 | uniform vec4 u_channelFlag;
8 | uniform vec4 u_baseColor;
9 |
10 | void main()
11 | {
12 | vec4 col_formask = toSRGB(texture2D(s_texture0 , v_texCoord)) * u_baseColor;
13 | vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;
14 | float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;
15 | col_formask = col_formask * maskVal;
16 | gl_FragColor = col_formask;
17 | }
--------------------------------------------------------------------------------
/Vignette.Live2D/CubismConstantFlags.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 |
8 | namespace Vignette.Live2D
9 | {
10 | [Flags]
11 | public enum CubismConstantFlags : byte
12 | {
13 | BlendNormal = 0x0,
14 | BlendAdditive = 0x1,
15 | BlendMultiplicative = 0x2,
16 | IsDoubleSided = 0x4,
17 | IsInvertedMask = 0x8,
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/Typesetting/TestSceneSegoeUI.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using Vignette.Game.Graphics.Typesets;
5 |
6 | namespace Vignette.Game.Tests.Visual.Typesetting
7 | {
8 | public class TestSceneSegoeUI : FontUsageTestScene
9 | {
10 | public TestSceneSegoeUI()
11 | {
12 | AddText(SegoeUI.Light);
13 | AddText(SegoeUI.SemiLight);
14 | AddText(SegoeUI.Regular);
15 | AddText(SegoeUI.SemiBold);
16 | AddText(SegoeUI.Bold);
17 | AddText(SegoeUI.Black);
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Vignette.Game/Extensions/DrawableExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 |
6 | namespace Vignette.Game.Extensions
7 | {
8 | public static class DrawableExtensions
9 | {
10 | public static T FindNearestParent(this Drawable drawable)
11 | {
12 | var cursor = drawable;
13 |
14 | while ((cursor = cursor.Parent) != null)
15 | {
16 | if (cursor is T match)
17 | return match;
18 | }
19 |
20 | return default;
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Themeing/IThemable.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 |
6 | namespace Vignette.Game.Graphics.Themeing
7 | {
8 | ///
9 | /// An interface denoting that this drawable is capable to be themed by .
10 | ///
11 | /// The type of to be themed.
12 | public interface IThemable : IDrawable
13 | where T : IDrawable
14 | {
15 | T Target { get; }
16 |
17 | ThemeSlot Colour { get; set; }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_FragShaderSrcMaskInvertedPremultipliedAlpha.fs:
--------------------------------------------------------------------------------
1 | #include "sh_Utils.h"
2 |
3 | varying vec2 v_texCoord;
4 | varying vec4 v_clipPos;
5 | uniform sampler2D s_texture0;
6 | uniform sampler2D s_texture1;
7 | uniform vec4 u_channelFlag;
8 | uniform vec4 u_baseColor;
9 |
10 | void main()
11 | {
12 | vec4 col_formask = toSRGB(texture2D(s_texture0 , v_texCoord)) * u_baseColor;
13 | vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;
14 | float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;
15 | col_formask = col_formask * (1.0 - maskVal);
16 | gl_FragColor = col_formask;
17 | }
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/TestSceneVignetteGame.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Allocation;
5 | using osu.Framework.Platform;
6 | using System.ComponentModel;
7 |
8 | namespace Vignette.Game.Tests.Visual
9 | {
10 | [Description("The full Vignette experience.")]
11 | public class TestSceneVignetteGame : VignetteTestScene
12 | {
13 | [BackgroundDependencyLoader]
14 | private void load(GameHost host)
15 | {
16 | var game = new VignetteGame();
17 | game.SetHost(host);
18 | Add(game);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Vignette.Game/Configuration/VignetteDevelopmentConfigManager.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 | using osu.Framework.Platform;
6 |
7 | namespace Vignette.Game.Configuration
8 | {
9 | public class VignetteDevelopmentConfigManager : VignetteConfigManager
10 | {
11 | protected override string Filename => "config.dev.ini";
12 |
13 | public VignetteDevelopmentConfigManager(Storage storage, IDictionary defaultOverrides = null)
14 | : base(storage, defaultOverrides)
15 | {
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/ControlPoint.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion
7 | {
8 | public struct ControlPoint
9 | {
10 | public double Time { get; set; }
11 |
12 | public double Value { get; set; }
13 |
14 | public ControlPoint(double time, double value)
15 | {
16 | Time = time;
17 | Value = value;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/CubismExpressionParameter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using Vignette.Live2D.Graphics;
7 |
8 | namespace Vignette.Live2D.Motion
9 | {
10 | public struct CubismExpressionParameter
11 | {
12 | public CubismParameter Parameter { get; set; }
13 |
14 | public CubismExpressionBlending Blending { get; set; }
15 |
16 | public double Value { get; set; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/Segments/SteppedSegment.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion.Segments
7 | {
8 | public class SteppedSegment : Segment
9 | {
10 | public SteppedSegment()
11 | : base(2)
12 | {
13 | }
14 |
15 | public override double ValueAt(double time)
16 | {
17 | return Points[0].Value;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_FragShaderSrcMask.fs:
--------------------------------------------------------------------------------
1 | #include "sh_Utils.h"
2 |
3 | varying vec2 v_texCoord;
4 | varying vec4 v_clipPos;
5 | uniform sampler2D s_texture0;
6 | uniform sampler2D s_texture1;
7 | uniform vec4 u_channelFlag;
8 | uniform vec4 u_baseColor;
9 |
10 | void main()
11 | {
12 | vec4 col_formask = toSRGB(texture2D(s_texture0 , v_texCoord)) * u_baseColor;
13 | col_formask.rgb = col_formask.rgb * col_formask.a;
14 | vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;
15 | float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;
16 | col_formask = col_formask * maskVal;
17 | gl_FragColor = col_formask;
18 | }
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/FluentDirectorySelectorParentDirectory.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.IO;
5 | using osu.Framework.Graphics.Sprites;
6 | using Vignette.Game.Graphics.Typesets;
7 |
8 | namespace Vignette.Game.Graphics.UserInterface
9 | {
10 | public class FluentDirectorySelectorParentDirectory : FluentDirectorySelectorDirectory
11 | {
12 | protected override IconUsage? DisplayIcon => SegoeFluent.Folder;
13 |
14 | public FluentDirectorySelectorParentDirectory(DirectoryInfo directory)
15 | : base(directory, "..")
16 | {
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Vignette.Live2D/CubismDynamicFlags.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 |
8 | namespace Vignette.Live2D
9 | {
10 | [Flags]
11 | public enum CubismDynamicFlags : byte
12 | {
13 | Visible = 0x1,
14 | VisibilityChanged = 0x2,
15 | OpacityChanged = 0x4,
16 | DrawOrderChanged = 0x8,
17 | RenderOrderChanged = 0x10,
18 | VertexPositionsChanged = 0x20,
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Resources/Shaders/sh_FragShaderSrcMaskInverted.fs:
--------------------------------------------------------------------------------
1 | #include "sh_Utils.h"
2 |
3 | varying vec2 v_texCoord;
4 | varying vec4 v_clipPos;
5 | uniform sampler2D s_texture0;
6 | uniform sampler2D s_texture1;
7 | uniform vec4 u_channelFlag;
8 | uniform vec4 u_baseColor;
9 |
10 | void main()
11 | {
12 | vec4 col_formask = toSRGB(texture2D(s_texture0 , v_texCoord)) * u_baseColor;
13 | col_formask.rgb = col_formask.rgb * col_formask.a;
14 | vec4 clipMask = (1.0 - texture2D(s_texture1, v_clipPos.xy / v_clipPos.w)) * u_channelFlag;
15 | float maskVal = clipMask.r + clipMask.g + clipMask.b + clipMask.a;
16 | col_formask = col_formask * (1.0 - maskVal);
17 | gl_FragColor = col_formask;
18 | }
--------------------------------------------------------------------------------
/Vignette.Game.Tests/VisualTestGame.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Allocation;
5 | using osu.Framework.Testing;
6 | using Vignette.Game.Tests.Resources;
7 |
8 | namespace Vignette.Game.Tests
9 | {
10 | public class VisualTestGame : VignetteGameBase
11 | {
12 | [BackgroundDependencyLoader]
13 | private void load()
14 | {
15 | Resources.AddStore(TestResources.GetStore());
16 | }
17 |
18 | protected override void LoadComplete()
19 | {
20 | base.LoadComplete();
21 | Add(new TestBrowser("Vignette"));
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/Segments/InverseSteppedSegment.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion.Segments
7 | {
8 | public class InverseSteppedSegment : Segment
9 | {
10 | public InverseSteppedSegment()
11 | : base(2)
12 | {
13 | }
14 |
15 | public override double ValueAt(double time)
16 | {
17 | return Points[1].Value;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/Segments/Segment.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Motion.Segments
7 | {
8 | public abstract class Segment : ISegment
9 | {
10 | public ControlPoint[] Points { get; protected set; }
11 |
12 | public Segment(int points)
13 | {
14 | Points = new ControlPoint[points];
15 | }
16 |
17 | public abstract double ValueAt(double time);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/ICubismMotion.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System.Collections.Generic;
7 |
8 | namespace Vignette.Live2D.Motion
9 | {
10 | public interface ICubismMotion
11 | {
12 | public double GlobalFadeInSeconds { get; set; }
13 |
14 | public double GlobalFadeOutSeconds { get; set; }
15 |
16 | public double Weight { get; set; }
17 |
18 | public void Update(double time, bool loop = false);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/Vignette.Game/Screens/Stage/VideoBackground.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using osu.Framework.Graphics;
7 | using osu.Framework.Graphics.Video;
8 |
9 | namespace Vignette.Game.Screens.Stage
10 | {
11 | public class VideoBackground : FileAssociatedBackground
12 | {
13 | public override IEnumerable Extensions => new[] { ".mp4" };
14 |
15 | protected override Drawable CreateBackground(Stream stream) => new Video(stream)
16 | {
17 | Loop = true,
18 | FillMode = FillMode.Fit,
19 | RelativeSizeAxes = Axes.Both,
20 | };
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Visual/Controllers/TestSceneBreathController.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using Vignette.Live2D.Graphics.Controllers;
7 |
8 | namespace Vignette.Live2D.Tests.Visual.Controllers
9 | {
10 | public class TestSceneBreathController : CubismModelTestScene
11 | {
12 | protected override void ModelChanged()
13 | {
14 | base.ModelChanged();
15 | Model.Add(new CubismBreathController());
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Visual/Controllers/TestSceneEyeblinkController.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using Vignette.Live2D.Graphics.Controllers;
7 |
8 | namespace Vignette.Live2D.Tests.Visual.Controllers
9 | {
10 | public class TestSceneEyeblinkController : CubismModelTestScene
11 | {
12 | protected override void ModelChanged()
13 | {
14 | base.ModelChanged();
15 | Model.Add(new CubismEyeblinkController());
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Vignette.Camera/ICameraDevice.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | namespace Vignette.Camera
5 | {
6 | ///
7 | /// A physical camera device
8 | ///
9 | public interface ICameraDevice
10 | {
11 | double Saturation { get; set; }
12 |
13 | double Contrast { get; set; }
14 |
15 | double Exposure { get; set; }
16 |
17 | double Gain { get; set; }
18 |
19 | double Hue { get; set; }
20 |
21 | double Focus { get; set; }
22 |
23 | double AutoExposure { get; set; }
24 |
25 | double AutoFocus { get; set; }
26 |
27 | bool Record(string path);
28 |
29 | bool Save();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Sprites/ThemableSprite.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics.Sprites;
5 | using osu.Framework.Graphics.Textures;
6 | using Vignette.Game.Graphics.Themeing;
7 |
8 | namespace Vignette.Game.Graphics.Sprites
9 | {
10 | public class ThemableSprite : ThemableDrawable
11 | {
12 | public Texture Texture
13 | {
14 | get => Target.Texture;
15 | set => Target.Texture = value;
16 | }
17 |
18 | public ThemableSprite(bool attached = true)
19 | : base(attached)
20 | {
21 | }
22 |
23 | protected override Sprite CreateDrawable() => new Sprite();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | # These are supported funding model platforms
2 |
3 | github: vignetteapp # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
4 | patreon: # Replace with a single Patreon username
5 | open_collective: vignette # Replace with a single Open Collective username
6 | ko_fi: # Replace with a single Ko-fi username
7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9 | liberapay: # Replace with a single Liberapay username
10 | issuehunt: # Replace with a single IssueHunt username
11 | otechie: # Replace with a single Otechie username
12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
13 |
--------------------------------------------------------------------------------
/Vignette.Camera/Platform/WindowsCameraManager.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 | using DirectShowLib;
6 | using osu.Framework.Threading;
7 |
8 | namespace Vignette.Camera.Platform
9 | {
10 | public class WindowsCameraManager : CameraManager
11 | {
12 | public WindowsCameraManager(Scheduler scheduler)
13 | : base(scheduler)
14 | {
15 | }
16 |
17 | protected override IEnumerable EnumerateAllDevices()
18 | {
19 | foreach (var device in DsDevice.GetDevicesOfCat(FilterCategory.VideoInputDevice))
20 | yield return new CameraInfo(device.Name, device.DevicePath);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Shapes/ThemableEffectBox.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Shapes;
6 | using Vignette.Game.Graphics.Containers;
7 | using Vignette.Game.Graphics.Themeing;
8 |
9 | namespace Vignette.Game.Graphics.Shapes
10 | {
11 | public class ThemableEffectBox : ThemableContainer
12 | {
13 | public ThemableEffectBox()
14 | {
15 | Target.Add(new Box { RelativeSizeAxes = Axes.Both });
16 | }
17 |
18 | protected override void ThemeChanged(Theme theme)
19 | {
20 | base.ThemeChanged(theme);
21 | Target.Child.Colour = theme.Get(Colour);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Containers/ThemableTextFlowContainer.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Graphics.Containers;
6 | using Vignette.Game.Graphics.Sprites;
7 |
8 | namespace Vignette.Game.Graphics.Containers
9 | {
10 | public class ThemableTextFlowContainer : TextFlowContainer
11 | {
12 | public ThemableTextFlowContainer(Action creationParameters)
13 | : base(creationParameters)
14 | {
15 | }
16 |
17 | public ThemableTextFlowContainer()
18 | {
19 | }
20 |
21 | protected override CheapThemableSpriteText CreateSpriteText() => new CheapThemableSpriteText();
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Live2D/CubismVersion.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D
7 | {
8 | public struct CubismVersion
9 | {
10 | public int Major { get; }
11 |
12 | public int Minor { get; }
13 |
14 | public int Patch { get; }
15 |
16 | public CubismVersion(uint number)
17 | {
18 | Major = (int)((number & 0xFF000000) >> 24);
19 | Minor = (int)((number & 0x00FF0000) >> 16);
20 | Patch = (int)(number & 0x0000FFFF);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Containers/IView.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 |
6 | namespace Vignette.Game.Graphics.Containers
7 | {
8 | ///
9 | /// An interface denoting that this can be inserted as a child of a .
10 | ///
11 | public interface IView : IDrawable
12 | {
13 | ///
14 | /// Called when this view is being switched out to another.
15 | ///
16 | void OnExiting(IView last);
17 |
18 | ///
19 | /// Called when this view is being switched in from another.
20 | ///
21 | void OnEntering(IView last);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Vignette.Game.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | net5.0
16 | WinExe
17 | Vignette.Game.Tests.Program
18 |
19 |
20 |
--------------------------------------------------------------------------------
/Vignette.Game/Screens/Stage/TexturedBackground.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using osu.Framework.Graphics;
7 | using osu.Framework.Graphics.Sprites;
8 | using osu.Framework.Graphics.Textures;
9 |
10 | namespace Vignette.Game.Screens.Stage
11 | {
12 | public class TexturedBackground : FileAssociatedBackground
13 | {
14 | public override IEnumerable Extensions => new[] { ".png", ".jpg", ".jpeg" };
15 |
16 | protected override Drawable CreateBackground(Stream stream) => new Sprite
17 | {
18 | RelativeSizeAxes = Axes.Both,
19 | FillMode = FillMode.Fill,
20 | Texture = Texture.FromStream(stream),
21 | };
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/TestCameraVirtual.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 | using Emgu.CV.CvEnum;
6 | using Vignette.Camera.Tests.Resources;
7 |
8 | namespace Vignette.Camera.Tests
9 | {
10 | internal class TestCameraVirtual : CameraVirtual
11 | {
12 | public new string FilePath => base.FilePath;
13 |
14 | public new string State => base.State.ToString();
15 |
16 | public TestCameraVirtual()
17 | : base(TestResources.GetStream(@"earth.mp4"), EncodingFormat.JPEG, new Dictionary
18 | {
19 | { ImwriteFlags.JpegQuality, 20 },
20 | { ImwriteFlags.JpegOptimize, 1 },
21 | })
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneScrollbar.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Shapes;
6 | using osuTK;
7 | using Vignette.Game.Graphics.Containers;
8 |
9 | namespace Vignette.Game.Tests.Visual.UserInterface
10 | {
11 | public class TestSceneScrollbar : UserInterfaceTestScene
12 | {
13 | public TestSceneScrollbar()
14 | {
15 | Add(new FluentScrollContainer
16 | {
17 | Size = new Vector2(256),
18 | Child = new Box
19 | {
20 | Size = new Vector2(512),
21 | Colour = Colour4.Transparent,
22 | },
23 | });
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/.github/workflows/get-version.ps1:
--------------------------------------------------------------------------------
1 | $resp = Invoke-WebRequest -UseBasicParsing -Uri "https://api.github.com/repos/$($args[0])/releases" -Headers @{ "Authorization" = "token $($args[1])" }
2 | $data = $resp.content | ConvertFrom-Json
3 |
4 | $latest = If ($data.Length -gt 0) { $data[0].tag_name.split('.') | ForEach-Object { [int]::Parse($_) } } Else { @(0, 0, 0) }
5 | $coming = @((Get-Date).Year, [int]::Parse((Get-Date).Month.ToString() + (Get-Date).Day.ToString().PadLeft(2, '0')), 0)
6 |
7 | $match = $latest | ForEach-Object { $_ -eq $coming[[array]::IndexOf($latest, $_)] }
8 | $major = If ($match[0]) { $latest[0] } Else { $coming[0] }
9 | $minor = If ($match[1]) { $latest[1] } Else { $coming[1] }
10 | $patch = If ($match[0] -and $match[1]) { $latest[2] + 1 } Else { 0 }
11 |
12 | Write-Host "::set-output name=version::$($major).$($minor).$($patch)"
13 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Resources/TestResources.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 | using System.IO;
8 | using osu.Framework.IO.Stores;
9 |
10 | namespace Vignette.Live2D.Tests.Resources
11 | {
12 | public static class TestResources
13 | {
14 | public static IResourceStore GetResourceStore() => new NamespacedResourceStore(new DllResourceStore(typeof(TestResources).Assembly), "Resources");
15 | public static IResourceStore GetModelResourceStore() => new NamespacedResourceStore(GetResourceStore(), "Models");
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Physics/CubismPhysicsNormalization.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Physics
7 | {
8 | public struct CubismPhysicsNormalizationTuplet
9 | {
10 | public float Maximum { get; set; }
11 |
12 | public float Minimum { get; set; }
13 |
14 | public float Default { get; set; }
15 | }
16 |
17 | public struct CubismPhysicsNormalization
18 | {
19 | public CubismPhysicsNormalizationTuplet Position { get; set; }
20 |
21 | public CubismPhysicsNormalizationTuplet Angle { get; set; }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Game/IO/ICanAcceptFiles.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 |
6 | namespace Vignette.Game.IO
7 | {
8 | ///
9 | /// An interface that marks that this component can accept files dropped to the window.
10 | ///
11 | public interface ICanAcceptFiles
12 | {
13 | ///
14 | /// Extensions that the component can accept.
15 | ///
16 | IEnumerable Extensions { get; }
17 |
18 | ///
19 | /// Called when a drag and drop event has happened.
20 | ///
21 | /// A list of file paths the component has received.
22 | void FileDropped(IEnumerable files);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Sprites/ThemableSpriteIcon.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Sprites;
6 | using Vignette.Game.Graphics.Themeing;
7 |
8 | namespace Vignette.Game.Graphics.Sprites
9 | {
10 | public class ThemableSpriteIcon : ThemableDrawable, IHasIcon
11 | {
12 | public IconUsage Icon
13 | {
14 | get => Target.Icon;
15 | set => Target.Icon = value;
16 | }
17 |
18 | public ThemableSpriteIcon(bool attached = true)
19 | : base(attached)
20 | {
21 | }
22 |
23 | protected override SpriteIcon CreateDrawable() => new SpriteIcon
24 | {
25 | RelativeSizeAxes = Axes.Both,
26 | };
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Vignette.Game/Configuration/SessionConfigManager.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 |
6 | namespace Vignette.Game.Configuration
7 | {
8 | public class SessionConfigManager : InMemoryConfigManager
9 | {
10 | protected override void InitialiseDefaults() => Reset();
11 |
12 | public void Reset()
13 | {
14 | ensureDefault(SetDefault(SessionSetting.EditingBackground, false));
15 | ensureDefault(SetDefault(SessionSetting.EditingAvatar, false));
16 | }
17 |
18 | private static void ensureDefault(Bindable bindable) => bindable.SetDefault();
19 | }
20 |
21 | public enum SessionSetting
22 | {
23 | EditingBackground,
24 | EditingAvatar,
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Resources/Models/Hiyori/Hiyori.userdata3.json:
--------------------------------------------------------------------------------
1 | {
2 | "Version": 3,
3 | "Meta": {
4 | "UserDataCount": 7,
5 | "TotalUserDataSize": 35
6 | },
7 | "UserData": [
8 | {
9 | "Target": "ArtMesh",
10 | "Id": "ArtMesh93",
11 | "Value": "ribon"
12 | },
13 | {
14 | "Target": "ArtMesh",
15 | "Id": "ArtMesh94",
16 | "Value": "ribon"
17 | },
18 | {
19 | "Target": "ArtMesh",
20 | "Id": "ArtMesh95",
21 | "Value": "ribon"
22 | },
23 | {
24 | "Target": "ArtMesh",
25 | "Id": "ArtMesh57",
26 | "Value": "ribon"
27 | },
28 | {
29 | "Target": "ArtMesh",
30 | "Id": "ArtMesh58",
31 | "Value": "ribon"
32 | },
33 | {
34 | "Target": "ArtMesh",
35 | "Id": "ArtMesh59",
36 | "Value": "ribon"
37 | },
38 | {
39 | "Target": "ArtMesh",
40 | "Id": "ArtMesh60",
41 | "Value": "ribon"
42 | }
43 | ]
44 | }
--------------------------------------------------------------------------------
/Vignette.Live2D/Utils/CubismUtils.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System.IO;
7 | using Newtonsoft.Json;
8 | using Vignette.Live2D.IO.Serialization;
9 | using Vignette.Live2D.IO.Serialization.Converters;
10 |
11 | namespace Vignette.Live2D.Utils
12 | {
13 | public static class CubismUtils
14 | {
15 | public static T ReadJsonSetting(Stream stream) where T : ICubismJsonSetting
16 | {
17 | using var reader = new StreamReader(stream);
18 | return JsonConvert.DeserializeObject(reader.ReadToEnd(), new JsonVector2Converter());
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/VignetteColour.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 |
6 | namespace Vignette.Game.Graphics
7 | {
8 | public static class VignetteColour
9 | {
10 | public static Colour4 Primary => VignetteGameBase.IsInsidersBuild ? PrimaryInsider : PrimaryGeneral;
11 |
12 | public static Colour4 Secondary => VignetteGameBase.IsInsidersBuild ? SecondaryInsider : SecondaryGeneral;
13 |
14 | public static readonly Colour4 PrimaryGeneral = Colour4.FromHex("BE58CB");
15 | public static readonly Colour4 PrimaryInsider = Colour4.FromHex("58CB86");
16 | public static readonly Colour4 SecondaryGeneral = Colour4.FromHex("F10E5A");
17 | public static readonly Colour4 SecondaryInsider = Colour4.FromHex("0EBBF1");
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Components/SettingsDropdown.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 | using System.Collections.Generic;
6 | using Vignette.Game.Graphics.UserInterface;
7 |
8 | namespace Vignette.Game.Settings.Components
9 | {
10 | public class SettingsDropdown : SettingsControl, T>
11 | {
12 | public IEnumerable Items
13 | {
14 | get => Control.Items;
15 | set => Control.Items = value;
16 | }
17 |
18 | public IBindableList ItemSource
19 | {
20 | get => Control.ItemSource;
21 | set => Control.ItemSource = value;
22 | }
23 |
24 | protected override FluentDropdown CreateControl() => new FluentDropdown { Width = 125 };
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/Segments/LinearSegment.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 |
8 | namespace Vignette.Live2D.Motion.Segments
9 | {
10 | public class LinearSegment : Segment
11 | {
12 | public LinearSegment()
13 | : base(2)
14 | {
15 | }
16 |
17 | public override double ValueAt(double time)
18 | {
19 | double t = (time - Points[0].Time) / (Points[1].Time - Points[0].Time);
20 | t = Math.Max(t, 0);
21 | return Points[0].Value + ((Points[1].Value - Points[0].Value) * t);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/VignetteTestScene.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Testing;
5 |
6 | namespace Vignette.Game.Tests.Visual
7 | {
8 | public abstract class VignetteTestScene : TestScene
9 | {
10 | protected override ITestSceneTestRunner CreateRunner() => new VignetteTestSceneTestRunner();
11 |
12 | public class VignetteTestSceneTestRunner : VignetteGameBase, ITestSceneTestRunner
13 | {
14 | private TestSceneTestRunner.TestRunner runner;
15 |
16 | protected override void LoadAsyncComplete()
17 | {
18 | Add(runner = new TestSceneTestRunner.TestRunner());
19 | }
20 |
21 | public void RunTestBlocking(TestScene test) => runner.RunTestBlocking(test);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Containers/View.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 |
7 | namespace Vignette.Game.Graphics.Containers
8 | {
9 | ///
10 | /// An abstract implementation of a view that is a child of .
11 | ///
12 | public abstract class View : VisibilityContainer, IView
13 | {
14 | protected override bool StartHidden => true;
15 |
16 | protected override void PopIn() => this.FadeIn();
17 |
18 | protected override void PopOut() => this.FadeOut();
19 |
20 | public virtual void OnExiting(IView last)
21 | {
22 | }
23 |
24 | public virtual void OnEntering(IView last)
25 | {
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Graphics/CubismPart.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 |
8 | namespace Vignette.Live2D.Graphics
9 | {
10 | public class CubismPart : CubismId
11 | {
12 | public float TargetOpacity { get; set; }
13 |
14 | private float currentOpacity;
15 |
16 | public float CurrentOpacity
17 | {
18 | get => currentOpacity;
19 | set => currentOpacity = Math.Clamp(value, 0.0f, 1.0f);
20 | }
21 |
22 | public CubismPart(int id, string name)
23 | {
24 | Name = name;
25 | ID = id;
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Cubism/CubismMocTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using NUnit.Framework;
7 | using Vignette.Live2D.Model;
8 | using Vignette.Live2D.Tests.Resources;
9 |
10 | namespace Vignette.Live2D.Tests.Cubism
11 | {
12 | public class CubismMocTest
13 | {
14 | [Test]
15 | public void TestCreateMoc()
16 | {
17 | using var mocStream = TestResources.GetModelResourceStore().GetStream("Hiyori/Hiyori.moc3");
18 | using var moc = new CubismMoc(mocStream);
19 |
20 | Assert.That(moc.Version, Is.Not.EqualTo(CubismMocVersion.csmMocVersion_Unknown));
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneTooltip.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics.Cursor;
5 | using osu.Framework.Localisation;
6 | using osuTK;
7 | using Vignette.Game.Graphics.Shapes;
8 | using Vignette.Game.Graphics.Themeing;
9 |
10 | namespace Vignette.Game.Tests.Visual.UserInterface
11 | {
12 | public class TestSceneTooltip : UserInterfaceTestScene
13 | {
14 | public TestSceneTooltip()
15 | {
16 | Add(new TestBoxWithTooltip
17 | {
18 | Size = new Vector2(256),
19 | Colour = ThemeSlot.AccentPrimary,
20 | });
21 | }
22 |
23 | private class TestBoxWithTooltip : ThemableBox, IHasTooltip
24 | {
25 | public LocalisableString TooltipText => @"Hello World";
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Externsions/IntPtrExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 | using System.Runtime.InteropServices;
8 |
9 | namespace Vignette.Live2D.Extensions
10 | {
11 | internal static class IntPtrExtensions
12 | {
13 | public static IntPtr Align(this IntPtr ptr, int offset)
14 | {
15 | IntPtr aligned;
16 | int totalOffset = 0;
17 |
18 | do
19 | {
20 | aligned = IntPtr.Add(ptr, totalOffset);
21 | totalOffset++;
22 | } while ((ulong)aligned % (ulong)offset != 0);
23 |
24 | return aligned;
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "psi-header.changes-tracking": {
3 | "autoHeader": "manualSave"
4 | },
5 | "psi-header.variables": [
6 | ["licenseYearFrom", "2020"],
7 | ["licenseYearTo", "2021"],
8 | ["licenseType", "NPOSLv3"]
9 | ],
10 | "psi-header.lang-config": [
11 | {
12 | "language": "csharp",
13 | "begin": "",
14 | "prefix": "// ",
15 | "end": "",
16 | "blankLinesAfter": 1
17 | }
18 | ],
19 | "psi-header.templates": [
20 | {
21 | "language": "csharp",
22 | "template": [
23 | "Copyright <> - <> Vignette Project",
24 | "Licensed under <>. See LICENSE for details."
25 | ]
26 | }
27 | ],
28 | "editor.defaultFormatter": "ms-dotnettools.csharp",
29 | "editor.formatOnType": true
30 | }
31 |
--------------------------------------------------------------------------------
/Vignette.Game/Bindables/BindableColour4.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 | using osu.Framework.Graphics;
6 |
7 | namespace Vignette.Game.Bindables
8 | {
9 | public class BindableColour4 : Bindable
10 | {
11 | public BindableColour4(Colour4 defaultValue = default)
12 | : base(defaultValue)
13 | {
14 | }
15 |
16 | public override string ToString() => Value.ToHex();
17 |
18 | public override void Parse(object input)
19 | {
20 | if (!(input is string str) || string.IsNullOrEmpty(str))
21 | {
22 | Value = default;
23 | return;
24 | }
25 |
26 | Value = Colour4.FromHex(str);
27 | }
28 |
29 | protected override Bindable CreateInstance() => new BindableColour4();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Model/CubismMocVersion.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | namespace Vignette.Live2D.Model
7 | {
8 | public enum CubismMocVersion
9 | {
10 | ///
11 | /// Unknown
12 | ///
13 | csmMocVersion_Unknown,
14 |
15 | ///
16 | /// moc3 file version 3.0.00 - 3.2.07
17 | ///
18 | csmMocVersion_30,
19 |
20 | ///
21 | /// moc3 file version 3.3.00 - 3.3.03
22 | ///
23 | csmMocVersion_33,
24 |
25 | ///
26 | /// moc3 file version 4.0.00
27 | ///
28 | csmMocVersion_40,
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/Visual/TestSceneDrawableCameraDevice.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using NUnit.Framework;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Testing;
7 | using osuTK;
8 | using Vignette.Camera.Graphics;
9 |
10 | namespace Vignette.Camera.Tests.Visual
11 | {
12 | [Ignore("This test cannot be run in headless mode (a physical camera device is required).")]
13 | public class TestSceneDrawableCameraDevice : TestScene
14 | {
15 | private CameraDevice camera;
16 |
17 | public TestSceneDrawableCameraDevice()
18 | {
19 | camera = new CameraDevice(0);
20 | camera.Start();
21 |
22 | Add(new DrawableCameraDevice(camera)
23 | {
24 | Anchor = Anchor.Centre,
25 | Origin = Anchor.Centre,
26 | Size = new Vector2(256),
27 | });
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/SettingsExpandedControl.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.UserInterface;
6 |
7 | namespace Vignette.Game.Settings
8 | {
9 | public abstract class SettingsExpandedControl : SettingsControl
10 | where TDrawable : Drawable, IHasCurrentValue
11 | {
12 | public SettingsExpandedControl()
13 | {
14 | Foreground.RelativeSizeAxes = Axes.X;
15 | Foreground.Height = 50;
16 | Foreground.Margin = new MarginPadding { Top = 50 };
17 | }
18 |
19 | protected override void InitializeControl()
20 | {
21 | Foreground.Add(Control = CreateControl().With(d =>
22 | {
23 | d.Anchor = Anchor.Centre;
24 | d.Origin = Anchor.Centre;
25 | }));
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Vignette.Live2D/IO/Serialization/CubismPoseSetting.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 | using System.Collections.Generic;
8 |
9 | namespace Vignette.Live2D.IO.Serialization
10 | {
11 | [Serializable]
12 | public class CubismPoseSetting : ICubismJsonSetting
13 | {
14 | public int Version { get; set; }
15 |
16 | public string Type { get; set; }
17 |
18 | public float FadeInTime { get; set; }
19 |
20 | public List> Groups { get; set; } = new List>();
21 |
22 | public class Group
23 | {
24 | public string Id { get; set; }
25 |
26 | public List Link { get; set; } = new List();
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Vignette.Game/IO/MonitoredLargeTextureStore.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 | using System.Threading.Tasks;
6 | using osu.Framework.Graphics.Textures;
7 | using osu.Framework.Platform;
8 |
9 | namespace Vignette.Game.IO
10 | {
11 | public class MonitoredLargeTextureStore : MonitoredResourceStore
12 | {
13 | private LargeTextureStore largeTextureStore;
14 |
15 | public MonitoredLargeTextureStore(GameHost host, Storage underlyingStorage, IEnumerable filters = null)
16 | : base(underlyingStorage, filters)
17 | {
18 | largeTextureStore = new LargeTextureStore(host.CreateTextureLoaderStore(UnderlyingStore));
19 | }
20 |
21 | public new Texture Get(string name)
22 | => largeTextureStore.Get(name);
23 |
24 | public new Task GetAsync(string name)
25 | => largeTextureStore.GetAsync(name);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/Vignette.Game/Screens/Stage/SolidBackground.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Allocation;
5 | using osu.Framework.Bindables;
6 | using osu.Framework.Graphics;
7 | using osu.Framework.Graphics.Containers;
8 | using osu.Framework.Graphics.Shapes;
9 | using Vignette.Game.Configuration;
10 |
11 | namespace Vignette.Game.Screens.Stage
12 | {
13 | public class SolidBackground : CompositeDrawable
14 | {
15 | private Box box;
16 | private Bindable colour;
17 |
18 | [BackgroundDependencyLoader]
19 | private void load(VignetteConfigManager config)
20 | {
21 | colour = config.GetBindable(VignetteSetting.BackgroundColour);
22 |
23 | InternalChild = box = new Box
24 | {
25 | RelativeSizeAxes = Axes.Both,
26 | };
27 |
28 | colour.BindValueChanged(e => box.Colour = e.NewValue, true);
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Vignette.Live2D.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net5.0
6 | Vignette.Live2D.Tests.Program
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Physics/CubismPhysicsParticle.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using osuTK;
7 |
8 | namespace Vignette.Live2D.Physics
9 | {
10 | public struct CubismPhysicsParticle
11 | {
12 | public Vector2 InitialPosition { get; set; }
13 |
14 | public float Mobility { get; set; }
15 |
16 | public float Delay { get; set; }
17 |
18 | public float Acceleration { get; set; }
19 |
20 | public float Radius { get; set; }
21 |
22 | public Vector2 Position { get; set; }
23 |
24 | public Vector2 LastPosition { get; set; }
25 |
26 | public Vector2 LastGravity { get; set; }
27 |
28 | public Vector2 Force { get; set; }
29 |
30 | public Vector2 Velocity { get; set; }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Physics/CubismPhysicsRig.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using osuTK;
7 |
8 | namespace Vignette.Live2D.Physics
9 | {
10 | public class CubismPhysicsRig
11 | {
12 | public CubismPhysicsSubRig[] SubRigs { get; set; }
13 |
14 | public Vector2 Gravity { get; set; } = new Vector2(0, -1.0f);
15 |
16 | public Vector2 Wind { get; set; } = Vector2.Zero;
17 |
18 | public void Initialize()
19 | {
20 | for (int i = 0; i < SubRigs.Length; ++i)
21 | SubRigs[i].Initialize();
22 | }
23 |
24 | public void Update(double delta)
25 | {
26 | for (int i = 0; i < SubRigs.Length; ++i)
27 | SubRigs[i].Update(delta);
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Cubism/CubismCoreTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using NUnit.Framework;
7 | using System;
8 |
9 | namespace Vignette.Live2D.Tests.Cubism
10 | {
11 | public class CubismCoreTest
12 | {
13 | [Test]
14 | public void TestCheckCoreVersion() => Assert.That(CubismCore.Version, Is.Not.EqualTo(default(CubismVersion)));
15 |
16 | [Test]
17 | public void TestCheckLogger()
18 | {
19 | Assert.That(CubismCore.GetLogger(), Is.Null);
20 |
21 | CubismCore.SetLogger(test_logger);
22 |
23 | Assert.That(CubismCore.GetLogger(), Is.EqualTo((CubismCore.CubismLogFunction)test_logger));
24 |
25 | static void test_logger(string message) => Console.WriteLine(message);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/Vignette.Desktop/VignetteGameDesktop.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Reflection;
5 | using osu.Framework.Bindables;
6 | using osu.Framework.Input;
7 | using osu.Framework.Platform;
8 | using Vignette.Game;
9 | using Vignette.Game.Configuration;
10 |
11 | namespace Vignette.Desktop
12 | {
13 | public class VignetteGameDesktop : VignetteGame
14 | {
15 | public override void SetHost(GameHost host)
16 | {
17 | base.SetHost(host);
18 |
19 | if (host.Window is not SDL2DesktopWindow window)
20 | return;
21 |
22 | window.ConfineMouseMode.Value = ConfineMouseMode.Never;
23 | window.DragDrop += f => FileDropped(new[] { f });
24 | window.Title = Name;
25 |
26 | string icon = IsInsidersBuild ? "vignette-insiders.ico" : "vignette.ico";
27 | window.SetIconFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream(GetType(), icon));
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/Typesetting/FontUsageTestScene.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osu.Framework.Graphics.Sprites;
7 |
8 | namespace Vignette.Game.Tests.Visual.Typesetting
9 | {
10 | public abstract class FontUsageTestScene : VignetteTestScene
11 | {
12 | private readonly FillFlowContainer flow;
13 |
14 | public FontUsageTestScene()
15 | {
16 | Add(flow = new FillFlowContainer
17 | {
18 | Direction = FillDirection.Vertical,
19 | AutoSizeAxes = Axes.Y,
20 | RelativeSizeAxes = Axes.X,
21 | });
22 | }
23 |
24 | public void AddText(FontUsage font) => flow.Add(new SpriteText
25 | {
26 | Margin = new MarginPadding(20),
27 | Font = font.With(size: 32),
28 | Text = @"The quick fox jumps over the lazy dog.",
29 | });
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Vignette.Live2D/IO/Serialization/CubismAuxDisplaySetting.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 | using System.Collections.Generic;
8 |
9 | namespace Vignette.Live2D.IO.Serialization
10 | {
11 | [Serializable]
12 | public class CubismAuxDisplaySetting : ICubismJsonSetting
13 | {
14 | public int Version { get; set; }
15 |
16 | public List Parameters { get; set; }
17 |
18 | public List ParameterGroups { get; set; }
19 |
20 | public List Parts { get; set; }
21 |
22 | public class DisplayParameters
23 | {
24 | public string Id { get; set; }
25 |
26 | public string GroupId { get; set; }
27 |
28 | public string Name { get; set; }
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/LICENSE-Live2D:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2020 Vignette Project
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/Vignette.Live2D/Graphics/CubismParameter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 |
8 | namespace Vignette.Live2D.Graphics
9 | {
10 | public class CubismParameter : CubismId
11 | {
12 | public readonly float Minimum;
13 |
14 | public readonly float Maximum;
15 |
16 | public readonly float Default;
17 |
18 | private float val;
19 |
20 | public float Value
21 | {
22 | get => val;
23 | set => val = Math.Clamp(value, Minimum, Maximum);
24 | }
25 |
26 | public CubismParameter(int id, string name, float min, float max, float def)
27 | {
28 | Name = name;
29 | ID = id;
30 | Minimum = min;
31 | Maximum = max;
32 | Default = def;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/LICENSE-Camera:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2020 Vignette Project
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6 |
7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8 |
9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
10 |
--------------------------------------------------------------------------------
/Vignette.Live2D/IO/Serialization/CubismExpressionSetting.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 | using System.Collections.Generic;
8 |
9 | namespace Vignette.Live2D.IO.Serialization
10 | {
11 | [Serializable]
12 | public class CubismExpressionSetting : ICubismJsonSetting
13 | {
14 | public int Version { get; set; }
15 |
16 | public string Type { get; set; }
17 |
18 | public float FadeInTime { get; set; } = 1.0f;
19 |
20 | public float FadeOutTime { get; set; } = 1.0f;
21 |
22 | public List Parameters { get; set; }
23 |
24 | public class Parameter
25 | {
26 | public string Id { get; set; }
27 |
28 | public double Value { get; set; }
29 |
30 | public string Blend { get; set; }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Vignette.Live2D/IO/Serialization/CubismUserdataSetting.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 |
8 | namespace Vignette.Live2D.IO.Serialization
9 | {
10 | [Serializable]
11 | public class CubismUserdataSetting : ICubismJsonSetting
12 | {
13 | public int Version { get; set; }
14 |
15 | public Metadata Meta { get; set; }
16 |
17 | public Userdata UserData { get; set; }
18 |
19 | public class Metadata
20 | {
21 | public int UserDataCount { get; set; }
22 |
23 | public int TotalUserDataSize { get; set; }
24 | }
25 |
26 | public class Userdata
27 | {
28 | public string Target { get; set; }
29 |
30 | public string Id { get; set; }
31 |
32 | public string Value { get; set; }
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Graphics/Controllers/CubismController.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using osu.Framework.Allocation;
7 | using osu.Framework.Graphics;
8 |
9 | namespace Vignette.Live2D.Graphics.Controllers
10 | {
11 | ///
12 | /// A component that can be inserted as a child of
13 | /// and can make adjustments to the which is obtained through dependency injection.
14 | ///
15 | public abstract class CubismController : Component
16 | {
17 | ///
18 | /// The model to make adjustments on which is resolved through dependency injection.
19 | ///
20 | /// This is only populated after it has been loaded.
21 | [Resolved]
22 | protected CubismModel Model { get; private set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Components/SettingsButton.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Localisation;
7 | using Vignette.Game.Graphics.UserInterface;
8 |
9 | namespace Vignette.Game.Settings.Components
10 | {
11 | public class SettingsButton : SettingsItem
12 | {
13 | public Action Action
14 | {
15 | get => button.Action;
16 | set => button.Action = value;
17 | }
18 |
19 | public LocalisableString ButtonText
20 | {
21 | get => button.Text;
22 | set => button.Text = value;
23 | }
24 |
25 | private readonly FluentButton button;
26 |
27 | public SettingsButton()
28 | {
29 | Foreground.Add(button = new FluentButton
30 | {
31 | Width = 150,
32 | Style = ButtonStyle.Primary,
33 | Anchor = Anchor.CentreRight,
34 | Origin = Anchor.CentreRight,
35 | });
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Visual/Controllers/TestScenePhysicsController.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using Vignette.Live2D.Graphics.Controllers;
7 |
8 | namespace Vignette.Live2D.Tests.Visual.Controllers
9 | {
10 | public class TestScenePhysicsController : CubismModelTestScene
11 | {
12 | private CubismMotionController controller;
13 |
14 | protected override void ModelChanged()
15 | {
16 | base.ModelChanged();
17 |
18 | Model.AddRange(new CubismController[]
19 | {
20 | controller = new CubismMotionController(),
21 | new CubismPhysicsController(),
22 | });
23 |
24 | Schedule(() =>
25 | {
26 | controller.Loop = true;
27 | controller.Enqueue("Idle", 0);
28 | });
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/CameraManagerTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using NUnit.Framework;
5 | using System;
6 | using System.Linq;
7 | using System.Threading;
8 | using osu.Framework.Threading;
9 | using osu.Framework;
10 | using Vignette.Camera.Platform;
11 |
12 | namespace Vignette.Camera.Tests
13 | {
14 | [TestFixture]
15 | public class CameraManagerTest
16 | {
17 | private Scheduler scheduler;
18 |
19 | private CameraManager manager;
20 |
21 | [SetUp]
22 | public void SetUp()
23 | {
24 | manager = CameraManager.CreateSuitableManager(scheduler = new Scheduler());
25 | }
26 |
27 | [Test]
28 | public void RetrieveDevicesTest()
29 | {
30 | // Ensure that the thread has at least done one update call before we proceed.
31 | scheduler.Update();
32 | Thread.Sleep(2000);
33 |
34 | // This requires a physical device to be connected to succeed.
35 | Assert.IsTrue(manager.CameraDeviceNames.Any());
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneDropdown.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using Vignette.Game.Graphics.UserInterface;
5 |
6 | namespace Vignette.Game.Tests.Visual.UserInterface
7 | {
8 | public class TestSceneDropdown : UserInterfaceTestScene
9 | {
10 | public TestSceneDropdown()
11 | {
12 | Add(new FluentDropdown
13 | {
14 | Width = 200,
15 | Items = new[]
16 | {
17 | "Hello World",
18 | "Another Item",
19 | "Really Long Option",
20 | },
21 | });
22 | Add(new FluentDropdown
23 | {
24 | Width = 100,
25 | Items = new[]
26 | {
27 | "Hello World",
28 | "Another Item",
29 | "Really Long Option",
30 | "An even more loooooooooooooooooooonger option",
31 | },
32 | });
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/SettingsSubPanel.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osuTK;
7 | using Vignette.Game.Graphics.Containers;
8 |
9 | namespace Vignette.Game.Settings
10 | {
11 | public class SettingsSubPanel : SettingsPanel
12 | {
13 | protected override Container Content => flow;
14 |
15 | private FillFlowContainer flow;
16 |
17 | protected override Drawable CreateContent() => new FluentScrollContainer
18 | {
19 | RelativeSizeAxes = Axes.Both,
20 | Child = flow = new FillFlowContainer
21 | {
22 | RelativeSizeAxes = Axes.X,
23 | AutoSizeAxes = Axes.Y,
24 | Direction = FillDirection.Vertical,
25 | Spacing = new Vector2(0, 5),
26 | },
27 | };
28 |
29 | protected override void PopIn() => this.MoveToX(0, 300, Easing.OutCirc);
30 |
31 | protected override void PopOut() => this.MoveToX(-400, 300, Easing.InCirc);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Vignette.Game/Screens/Stage/CubismModelAvatar.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.IO;
5 | using System.Linq;
6 | using osu.Framework.IO.Stores;
7 | using Vignette.Game.IO;
8 | using Vignette.Live2D.Graphics;
9 |
10 | namespace Vignette.Game.Screens.Stage
11 | {
12 | public class CubismModelAvatar : CubismModel
13 | {
14 | private readonly RecursiveNativeStorage storage;
15 |
16 | public CubismModelAvatar(RecursiveNativeStorage storage)
17 | : base(new StorageBackedResourceStore(storage))
18 | {
19 | this.storage = storage;
20 | }
21 |
22 | protected override Stream GetModelSettingsStream()
23 | {
24 | string settingsFile = storage.GetFiles(".", "*.model3.json").FirstOrDefault();
25 | return storage.GetStream(settingsFile);
26 | }
27 |
28 | protected override Stream GetModelMocStream()
29 | {
30 | string mocFile = storage.GetFiles(".", "*.moc3").FirstOrDefault();
31 | return storage.GetStream(mocFile);
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Visual/Rendering/TestSceneLayouts.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using osu.Framework.Bindables;
7 | using osuTK;
8 |
9 | namespace Vignette.Live2D.Tests.Visual.Rendering
10 | {
11 | public class TestSceneLayouts : CubismModelTestScene
12 | {
13 | private readonly Bindable size = new Bindable();
14 |
15 | public TestSceneLayouts()
16 | {
17 | AddSliderStep("width", 1, 1024, 1024, x => size.Value = new Vector2(x, size.Value.Y));
18 | AddSliderStep("height", 1, 1024, 1024, y => size.Value = new Vector2(size.Value.X, y));
19 | }
20 |
21 | protected override void ModelChanged()
22 | {
23 | base.ModelChanged();
24 |
25 | size.UnbindEvents();
26 | size.BindValueChanged(s => Model.Size = s.NewValue, true);
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/UserInterfaceTestScene.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osuTK;
7 |
8 | namespace Vignette.Game.Tests.Visual.UserInterface
9 | {
10 | public abstract class UserInterfaceTestScene : ThemeProvidedTestScene
11 | {
12 | protected readonly FillFlowContainer FlowContent;
13 |
14 | protected override Container Content => FlowContent;
15 |
16 | public UserInterfaceTestScene()
17 | {
18 | base.Content.Add(new BasicScrollContainer
19 | {
20 | RelativeSizeAxes = Axes.Both,
21 | Padding = new MarginPadding(10),
22 | Child = FlowContent = new FillFlowContainer
23 | {
24 | Direction = FillDirection.Vertical,
25 | Spacing = new Vector2(0, 10),
26 | RelativeSizeAxes = Axes.X,
27 | AutoSizeAxes = Axes.Y,
28 | },
29 | });
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/Spinner.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osu.Framework.Graphics.Sprites;
7 | using Vignette.Game.Graphics.Sprites;
8 | using Vignette.Game.Graphics.Themeing;
9 |
10 | namespace Vignette.Game.Graphics.UserInterface
11 | {
12 | public class Spinner : CompositeDrawable
13 | {
14 | private readonly ThemableSpriteIcon foreground;
15 |
16 | public Spinner()
17 | {
18 | InternalChild = foreground = new ThemableSpriteIcon
19 | {
20 | RelativeSizeAxes = Axes.Both,
21 | Colour = ThemeSlot.AccentPrimary,
22 | Icon = FontAwesome.Solid.CircleNotch,
23 | Anchor = Anchor.Centre,
24 | Origin = Anchor.Centre,
25 | };
26 | }
27 |
28 | protected override void LoadComplete()
29 | {
30 | base.LoadComplete();
31 | foreground.Spin(1000, RotationDirection.Clockwise, 90).Loop();
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/SettingsPanel.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using Vignette.Game.Graphics.Containers;
7 | using Vignette.Game.Graphics.Shapes;
8 |
9 | namespace Vignette.Game.Settings
10 | {
11 | public abstract class SettingsPanel : VisibilityContainer
12 | {
13 | protected ThemableBox Background { get; private set; }
14 |
15 | protected override void LoadComplete()
16 | {
17 | base.LoadComplete();
18 | RelativeSizeAxes = Axes.Both;
19 | InternalChildren = new Drawable[]
20 | {
21 | Background = new ThemableBox
22 | {
23 | RelativeSizeAxes = Axes.Both,
24 | },
25 | new FluentDropdownMenuContainer
26 | {
27 | RelativeSizeAxes = Axes.Both,
28 | Child = CreateContent(),
29 | },
30 | };
31 | }
32 |
33 | protected abstract Drawable CreateContent();
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/SettingsControl.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Graphics.UserInterface;
7 |
8 | namespace Vignette.Game.Settings
9 | {
10 | public abstract class SettingsControl : SettingsItem, IHasCurrentValue
11 | where TDrawable : Drawable, IHasCurrentValue
12 | {
13 | public Bindable Current
14 | {
15 | get => Control.Current;
16 | set => Control.Current = value;
17 | }
18 |
19 | protected TDrawable Control { get; set; }
20 |
21 | public SettingsControl()
22 | {
23 | InitializeControl();
24 | }
25 |
26 | protected abstract TDrawable CreateControl();
27 |
28 | protected virtual void InitializeControl()
29 | {
30 | Foreground.Add(Control = CreateControl().With(d =>
31 | {
32 | d.Anchor = Anchor.CentreRight;
33 | d.Origin = Anchor.CentreRight;
34 | }));
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/FluentDirectorySelector.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.IO;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Graphics.Containers;
7 | using osu.Framework.Graphics.UserInterface;
8 | using Vignette.Game.Graphics.Containers;
9 |
10 | namespace Vignette.Game.Graphics.UserInterface
11 | {
12 | public class FluentDirectorySelector : DirectorySelector
13 | {
14 | protected override ScrollContainer CreateScrollContainer()
15 | => new FluentScrollContainer();
16 |
17 | protected override DirectorySelectorBreadcrumbDisplay CreateBreadcrumb()
18 | => new FluentDirectorySelectorBreadcrumbDisplay();
19 |
20 | protected override DirectorySelectorDirectory CreateDirectoryItem(DirectoryInfo directory, string displayName = null)
21 | => new FluentDirectorySelectorDirectory(directory, displayName);
22 |
23 | protected override DirectorySelectorDirectory CreateParentDirectoryItem(DirectoryInfo directory)
24 | => new FluentDirectorySelectorParentDirectory(directory);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/Vignette.Camera.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net5.0
5 | false
6 | Vignette.Camera.Tests.Program
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | Never
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/VisualTestGame.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using osu.Framework;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Graphics.Containers;
7 | using osu.Framework.Graphics.Cursor;
8 | using osu.Framework.Platform;
9 | using osu.Framework.Testing;
10 |
11 | namespace Vignette.Camera.Tests
12 | {
13 | internal class VisualTestGame : Game
14 | {
15 | protected override void LoadComplete()
16 | {
17 | base.LoadComplete();
18 |
19 | Child = new SafeAreaContainer
20 | {
21 | RelativeSizeAxes = Axes.Both,
22 | Child = new DrawSizePreservingFillContainer
23 | {
24 | Children = new Drawable[]
25 | {
26 | new TestBrowser("Vignette"),
27 | new CursorContainer(),
28 | },
29 | }
30 | };
31 | }
32 |
33 | public override void SetHost(GameHost host)
34 | {
35 | base.SetHost(host);
36 | host.Window.CursorState |= CursorState.Hidden;
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Vignette.Game/Screens/SplashScreen.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Sprites;
6 | using osu.Framework.Screens;
7 | using osuTK;
8 | using Vignette.Game.Graphics.Typesets;
9 |
10 | namespace Vignette.Game.Screens
11 | {
12 | public class SplashScreen : VignetteScreen
13 | {
14 | protected override bool AllowToggleSettings => false;
15 |
16 | private readonly SpriteIcon icon;
17 |
18 | public SplashScreen()
19 | {
20 | InternalChild = icon = new SpriteIcon
21 | {
22 | Size = new Vector2(64),
23 | Icon = VignetteFont.Logo,
24 | Anchor = Anchor.Centre,
25 | Origin = Anchor.Centre,
26 | };
27 | }
28 |
29 | protected override void LoadComplete()
30 | {
31 | base.LoadComplete();
32 | LoadComponentAsync(new StageScreen(), screen =>
33 | {
34 | icon.Delay(2000).FadeOutFromOne(500);
35 | Scheduler.AddDelayed(() => this.Push(screen), 3000);
36 | });
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Vignette.Desktop/Vignette.Desktop.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 | net5.0
14 | WinExe
15 | Vignette
16 |
17 |
18 |
19 |
20 |
21 | vignette.ico
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | vignette-insiders.ico
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/Vignette.Camera/EncodingFormat.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | namespace Vignette.Camera
5 | {
6 | ///
7 | /// The file format used for encoding image data.
8 | ///
9 | public enum EncodingFormat
10 | {
11 | ///
12 | /// Windows Bitmap
13 | ///
14 | Bitmap,
15 |
16 | ///
17 | /// Sun Rasters
18 | ///
19 | Raster,
20 |
21 | ///
22 | /// Joint Photographic Experts Group
23 | ///
24 | JPEG,
25 |
26 | ///
27 | /// Joint Photographic Experts Group 2000
28 | ///
29 | JPEG2000,
30 |
31 | ///
32 | /// Tagged Image File Format
33 | ///
34 | TIFF,
35 |
36 | ///
37 | /// Portable Network Graphics
38 | ///
39 | PNG,
40 |
41 | ///
42 | /// Portable Image Format
43 | ///
44 | PBM,
45 |
46 | ///
47 | /// Web Photo
48 | ///
49 | WebP,
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/FluentPopover.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.UserInterface;
6 | using Vignette.Game.Graphics.Shapes;
7 | using Vignette.Game.Graphics.Themeing;
8 |
9 | namespace Vignette.Game.Graphics.UserInterface
10 | {
11 | public class FluentPopover : Popover
12 | {
13 | public FluentPopover()
14 | {
15 | Body.Margin = new MarginPadding(10);
16 | Body.Add(new ThemableEffectBox
17 | {
18 | Depth = 1,
19 | RelativeSizeAxes = Axes.Both,
20 | CornerRadius = 5.0f,
21 | BorderThickness = 1.5f,
22 | BorderColour = ThemeSlot.Gray110,
23 | Colour = ThemeSlot.White,
24 | });
25 |
26 | Background.Colour = Colour4.Transparent;
27 | Content.Padding = new MarginPadding(5);
28 | }
29 |
30 | protected override void PopIn() => this.FadeIn(200, Easing.OutQuint);
31 |
32 | protected override void PopOut() => this.FadeOut(200, Easing.OutQuint);
33 |
34 | protected override Drawable CreateArrow() => Empty();
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/SettingsNavigation.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Sprites;
6 | using osu.Framework.Graphics.UserInterface;
7 | using Vignette.Game.Graphics.UserInterface;
8 |
9 | namespace Vignette.Game.Settings
10 | {
11 | public class SettingsNavigation : NavigationVerticalTabControl
12 | {
13 | public SettingsNavigation()
14 | {
15 | AutoSizeAxes = Axes.Y;
16 | TabContainer.RelativeSizeAxes = Axes.X;
17 | TabContainer.AutoSizeAxes = Axes.Y;
18 | }
19 |
20 | protected override TabItem CreateTabItem(SettingsSection value)
21 | => new MainMenuNavigationTabItem(value);
22 |
23 | protected class MainMenuNavigationTabItem : NavigationVerticalTabItem
24 | {
25 | protected override IconUsage? Icon => Value.Icon;
26 |
27 | protected override bool ForceTextMargin => false;
28 |
29 | public MainMenuNavigationTabItem(SettingsSection value)
30 | : base(value)
31 | {
32 | Height = 40;
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneTextFlowContainer.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using Vignette.Game.Graphics.Containers;
6 | using Vignette.Game.Graphics.Typesets;
7 | using Vignette.Game.Graphics.Themeing;
8 |
9 | namespace Vignette.Game.Tests.Visual.UserInterface
10 | {
11 | public class TestSceneTextFlowContainer : UserInterfaceTestScene
12 | {
13 | private readonly ThemableTextFlowContainer flow;
14 |
15 | public TestSceneTextFlowContainer()
16 | {
17 | Add(flow = new ThemableTextFlowContainer
18 | {
19 | Margin = new MarginPadding(10),
20 | AutoSizeAxes = Axes.Both,
21 | });
22 |
23 | flow.AddText("Welcome to", t => t.Font = SegoeUI.Black.With(size: 24));
24 | flow.AddText(" Vignette", t => t.Font = SegoeUI.Black.With(size: 24));
25 |
26 | flow.NewParagraph();
27 | flow.NewParagraph();
28 |
29 | flow.AddText("The open-source toolkit for VTubers. Made with");
30 | flow.AddText(" <3 ", t => t.Font = SegoeUI.Black);
31 | flow.AddText("with osu!framework.");
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Sprites/ThemableSpriteText.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Sprites;
6 | using osu.Framework.Localisation;
7 | using osuTK;
8 | using Vignette.Game.Graphics.Typesets;
9 | using Vignette.Game.Graphics.Themeing;
10 |
11 | namespace Vignette.Game.Graphics.Sprites
12 | {
13 | public class ThemableSpriteText : ThemableDrawable, IHasText
14 | {
15 | public LocalisableString Text
16 | {
17 | get => Target.Text;
18 | set => Target.Text = value;
19 | }
20 |
21 | public FontUsage Font
22 | {
23 | get => Target.Font;
24 | set => Target.Font = value;
25 | }
26 |
27 | public Vector2 Spacing
28 | {
29 | get => Target.Spacing;
30 | set => Target.Spacing = value;
31 | }
32 |
33 | public ThemableSpriteText(bool attached = true)
34 | : base(attached)
35 | {
36 | AutoSizeAxes = Axes.Both;
37 | }
38 |
39 | protected override SpriteText CreateDrawable() => new SpriteText
40 | {
41 | Font = SegoeUI.Regular,
42 | };
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Components/SettingsSlider.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Graphics;
6 | using Vignette.Game.Graphics.Sprites;
7 | using Vignette.Game.Graphics.Themeing;
8 | using Vignette.Game.Graphics.Typesets;
9 | using Vignette.Game.Graphics.UserInterface;
10 |
11 | namespace Vignette.Game.Settings.Components
12 | {
13 | public class SettingsSlider : SettingsExpandedControl, T>
14 | where T : struct, IComparable, IConvertible, IEquatable
15 | {
16 | private ThemableSpriteText text;
17 |
18 | protected override FluentSlider CreateControl() => new FluentSlider { RelativeSizeAxes = Axes.X };
19 |
20 | protected override void LoadComplete()
21 | {
22 | base.LoadComplete();
23 |
24 | LabelContainer.Add(text = new ThemableSpriteText
25 | {
26 | Font = SegoeUI.SemiBold.With(size: 16),
27 | Colour = ThemeSlot.Black,
28 | Anchor = Anchor.CentreRight,
29 | Origin = Anchor.CentreRight,
30 | });
31 |
32 | Current.BindValueChanged(e => text.Text = $"{e.NewValue:0.##}", true);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Vignette.Camera/Graphics/DrawableCameraVirtual.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | namespace Vignette.Camera.Graphics
5 | {
6 | ///
7 | /// A that can be added to the scene hierarchy.
8 | ///
9 | /// The playback rate is unaffected by .
10 | public class DrawableCameraVirtual : DrawableCameraWrapper, ICameraVirtual
11 | {
12 | /// <
13 | public bool Loop
14 | {
15 | get => Camera.Loop;
16 | set => Camera.Loop = value;
17 | }
18 |
19 | /// <
20 | public int FrameCount => Camera.FrameCount;
21 |
22 | public DrawableCameraVirtual(CameraVirtual camera, bool disposeUnderlyingCameraOnDispose = true)
23 | : base(camera, disposeUnderlyingCameraOnDispose)
24 | {
25 | }
26 |
27 | /// <
28 | int ICameraVirtual.Position => Camera.Position;
29 |
30 | /// <
31 | public void Seek(int frame) => Camera.Seek(frame);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Vignette.Game/Bindables/BindableVector2.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 | using osuTK;
6 |
7 | namespace Vignette.Game.Bindables
8 | {
9 | public class BindableVector2 : Bindable
10 | {
11 | public BindableVector2(Vector2 defaultValue = default)
12 | : base(defaultValue)
13 | {
14 | }
15 |
16 | public override string ToString() => $"{Value.X},{Value.Y}";
17 |
18 | public override void Parse(object input)
19 | {
20 | if (!(input is string str) || string.IsNullOrEmpty(str))
21 | {
22 | Value = default;
23 | return;
24 | }
25 |
26 | string[] values = str.Split(',');
27 | if (values.Length < 2)
28 | {
29 | Value = default;
30 | return;
31 | }
32 |
33 | var value = new Vector2();
34 |
35 | if (float.TryParse(values[0], out float x))
36 | value.X = x;
37 |
38 | if (float.TryParse(values[1], out float y))
39 | value.Y = y;
40 |
41 | Value = value;
42 | }
43 |
44 | protected override Bindable CreateInstance() => new BindableVector2();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/FluentMenuDivider.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.UserInterface;
6 | using Vignette.Game.Graphics.Shapes;
7 | using Vignette.Game.Graphics.Themeing;
8 |
9 | namespace Vignette.Game.Graphics.UserInterface
10 | {
11 | public class FluentMenuDivider : MenuItem
12 | {
13 | public FluentMenuDivider()
14 | : base(string.Empty)
15 | {
16 | }
17 | }
18 |
19 | public class DrawableFluentMenuDivider : Menu.DrawableMenuItem
20 | {
21 | public DrawableFluentMenuDivider(MenuItem item)
22 | : base(item)
23 | {
24 | BackgroundColour = Colour4.White;
25 | BackgroundColourHover = Colour4.White;
26 | }
27 |
28 | protected override Drawable CreateBackground() => new ThemableBox
29 | {
30 | Height = 1,
31 | Colour = ThemeSlot.Gray10,
32 | RelativeSizeAxes = Axes.X,
33 | };
34 |
35 | protected override Drawable CreateContent() => Empty();
36 |
37 | protected override void UpdateBackgroundColour()
38 | {
39 | }
40 |
41 | protected override void UpdateForegroundColour()
42 | {
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Vignette.Camera/Platform/LinuxCameraManager.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using osu.Framework.Threading;
8 |
9 | namespace Vignette.Camera.Platform
10 | {
11 | public class LinuxCameraManager : CameraManager
12 | {
13 | public LinuxCameraManager(Scheduler scheduler)
14 | : base(scheduler)
15 | {
16 | }
17 |
18 | protected override IEnumerable EnumerateAllDevices()
19 | {
20 | for (int i = 0; i < Directory.EnumerateDirectories(@"/dev/").Count(); i++)
21 | {
22 | string path = $"/dev/video{i}";
23 |
24 | string friendlyName;
25 | string friendlyNamePath = $"/sys/class/video4linux/video{i}/name";
26 |
27 | if (File.Exists(friendlyNamePath))
28 | {
29 | using var reader = new StreamReader(File.OpenRead(friendlyNamePath));
30 | friendlyName = reader.ReadToEnd();
31 | }
32 | else
33 | {
34 | friendlyName = path;
35 | }
36 |
37 | yield return new CameraInfo(friendlyName, path);
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Components/OpenSubPanelButton.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Allocation;
5 | using osu.Framework.Graphics;
6 | using osuTK;
7 | using Vignette.Game.Graphics.Sprites;
8 | using Vignette.Game.Graphics.Typesets;
9 | using Vignette.Game.Graphics.Themeing;
10 | using System;
11 |
12 | namespace Vignette.Game.Settings.Components
13 | {
14 | public class OpenSubPanelButton : SettingsInteractableItem
15 | where T : SettingsSubPanel
16 | {
17 | private readonly object[] args;
18 |
19 | public OpenSubPanelButton(params object[] args)
20 | {
21 | this.args = args;
22 | }
23 |
24 | [BackgroundDependencyLoader]
25 | private void load(SettingsOverlay overlay)
26 | {
27 | Foreground.Add(new ThemableSpriteIcon
28 | {
29 | Size = new Vector2(12),
30 | Icon = SegoeFluent.ChevronRight,
31 | Colour = ThemeSlot.Black,
32 | Anchor = Anchor.CentreRight,
33 | Origin = Anchor.CentreRight,
34 | Margin = new MarginPadding { Right = 6 },
35 | });
36 |
37 | Action = () => overlay?.ShowSubPanel(Activator.CreateInstance(typeof(T), args) as T);
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneSlider.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 | using osu.Framework.Graphics;
6 | using Vignette.Game.Graphics.UserInterface;
7 |
8 | namespace Vignette.Game.Tests.Visual.UserInterface
9 | {
10 | public class TestSceneSlider : UserInterfaceTestScene
11 | {
12 | public TestSceneSlider()
13 | {
14 | FluentSlider disabled;
15 |
16 | AddRange(new Drawable[]
17 | {
18 | new FluentSlider
19 | {
20 | Width = 200,
21 | Current = new BindableInt
22 | {
23 | Value = 3,
24 | MinValue = 0,
25 | MaxValue = 10,
26 | }
27 | },
28 | disabled = new FluentSlider
29 | {
30 | Width = 200,
31 | Current = new BindableInt
32 | {
33 | Value = 3,
34 | MinValue = 0,
35 | MaxValue = 10,
36 | }
37 | },
38 | });
39 |
40 | disabled.Current.Disabled = true;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Extensions.IEnumerableExtensions;
5 | using osu.Framework.Graphics.UserInterface;
6 | using osu.Framework.Screens;
7 | using System.Linq;
8 |
9 | namespace Vignette.Game.Graphics.UserInterface
10 | {
11 | public class ScreenBreadcrumbControl : FluentBreadcrumbControl
12 | {
13 | public ScreenBreadcrumbControl(ScreenStack stack)
14 | {
15 | stack.ScreenPushed += screenPushed;
16 | stack.ScreenExited += screenExited;
17 |
18 | if (stack.CurrentScreen != null)
19 | screenPushed(null, stack.CurrentScreen);
20 | }
21 |
22 | protected override void SelectTab(TabItem tab)
23 | => tab.Value.MakeCurrent();
24 |
25 | private void screenPushed(IScreen lastScreen, IScreen newScreen)
26 | {
27 | AddItem(newScreen);
28 | Current.Value = newScreen;
29 | }
30 |
31 | private void screenExited(IScreen lastScreen, IScreen newScreen)
32 | {
33 | if (newScreen != null)
34 | Current.Value = newScreen;
35 |
36 | Items.ToList().SkipWhile(s => s != Current.Value).Skip(1).ForEach(RemoveItem);
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/Curve.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System.Collections.Generic;
7 | using System.Linq;
8 | using Vignette.Live2D.Graphics;
9 | using Vignette.Live2D.Motion.Segments;
10 |
11 | namespace Vignette.Live2D.Motion
12 | {
13 | public class Curve
14 | {
15 | public IEnumerable Segments { get; set; }
16 |
17 | public CubismMotionTarget TargetType { get; set; }
18 |
19 | public CubismId Effect { get; set; }
20 |
21 | public CubismPart Part { get; set; }
22 |
23 | public CubismParameter Parameter { get; set; }
24 |
25 | public double FadeInTime { get; set; }
26 |
27 | public double FadeOutTime { get; set; }
28 |
29 | public double ValueAt(double time)
30 | {
31 | foreach (var segment in Segments)
32 | {
33 | var points = segment.Points;
34 | if (time <= points.Last().Time)
35 | return (points[0].Time <= time) ? segment.ValueAt(time) : points[0].Value;
36 | }
37 |
38 | return Segments.Last().Points.Last().Value;
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/Vignette.Live2D/Motion/Segments/BezierSegment.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 |
8 | namespace Vignette.Live2D.Motion.Segments
9 | {
10 | public class BezierSegment : Segment
11 | {
12 | public BezierSegment()
13 | : base(4)
14 | {
15 | }
16 |
17 | public override double ValueAt(double time)
18 | {
19 | double t = (time - Points[0].Time) / (Points[3].Time - Points[0].Time);
20 | t = Math.Max(t, 0);
21 | var p01 = lerp(Points[0], Points[1], t);
22 | var p12 = lerp(Points[1], Points[2], t);
23 | var p23 = lerp(Points[2], Points[3], t);
24 | var p012 = lerp(p01, p12, t);
25 | var p123 = lerp(p12, p23, t);
26 | return lerp(p012, p123, t).Value;
27 | }
28 |
29 | private static ControlPoint lerp(ControlPoint a, ControlPoint b, double t)
30 | {
31 | return new ControlPoint
32 | {
33 | Time = a.Time + ((b.Time - a.Time) * t),
34 | Value = a.Value + ((b.Value - a.Value) * t)
35 | };
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/Vignette.Game/Extensions/IViewExtensions.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using Vignette.Game.Graphics.Containers;
6 |
7 | namespace Vignette.Game.Extensions
8 | {
9 | public static class IViewExtensions
10 | {
11 | ///
12 | /// Makes this view the current view of its parent .
13 | ///
14 | public static void MakeCurrent(this IView view)
15 | {
16 | if (view.Parent is not ViewContainer container)
17 | throw new InvalidOperationException($"Cannot make this view current as it is not inside a {nameof(ViewContainer)}");
18 |
19 | container.Show(view);
20 | }
21 |
22 | ///
23 | /// Returns to the previous view with the option of expiring this view.
24 | ///
25 | /// Should we expire or not.
26 | public static void Return(this IView view, bool expire = false)
27 | {
28 | if (view.Parent is not ViewContainer container)
29 | throw new InvalidOperationException($"Cannot return view as it is not inside a {nameof(ViewContainer)}");
30 |
31 | container.Return(expire);
32 | }
33 |
34 | public static View AsDrawable(this IView view) => (View)view;
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Shapes/ThemableCircle.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Shapes;
6 | using Vignette.Game.Graphics.Themeing;
7 |
8 | namespace Vignette.Game.Graphics.Shapes
9 | {
10 | public class ThemableCircle : ThemableDrawable
11 | {
12 | private ThemeSlot borderColour;
13 |
14 | public new ThemeSlot BorderColour
15 | {
16 | get => borderColour;
17 | set
18 | {
19 | if (borderColour == value)
20 | return;
21 |
22 | borderColour = value;
23 | ScheduleThemeChange();
24 | }
25 | }
26 |
27 | public new float BorderThickness
28 | {
29 | get => Target.BorderThickness;
30 | set => Target.BorderThickness = value;
31 | }
32 |
33 | public ThemableCircle(bool attached = true)
34 | : base(attached)
35 | {
36 | }
37 |
38 | protected override Circle CreateDrawable() => new Circle
39 | {
40 | RelativeSizeAxes = Axes.Both,
41 | };
42 |
43 | protected override void ThemeChanged(Theme theme)
44 | {
45 | Target.Child.Colour = theme.Get(Colour);
46 | Target.BorderColour = theme.Get(BorderColour);
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Typesets/SegoeUI.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics.Sprites;
5 |
6 | namespace Vignette.Game.Graphics.Typesets
7 | {
8 | public static class SegoeUI
9 | {
10 | public static FontUsage Light => GetFont(FontWeight.Light);
11 |
12 | public static FontUsage SemiLight => GetFont(FontWeight.SemiLight);
13 |
14 | public static FontUsage Regular => GetFont();
15 |
16 | public static FontUsage SemiBold => GetFont(FontWeight.SemiBold);
17 |
18 | public static FontUsage Bold => GetFont(FontWeight.Bold);
19 |
20 | public static FontUsage Black => GetFont(FontWeight.Black);
21 |
22 | public static FontUsage GetFont(FontWeight? weight = null, float size = 14.0f, bool italics = false, bool fixedWidth = false)
23 | => new FontUsage("SegoeUI", size, weight?.ToString(), italics, fixedWidth);
24 | }
25 |
26 | public static class SegoeUIFontExtensions
27 | {
28 | public static FontUsage With(this FontUsage usage, FontWeight? weight = null, float? size = null, bool? italics = null, bool? fixedWidth = null)
29 | => usage.With("SegoeUI", size, weight?.ToString(), italics, fixedWidth);
30 | }
31 |
32 | public enum FontWeight
33 | {
34 | Light,
35 |
36 | SemiLight,
37 |
38 | SemiBold,
39 |
40 | Bold,
41 |
42 | Black
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Visual/Model/TestSceneCubismModel.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using NUnit.Framework;
7 | using System.Linq;
8 | using Vignette.Live2D.Model;
9 |
10 | namespace Vignette.Live2D.Tests.Visual.Model
11 | {
12 | public class TestSceneCubismModel : CubismModelTestScene
13 | {
14 | [Test]
15 | public void TestModelInitialization()
16 | {
17 | AddAssert("has drawables", () => Model.Drawables.Any());
18 | AddAssert("has parts", () => Model.Drawables.Any());
19 | AddAssert("has parameters", () => Model.Parameters.Any());
20 | AddAssert("check version", () => Model.Version != CubismMocVersion.csmMocVersion_Unknown);
21 | }
22 |
23 | [Test]
24 | public void TestModelParameterUpdate()
25 | {
26 | var target = Model.Parameters.FirstOrDefault(p => p.Name == "ParamMouthOpenY");
27 | AddAssert("check if default", () => target.Value == target.Default);
28 | AddStep("set to maximum", () => Schedule(() => target.Value = target.Maximum));
29 | AddWaitStep("wait", 5);
30 | AddAssert("check if maximum", () => target.Value == target.Maximum);
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/NavigationHorizontalTabControl.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 |
6 | namespace Vignette.Game.Graphics.UserInterface
7 | {
8 | public abstract class NavigationHorizontalTabControl : NavigationTabControl
9 | {
10 | public NavigationHorizontalTabControl()
11 | {
12 | Height = 44;
13 | }
14 |
15 | protected abstract class NavigationHorizontalTabItem : NavigationTabItem
16 | {
17 | protected override bool ForceTextMargin => false;
18 |
19 | protected override float TextLeftMargin => 30;
20 |
21 | public NavigationHorizontalTabItem(T value)
22 | : base(value)
23 | {
24 | AutoSizeAxes = Axes.X;
25 | RelativeSizeAxes = Axes.Y;
26 |
27 | LabelContainer.Add(Highlight.With(d =>
28 | {
29 | d.Anchor = Anchor.BottomCentre;
30 | d.Origin = Anchor.BottomCentre;
31 | d.RelativeSizeAxes = Axes.X;
32 | }));
33 | }
34 |
35 | protected override void OnActivated()
36 | => Highlight.ResizeHeightTo(3, 200, Easing.OutQuint);
37 |
38 | protected override void OnDeactivated()
39 | => Highlight.ResizeHeightTo(0, 200, Easing.OutQuint);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/SettingsMainPanel.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osuTK;
7 | using Vignette.Game.Graphics.Containers;
8 |
9 | namespace Vignette.Game.Settings
10 | {
11 | public class SettingsMainPanel : SettingsPanel
12 | {
13 | public string SearchTerm
14 | {
15 | get => flow.SearchTerm;
16 | set => flow.SearchTerm = value;
17 | }
18 |
19 | public UserTrackingScrollContainer ScrollContainer { get; private set; }
20 |
21 | protected override Container Content => flow;
22 |
23 | private readonly SearchContainer flow = new SearchContainer
24 | {
25 | RelativeSizeAxes = Axes.X,
26 | AutoSizeAxes = Axes.Y,
27 | Direction = FillDirection.Vertical,
28 | Spacing = new Vector2(0, 5),
29 | };
30 |
31 | protected override Drawable CreateContent() => ScrollContainer = new UserTrackingScrollContainer
32 | {
33 | RelativeSizeAxes = Axes.Both,
34 | Child = flow,
35 | };
36 |
37 | protected override void LoadComplete()
38 | {
39 | base.LoadComplete();
40 | Show();
41 | }
42 |
43 | protected override void PopIn() => Alpha = 1;
44 |
45 | protected override void PopOut() => Alpha = 0;
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Vignette.Game/IO/RecursiveNativeStorage.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using System.IO;
7 | using System.Linq;
8 | using osu.Framework.Platform;
9 |
10 | namespace Vignette.Game.IO
11 | {
12 | public class RecursiveNativeStorage : NativeStorage
13 | {
14 | public RecursiveNativeStorage(string path, GameHost host)
15 | : base(path, host)
16 | {
17 | }
18 |
19 | public override IEnumerable GetDirectories(string path) => getRelativePaths(Directory.GetDirectories(GetFullPath(path), "*", SearchOption.AllDirectories));
20 |
21 | public override IEnumerable GetFiles(string path, string pattern = "*") => getRelativePaths(Directory.GetFiles(GetFullPath(path), pattern, SearchOption.AllDirectories));
22 |
23 | private IEnumerable getRelativePaths(IEnumerable paths)
24 | {
25 | string basePath = Path.GetFullPath(GetFullPath(string.Empty));
26 | return paths.Select(Path.GetFullPath).Select(path =>
27 | {
28 | if (!path.StartsWith(basePath, StringComparison.Ordinal))
29 | throw new ArgumentException($"\"{path}\" does not start with \"{basePath}\" and is probably malformed");
30 |
31 | return path.AsSpan(basePath.Length).TrimStart(Path.DirectorySeparatorChar).ToString();
32 | });
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/ThemeProvidedTestScene.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osu.Framework.Graphics.UserInterface;
7 | using Vignette.Game.Graphics.Themeing;
8 |
9 | namespace Vignette.Game.Tests.Visual
10 | {
11 | public abstract class ThemeProvidedTestScene : VignetteTestScene
12 | {
13 | protected readonly ThemeProvidingContainer Provider;
14 |
15 | protected override Container Content => Provider;
16 |
17 | protected readonly BasicDropdown Selector;
18 |
19 | public ThemeProvidedTestScene()
20 | {
21 | base.Content.AddRange(new Drawable[]
22 | {
23 | Provider = new ThemeProvidingContainer
24 | {
25 | RelativeSizeAxes = Axes.Both
26 | },
27 | Selector = new BasicDropdown
28 | {
29 | Width = 200,
30 | Anchor = Anchor.TopRight,
31 | Origin = Anchor.TopRight,
32 | Margin = new MarginPadding(20),
33 | Items = new[]
34 | {
35 | Theme.Light,
36 | Theme.Dark,
37 | }
38 | },
39 | });
40 |
41 | Selector.Current = Provider.Current;
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneBreadcrumbControl.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Linq;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Graphics.Containers;
7 | using Vignette.Game.Graphics.UserInterface;
8 |
9 | namespace Vignette.Game.Tests.Visual.UserInterface
10 | {
11 | public class TestSceneBreadcrumbControl : UserInterfaceTestScene
12 | {
13 | public TestSceneBreadcrumbControl()
14 | {
15 | int count = 0;
16 | TestBreadcrumbControl header;
17 |
18 | Add(header = new TestBreadcrumbControl
19 | {
20 | RelativeSizeAxes = Axes.X,
21 | });
22 |
23 | AddStep("add", () =>
24 | {
25 | string name = $"step {count++}";
26 | header.AddItem(name);
27 | header.Current.Value = name;
28 | });
29 | }
30 |
31 | private class TestBreadcrumbControl : FluentBreadcrumbControl
32 | {
33 | public TestBreadcrumbControl()
34 | {
35 | Height = 36;
36 | Current.ValueChanged += _ =>
37 | {
38 | foreach (var t in TabContainer.Children.OfType().Where(t => t.State == Visibility.Hidden).ToArray())
39 | RemoveItem(t.Value);
40 | };
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Configuration/JsonConfigManagerTest.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using NUnit.Framework;
6 | using osu.Framework.Platform;
7 | using Vignette.Game.Configuration;
8 |
9 | namespace Vignette.Game.Tests.Configuration
10 | {
11 | [TestFixture]
12 | public class JsonConfigManagerTest
13 | {
14 | [Test]
15 | public void TestSaveLoad()
16 | {
17 | const int change = 727;
18 | using (var storage = new TemporaryNativeStorage(Guid.NewGuid().ToString()))
19 | {
20 | using (var manager = new TestConfigurationManager(storage))
21 | {
22 | Assert.AreEqual(manager.TestNumber, default(int));
23 | manager.TestNumber = change;
24 | Assert.AreEqual(manager.TestNumber, change);
25 | }
26 |
27 | using (var manager = new TestConfigurationManager(storage))
28 | Assert.AreEqual(manager.TestNumber, change);
29 | }
30 | }
31 |
32 | private class TestConfigurationManager : JsonConfigManager
33 | {
34 | protected override string Filename => "test-config.json";
35 |
36 | public int TestNumber { get; set; }
37 |
38 | public TestConfigurationManager(Storage storage)
39 | : base(storage)
40 | {
41 | }
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Vignette.Game/IO/UserResources.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Platform;
6 |
7 | namespace Vignette.Game.IO
8 | {
9 | public class UserResources : IDisposable
10 | {
11 | protected Storage Storage { get; private set; }
12 |
13 | public MonitoredResourceStore Themes { get; private set; }
14 |
15 | public MonitoredResourceStore Avatars { get; private set; }
16 |
17 | public UserResources(GameHost host, Storage defaultStorage)
18 | {
19 | Storage = defaultStorage.GetStorageForDirectory("files");
20 |
21 | Themes = new MonitoredResourceStore(Storage.GetStorageForDirectory("themes"), new[] { ".json" });
22 | Avatars = new MonitoredResourceStore(Storage.GetStorageForDirectory("avatars"));
23 | }
24 |
25 | #region Disposal
26 |
27 | private bool disposedValue;
28 |
29 | protected virtual void Dispose(bool disposing)
30 | {
31 | if (!disposedValue)
32 | {
33 | if (disposing)
34 | {
35 | Themes?.Dispose();
36 | Avatars?.Dispose();
37 | }
38 |
39 | disposedValue = true;
40 | }
41 | }
42 |
43 | public void Dispose()
44 | {
45 | Dispose(true);
46 | GC.SuppressFinalize(this);
47 | }
48 |
49 | #endregion
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneMarkdown.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using osu.Framework.Graphics;
6 | using Vignette.Game.Graphics.Containers;
7 |
8 | namespace Vignette.Game.Tests.Visual.UserInterface
9 | {
10 | public class TestSceneMarkdown : UserInterfaceTestScene
11 | {
12 | public TestSceneMarkdown()
13 | {
14 | string text = string.Join(
15 | Environment.NewLine,
16 | "# Heading 1",
17 | "## Heading 2",
18 | "### Heading 3",
19 | "#### Heading 4",
20 | "##### Heading 5",
21 | "###### Heading 6",
22 | "",
23 | "Paragraph",
24 | "",
25 | "**Bold**",
26 | "*Italic*",
27 | "1. Ordered Item",
28 | "2. Ordered Item",
29 | "",
30 | "- Unordered Item",
31 | "- Unordered Item",
32 | "",
33 | "[Link](https://github.com/vignette-project)",
34 | "",
35 | ""
36 | );
37 |
38 | Add(new FluentMarkdownContainer
39 | {
40 | RelativeSizeAxes = Axes.X,
41 | AutoSizeAxes = Axes.Y,
42 | Text = text,
43 | });
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneNumberBox.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 | using Vignette.Game.Graphics.UserInterface;
6 |
7 | namespace Vignette.Game.Tests.Visual.UserInterface
8 | {
9 | public class TestSceneNumberBox : UserInterfaceTestScene
10 | {
11 | private readonly FluentNumberBox numberBox;
12 |
13 | public TestSceneNumberBox()
14 | {
15 | Add(numberBox = new FluentNumberBox
16 | {
17 | Width = 100,
18 | Current = new BindableFloat
19 | {
20 | Default = 0,
21 | Precision = 0.1f,
22 | }
23 | });
24 |
25 | Add(new FluentNumberBox
26 | {
27 | Width = 100,
28 | Current = new BindableInt
29 | {
30 | Disabled = true,
31 | }
32 | });
33 |
34 | AddStep("increment", () => numberBox.Increment());
35 | AddAssert("check value", () => numberBox.Current.Value == 0.1f);
36 | AddStep("set value to default", () => numberBox.Current.SetDefault());
37 | AddAssert("check value", () => numberBox.Current.Value == 0);
38 | AddStep("decrement", () => numberBox.Decrement());
39 | AddAssert("check value", () => numberBox.Current.Value == -0.1f);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: Continuous Integration
2 | on:
3 | push:
4 | paths:
5 | - '**/*.cs'
6 | - '**/*.csproj'
7 | - '**/*.sln'
8 | pull_request:
9 | paths:
10 | - '**/*.cs'
11 | - '**/*.csproj'
12 | - '**/*.sln'
13 |
14 | jobs:
15 | # Disabled until the editorconfig bug can be fixed
16 | # Reviewers will have to manually review indenting for now.
17 | #
18 | # lint:
19 | # name: Lint
20 | # runs-on: ubuntu-latest
21 | # steps:
22 | # - name: Checkout
23 | # uses: actions/checkout@v2#
24 | #
25 | # - name: Lint
26 | # uses: github/super-linter@v3
27 | # env:
28 | # SUPPRESS_POSSUM: true
29 | # LINTER_RULES_PATH: /
30 | # VALIDATE_EDITORCONFIG: true
31 | # EDITORCONFIG_FILE_NAME: .editorconfig
32 | # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
33 |
34 | test:
35 | name: Test
36 | runs-on: ubuntu-latest
37 | steps:
38 | - name: Checkout
39 | uses: actions/checkout@v2
40 |
41 | - name: Install .NET
42 | uses: actions/setup-dotnet@v1
43 | with:
44 | dotnet-version: '5.0.x'
45 |
46 | - name: Test
47 | run: dotnet test --logger "trx;LogFileName=TestResults-Vignette.Game.Tests.trx"
48 |
49 | - name: Upload Test Results
50 | uses: actions/upload-artifact@v2
51 | if: ${{ always() }}
52 | with:
53 | name: TestResults-Vignette.Game.Tests
54 | path: ${{ github.workspace }}/Vignette.Game.Tests/TestResults/TestResults-Vignette.Game.Tests.trx
55 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Themeing/Theme_Generator.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 |
6 | namespace Vignette.Game.Graphics.Themeing
7 | {
8 | public partial class Theme
9 | {
10 | ///
11 | /// Create a theme from base colours.
12 | ///
13 | /// The base background colour.
14 | /// The base foreground colour.
15 | /// The base accent colour.
16 | public static Theme From(string accent)
17 | => From(Colour4.FromHex(accent));
18 |
19 | ///
20 | /// Create a theme from base colours.
21 | ///
22 | /// The base accent colour.
23 | public static Theme From(Colour4 accent)
24 | => new Theme()
25 | .Set(ThemeSlot.AccentDarker, accent.Darken(0.24f))
26 | .Set(ThemeSlot.AccentDark, accent.Darken(0.12f))
27 | .Set(ThemeSlot.AccentDarkAlt, accent.Darken(0.6f))
28 | .Set(ThemeSlot.AccentPrimary, accent)
29 | .Set(ThemeSlot.AccentSecondary, accent.Lighten(0.6f))
30 | .Set(ThemeSlot.AccentTertiary, accent.Lighten(0.12f))
31 | .Set(ThemeSlot.AccentLight, accent.Lighten(0.18f))
32 | .Set(ThemeSlot.AccentLighter, accent.Lighten(0.24f))
33 | .Set(ThemeSlot.AccentLighterAlt, accent.Lighten(0.3f));
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/Vignette.Game/Screens/VignetteScreen.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Allocation;
5 | using osu.Framework.Graphics.Containers;
6 | using osu.Framework.Input.Bindings;
7 | using osu.Framework.Screens;
8 | using Vignette.Game.Input;
9 | using Vignette.Game.Settings;
10 |
11 | namespace Vignette.Game.Screens
12 | {
13 | public class VignetteScreen : Screen, IKeyBindingHandler
14 | {
15 | protected virtual bool AllowToggleSettings => true;
16 |
17 | protected virtual bool ShowSettingsOneEnter => false;
18 |
19 | [Resolved]
20 | private SettingsOverlay settings { get; set; }
21 |
22 | public override void OnEntering(IScreen last)
23 | {
24 | if (settings.State.Value == Visibility.Visible && !AllowToggleSettings)
25 | settings.Hide();
26 |
27 | if (AllowToggleSettings && ShowSettingsOneEnter)
28 | settings.Show();
29 |
30 | base.OnEntering(last);
31 | }
32 |
33 | public bool OnPressed(GlobalAction action)
34 | {
35 | switch (action)
36 | {
37 | case GlobalAction.ToggleSettings:
38 | if (AllowToggleSettings)
39 | settings.ToggleVisibility();
40 | return true;
41 |
42 | default:
43 | return false;
44 | }
45 | }
46 |
47 | public void OnReleased(GlobalAction action)
48 | {
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/FluentDirectorySelectorDirectory.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.IO;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Graphics.Sprites;
7 | using osu.Framework.Graphics.UserInterface;
8 | using osuTK;
9 | using Vignette.Game.Graphics.Sprites;
10 | using Vignette.Game.Graphics.Themeing;
11 | using Vignette.Game.Graphics.Typesets;
12 |
13 | namespace Vignette.Game.Graphics.UserInterface
14 | {
15 | public class FluentDirectorySelectorDirectory : DirectorySelectorDirectory
16 | {
17 | protected override IconUsage? Icon => null;
18 |
19 | protected virtual IconUsage? DisplayIcon => (Directory != null && Directory.Parent == null) ? SegoeFluent.Storage : SegoeFluent.Folder;
20 |
21 | protected override SpriteText CreateSpriteText() => new CheapThemableSpriteText { Colour = ThemeSlot.Black };
22 |
23 | public FluentDirectorySelectorDirectory(DirectoryInfo directory, string displayName = null)
24 | : base(directory, displayName)
25 | {
26 | }
27 |
28 | protected override void LoadComplete()
29 | {
30 | base.LoadComplete();
31 |
32 | Flow.Margin = new MarginPadding();
33 |
34 | if (!DisplayIcon.HasValue)
35 | return;
36 |
37 | Flow.Insert(-1, new ThemableSpriteIcon
38 | {
39 | Size = new Vector2(16),
40 | Icon = DisplayIcon.Value,
41 | Colour = ThemeSlot.Black,
42 | });
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/UserInterface/NavigationVerticalTabControl.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osuTK;
7 | using Vignette.Game.Graphics.Typesets;
8 |
9 | namespace Vignette.Game.Graphics.UserInterface
10 | {
11 | public abstract class NavigationVerticalTabControl : NavigationTabControl
12 | {
13 | public NavigationVerticalTabControl()
14 | {
15 | TabContainer.Direction = FillDirection.Vertical;
16 | TabContainer.AllowMultiline = true;
17 | TabContainer.Spacing = new Vector2(0, 2);
18 | }
19 |
20 | protected abstract class NavigationVerticalTabItem : NavigationTabItem
21 | {
22 | public NavigationVerticalTabItem(T value)
23 | : base(value)
24 | {
25 | Height = 36;
26 | RelativeSizeAxes = Axes.X;
27 |
28 | Add(Highlight.With(d =>
29 | {
30 | d.Anchor = Anchor.CentreLeft;
31 | d.Origin = Anchor.CentreLeft;
32 | d.RelativeSizeAxes = Axes.Y;
33 | d.Size = new Vector2(4, 0);
34 | }));
35 | }
36 |
37 | protected override void OnActivated()
38 | => Highlight.ResizeHeightTo(0.4f, 200, Easing.OutQuint);
39 |
40 | protected override void OnDeactivated()
41 | => Highlight.ResizeHeightTo(0, 200, Easing.OutQuint);
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/SettingsInteractableItem.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using System;
6 | using Vignette.Game.Graphics.Shapes;
7 | using Vignette.Game.Graphics.UserInterface;
8 | using Vignette.Game.Graphics.Themeing;
9 |
10 | namespace Vignette.Game.Settings
11 | {
12 | public class SettingsInteractableItem : SettingsItem
13 | {
14 | protected Action Action
15 | {
16 | get => button.Action;
17 | set => button.Action = value;
18 | }
19 |
20 | private SettingsInteractableItemBackground button;
21 |
22 | protected override Drawable CreateBackground() => button = new SettingsInteractableItemBackground();
23 |
24 | private class SettingsInteractableItemBackground : FluentButtonBase
25 | {
26 | private readonly ThemableBox background;
27 |
28 | public SettingsInteractableItemBackground()
29 | {
30 | RelativeSizeAxes = Axes.Both;
31 |
32 | InternalChild = background = new ThemableBox
33 | {
34 | RelativeSizeAxes = Axes.Both,
35 | };
36 |
37 | BackgroundResting = ThemeSlot.Gray30;
38 | BackgroundPressed = ThemeSlot.Gray60;
39 | BackgroundHovered = ThemeSlot.Gray50;
40 | BackgroundDisabled = ThemeSlot.Gray30;
41 | }
42 |
43 | protected override void UpdateBackground(ThemeSlot slot) => background.Colour = slot;
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Vignette.Game/Input/VignetteKeyBindManager.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using System.Linq;
7 | using Newtonsoft.Json;
8 | using osu.Framework.Input.Bindings;
9 | using osu.Framework.Platform;
10 | using Vignette.Game.Configuration;
11 | using Vignette.Game.Configuration.Converters;
12 |
13 | namespace Vignette.Game.Input
14 | {
15 | public class VignetteKeyBindManager : JsonConfigManager
16 | {
17 | protected override string Filename => "keybinds.json";
18 |
19 | [JsonIgnore]
20 | public Action KeyBindsChanged;
21 |
22 | [JsonProperty]
23 | [JsonConverter(typeof(EnumKeyBindingConverter))]
24 | public List Global { get; private set; } = GlobalActionContainer.GlobalKeyBindings.ToList();
25 |
26 | public VignetteKeyBindManager(Storage storage)
27 | : base(storage)
28 | {
29 | }
30 |
31 | public void SetKeyBind(GlobalAction action, params InputKey[] keys)
32 | {
33 | if (keys.Length == 0)
34 | return;
35 |
36 | var keybind = Global.FirstOrDefault(k => k.GetAction() == action);
37 |
38 | if (keybind == null)
39 | return;
40 |
41 | keybind.KeyCombination = keys;
42 |
43 | Save();
44 | }
45 |
46 | protected override bool PerformSave()
47 | {
48 | KeyBindsChanged?.Invoke();
49 | return base.PerformSave();
50 | }
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/StatefulSettingsSubSection.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System;
5 | using System.Collections.Generic;
6 | using osu.Framework.Bindables;
7 | using osu.Framework.Graphics;
8 | using osu.Framework.Graphics.UserInterface;
9 |
10 | namespace Vignette.Game.Settings
11 | {
12 | public class StatefulSettingsSubSection : SettingsSubSection, IHasCurrentValue
13 | {
14 | public Bindable Current
15 | {
16 | get => current.Current;
17 | set => current.Current = value;
18 | }
19 |
20 | ///
21 | /// A map to the possible states and the drawables representing those states. The key is the state
22 | /// and the value is the drawable representation of that state. Null values are accepted and means nothing to be shown.
23 | ///
24 | public Dictionary Map { get; set; }
25 |
26 | private readonly BindableWithCurrent current = new BindableWithCurrent();
27 |
28 | protected override void LoadComplete()
29 | {
30 | if (Map == null)
31 | throw new InvalidOperationException($"{nameof(Map)} must be defined.");
32 |
33 | base.LoadComplete();
34 |
35 | Current.BindValueChanged(handleStateChange, true);
36 | }
37 |
38 | private void handleStateChange(ValueChangedEvent e)
39 | {
40 | Clear(false);
41 |
42 | var next = Map[e.NewValue];
43 |
44 | if (next != null)
45 | Add(next);
46 | }
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Program.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using System;
7 | using System.Linq;
8 | using osu.Framework;
9 | using osu.Framework.Input.Handlers.Mouse;
10 | using osu.Framework.IO.Stores;
11 | using osu.Framework.Logging;
12 | using osu.Framework.Testing;
13 | using Vignette.Live2D.Resources;
14 |
15 | namespace Vignette.Live2D.Tests
16 | {
17 | public class Program
18 | {
19 | [STAThread]
20 | public static void Main(string[] args)
21 | {
22 | using var host = Host.GetSuitableHost("vignette");
23 | host.Run(new VisualTestGame());
24 | }
25 |
26 | private class VisualTestGame : Game
27 | {
28 | public VisualTestGame()
29 | {
30 | CubismCore.SetLogger(new CubismCore.CubismLogFunction(message => Logger.GetLogger("performance-cubism").Debug(message)));
31 | }
32 |
33 | protected override void LoadComplete()
34 | {
35 | base.LoadComplete();
36 |
37 | Resources.AddStore(new NamespacedResourceStore(new DllResourceStore(CubismResources.ResourceAssembly), "Resources"));
38 |
39 | var mouse = (MouseHandler)Host.AvailableInputHandlers.Single(i => i is MouseHandler);
40 | mouse.UseRelativeMode.Value = false;
41 |
42 | Add(new TestBrowser("Vignette"));
43 | }
44 | }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/Vignette.Game/IO/MonitoredResourceStore.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.Collections.Generic;
5 | using System.IO;
6 | using System.Linq;
7 | using System.Threading.Tasks;
8 | using osu.Framework.IO.Stores;
9 | using osu.Framework.Platform;
10 |
11 | namespace Vignette.Game.IO
12 | {
13 | public class MonitoredResourceStore : MonitoredStorage, IResourceStore
14 | {
15 | protected IResourceStore UnderlyingStore;
16 |
17 | private string[] filters;
18 |
19 | public MonitoredResourceStore(Storage underlyingStorage, IEnumerable filters = null)
20 | : base(underlyingStorage, filters)
21 | {
22 | this.filters = filters?.ToArray();
23 | UnderlyingStore = new StorageBackedResourceStore(underlyingStorage);
24 | }
25 |
26 | public byte[] Get(string name)
27 | => UnderlyingStore.Get(name);
28 |
29 | public Task GetAsync(string name)
30 | => UnderlyingStore.GetAsync(name);
31 |
32 | // UnderlyingStore would always yield no results from the root directory.
33 | // Might be a bug on the framework's end since it only checks for subdirectories.
34 | public IEnumerable GetAvailableResources()
35 | => UnderlyingStorage
36 | .GetDirectories(string.Empty)
37 | .Append(string.Empty)
38 | .SelectMany(d => UnderlyingStorage.GetFiles(d))
39 | .Where(p => filters?.Contains(Path.GetExtension(p)) ?? false);
40 |
41 | public Stream GetStream(string name)
42 | => UnderlyingStore.GetStream(name);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/Vignette.Game/VignetteGame.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Allocation;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Graphics.Containers;
7 | using osu.Framework.Screens;
8 | using Vignette.Game.Screens;
9 | using Vignette.Game.Settings;
10 |
11 | namespace Vignette.Game
12 | {
13 | public class VignetteGame : VignetteGameBase
14 | {
15 | public ScreenStack ScreenStack { get; private set; }
16 |
17 | protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent)
18 | => dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
19 |
20 | private DependencyContainer dependencies;
21 | private SettingsOverlay overlay;
22 |
23 | public VignetteGame()
24 | {
25 | Name = @"Vignette";
26 | }
27 |
28 | protected override void LoadComplete()
29 | {
30 | base.LoadComplete();
31 |
32 | dependencies.CacheAs(this);
33 | dependencies.CacheAs(overlay = new SettingsOverlay());
34 |
35 | AddRange(new Drawable[]
36 | {
37 | ScreenStack = new ScreenStack(new SplashScreen()),
38 | overlay,
39 | });
40 |
41 | overlay.State.ValueChanged += _ => handleOverlayStateChange();
42 | }
43 |
44 | private void handleOverlayStateChange()
45 | {
46 | bool visible = overlay.State.Value == Visibility.Visible;
47 | ScreenStack.TransformTo(nameof(Margin), new MarginPadding { Left = visible ? SettingsSidebar.WIDTH : 0 }, 300, visible ? Easing.OutCirc : Easing.InCirc);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Sections/FooterSection.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osuTK;
7 | using Vignette.Game.Graphics.Containers;
8 | using Vignette.Game.Graphics.Sprites;
9 | using Vignette.Game.Graphics.Themeing;
10 | using Vignette.Game.Graphics.Typesets;
11 |
12 | namespace Vignette.Game.Settings.Sections
13 | {
14 | public class FooterSection : SettingsSection
15 | {
16 | public FooterSection()
17 | {
18 | Child = new FillFlowContainer
19 | {
20 | RelativeSizeAxes = Axes.X,
21 | Height = 100,
22 | Direction = FillDirection.Vertical,
23 | Spacing = new Vector2(0, 10),
24 | Children = new Drawable[]
25 | {
26 | new ThemableSpriteIcon
27 | {
28 | Size = new Vector2(24),
29 | Icon = VignetteFont.Logo,
30 | Anchor = Anchor.Centre,
31 | Origin = Anchor.Centre,
32 | Colour = ThemeSlot.Gray60,
33 | },
34 | new ThemableTextFlowContainer(s => s.Colour = ThemeSlot.Gray60)
35 | {
36 | Text = "Copyright 2020 - 2021\nVignette Project",
37 | Anchor = Anchor.Centre,
38 | Origin = Anchor.Centre,
39 | RelativeSizeAxes = Axes.X,
40 | AutoSizeAxes = Axes.Y,
41 | TextAnchor = Anchor.Centre,
42 | },
43 | },
44 | };
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Sections/KeyboardSection.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using System.IO;
5 | using osu.Framework.Allocation;
6 | using osu.Framework.Graphics;
7 | using osu.Framework.Graphics.Sprites;
8 | using osu.Framework.Localisation;
9 | using Vignette.Game.Graphics.Typesets;
10 | using Vignette.Game.Input;
11 | using Vignette.Game.Settings.Components;
12 |
13 | namespace Vignette.Game.Settings.Sections
14 | {
15 | public class KeyboardSection : SettingsSection
16 | {
17 | public override LocalisableString Label => "Keyboard";
18 |
19 | public override IconUsage Icon => SegoeFluent.Keyboard;
20 |
21 | [BackgroundDependencyLoader]
22 | private void load(VignetteKeyBindManager keybindManager)
23 | {
24 | Children = new Drawable[]
25 | {
26 | new SettingsSubSection
27 | {
28 | Children = new Drawable[]
29 | {
30 | new SettingsSwitch
31 | {
32 | Label = "Allow keyboard to open settings"
33 | },
34 | new OpenSubPanelButton
35 | {
36 | Label = "Configure Keybindings",
37 | },
38 | new OpenExternalLinkButton(new FileInfo(keybindManager.FilePath))
39 | {
40 | Label = "Open keybind config",
41 | },
42 | }
43 | },
44 | };
45 | }
46 |
47 | private class KeybindConfigurationPanel : SettingsSubPanel
48 | {
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Containers/FluentScrollContainer.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osuTK;
7 | using Vignette.Game.Graphics.Shapes;
8 | using Vignette.Game.Graphics.Themeing;
9 |
10 | namespace Vignette.Game.Graphics.Containers
11 | {
12 | public class FluentScrollContainer : FluentScrollContainer
13 | {
14 | public FluentScrollContainer(Direction scrollDirection = Direction.Vertical)
15 | : base(scrollDirection)
16 | {
17 | }
18 | }
19 |
20 | public class FluentScrollContainer : ScrollContainer
21 | where T : Drawable
22 | {
23 | public FluentScrollContainer(Direction scrollDirection = Direction.Vertical)
24 | : base(scrollDirection)
25 | {
26 | }
27 |
28 | protected override ScrollbarContainer CreateScrollbar(Direction direction)
29 | => new FluentScrollbar(direction);
30 |
31 | protected class FluentScrollbar : ScrollbarContainer
32 | {
33 | public FluentScrollbar(Direction direction)
34 | : base(direction)
35 | {
36 | Child = new ThemableContainer
37 | {
38 | RelativeSizeAxes = Axes.Both,
39 | CornerRadius = 2.5f,
40 | Colour = ThemeSlot.Gray160,
41 | };
42 | }
43 |
44 | public override void ResizeTo(float val, int duration = 0, Easing easing = Easing.None)
45 | {
46 | var size = new Vector2(4) { [(int)ScrollDirection] = val };
47 | this.ResizeTo(size, duration, easing);
48 | }
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/UserInterface/TestSceneTextBox.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 | using Vignette.Game.Graphics.UserInterface;
6 |
7 | namespace Vignette.Game.Tests.Visual.UserInterface
8 | {
9 | public class TestSceneTextBox : UserInterfaceTestScene
10 | {
11 | public TestSceneTextBox()
12 | {
13 | Add(new FluentTextBox
14 | {
15 | Width = 200,
16 | PlaceholderText = "Simple",
17 | });
18 |
19 | Add(new TestLetterOnlyTextBox
20 | {
21 | Width = 200,
22 | PlaceholderText = "Letters Only",
23 | });
24 |
25 | Add(new FluentTextBox
26 | {
27 | Width = 200,
28 | ReadOnly = true,
29 | Text = @"Read Only",
30 | });
31 |
32 | Add(new FluentTextBox
33 | {
34 | Width = 200,
35 | PlaceholderText = "Disabled",
36 | Current = new Bindable
37 | {
38 | Disabled = true,
39 | },
40 | });
41 |
42 | Add(new FluentSearchBox
43 | {
44 | Width = 200,
45 | });
46 | }
47 |
48 | private class TestLetterOnlyTextBox : FluentTextBox
49 | {
50 | protected override TextInputContainer CreateTextBox()
51 | => new LetterOnlyInputBox();
52 |
53 | private class LetterOnlyInputBox : TextInputContainer
54 | {
55 | protected override bool CanAddCharacter(char character) => char.IsLetter(character);
56 | }
57 | }
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/Vignette.Game/Graphics/Sprites/CheapThemableSpriteText.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Allocation;
5 | using osu.Framework.Graphics.Sprites;
6 | using Vignette.Game.Graphics.Typesets;
7 | using Vignette.Game.Graphics.Themeing;
8 |
9 | namespace Vignette.Game.Graphics.Sprites
10 | {
11 | ///
12 | /// An alternative to which directly inherits from .
13 | /// It does not contain a full implementation of a usual and is only used
14 | /// in cases where an actual is needed as a parameter or return type.
15 | ///
16 | public class CheapThemableSpriteText : SpriteText, IThemable
17 | {
18 | public SpriteText Target => this;
19 |
20 | public new ThemeSlot Colour
21 | {
22 | get => colour;
23 | set
24 | {
25 | if (colour == value)
26 | return;
27 |
28 | colour = value;
29 | scheduleThemeChange();
30 | }
31 | }
32 |
33 | private IThemeSource source;
34 | private ThemeSlot colour = ThemeSlot.Gray190;
35 |
36 | public CheapThemableSpriteText()
37 | {
38 | Font = SegoeUI.Regular;
39 | }
40 |
41 | [BackgroundDependencyLoader]
42 | private void load(IThemeSource source)
43 | {
44 | this.source = source;
45 | this.source.ThemeChanged += scheduleThemeChange;
46 | scheduleThemeChange();
47 | }
48 |
49 | private void scheduleThemeChange()
50 | => Scheduler.AddOnce(() => base.Colour = source.Current.Value.Get(Colour));
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/Vignette.Live2D/IO/Serialization/Converters/JsonVector2Converter.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using Newtonsoft.Json;
7 | using osuTK;
8 | using System;
9 |
10 | namespace Vignette.Live2D.IO.Serialization.Converters
11 | {
12 | internal class JsonVector2Converter : JsonConverter
13 | {
14 | public override Vector2 ReadJson(JsonReader reader, Type objectType, Vector2 existingValue, bool hasExistingValue, JsonSerializer serializer)
15 | {
16 | var vector = new Vector2();
17 |
18 | while (reader.Read())
19 | {
20 | if (reader.TokenType == JsonToken.EndObject)
21 | break;
22 |
23 | if (reader.TokenType == JsonToken.PropertyName)
24 | {
25 | var name = reader.Value?.ToString();
26 | int? val = reader.ReadAsInt32();
27 |
28 | if (val == null)
29 | continue;
30 |
31 | switch (name)
32 | {
33 | case "X":
34 | vector.X = val.Value;
35 | break;
36 |
37 | case "Y":
38 | vector.Y = val.Value;
39 | break;
40 | }
41 | }
42 | }
43 |
44 | return vector;
45 | }
46 |
47 | public override void WriteJson(JsonWriter writer, Vector2 value, JsonSerializer serializer)
48 | => serializer.Serialize(writer, new { value.X, value.Y });
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/Vignette.Game/Settings/Components/SettingsColourPicker.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Bindables;
5 | using osu.Framework.Extensions;
6 | using osu.Framework.Graphics;
7 | using osu.Framework.Graphics.Cursor;
8 | using osu.Framework.Graphics.Shapes;
9 | using osu.Framework.Graphics.UserInterface;
10 | using osuTK;
11 | using Vignette.Game.Graphics.UserInterface;
12 |
13 | namespace Vignette.Game.Settings.Components
14 | {
15 | public class SettingsColourPicker : SettingsControl
16 | {
17 | protected override ColourPickerButton CreateControl() => new ColourPickerButton();
18 | }
19 |
20 | public class ColourPickerButton : Button, IHasPopover, IHasCurrentValue
21 | {
22 | public Bindable Current
23 | {
24 | get => current.Current;
25 | set => current.Current = value;
26 | }
27 |
28 | private readonly Box previewBox;
29 | private readonly BindableWithCurrent current = new BindableWithCurrent(Colour4.White);
30 |
31 | public ColourPickerButton()
32 | {
33 | Size = new Vector2(28);
34 | Masking = true;
35 | CornerRadius = 5;
36 | Child = previewBox = new Box
37 | {
38 | RelativeSizeAxes = Axes.Both,
39 | };
40 |
41 | Action = () => this.ShowPopover();
42 | Current.BindValueChanged(e => previewBox.Colour = e.NewValue, true);
43 | }
44 |
45 | public Popover GetPopover() => new FluentPopover
46 | {
47 | Child = new FluentColourPicker
48 | {
49 | Scale = new Vector2(0.6f),
50 | Current = { BindTarget = Current },
51 | },
52 | };
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Vignette.Game.Tests/Visual/Screens/ScreenTestScene.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under NPOSLv3. See LICENSE for details.
3 |
4 | using osu.Framework.Graphics;
5 | using osu.Framework.Graphics.Containers;
6 | using osu.Framework.Screens;
7 | using osu.Framework.Testing;
8 | using Vignette.Game.Graphics.Containers;
9 |
10 | namespace Vignette.Game.Tests.Visual.Screens
11 | {
12 | public abstract class ScreenTestScene : VignetteManualInputManagerTestScene
13 | {
14 | protected readonly ScreenStack Stack;
15 |
16 | private readonly Container content;
17 |
18 | protected override Container Content => content;
19 |
20 | public ScreenTestScene()
21 | {
22 | base.Content.AddRange(new Drawable[]
23 | {
24 | new FluentContextMenuContainer
25 | {
26 | RelativeSizeAxes = Axes.Both,
27 | Child = new FluentTooltipContainer
28 | {
29 | RelativeSizeAxes = Axes.Both,
30 | Child = Stack = new ScreenStack { RelativeSizeAxes = Axes.Both },
31 | },
32 | },
33 | content = new Container { RelativeSizeAxes = Axes.Both },
34 | });
35 | }
36 |
37 | protected void LoadScreen(Screen screen) => Stack.Push(screen);
38 |
39 | [SetUpSteps]
40 | public virtual void SetupSteps() => addExitAllScreensStep();
41 |
42 | [TearDownSteps]
43 | public virtual void TeardownSteps() => addExitAllScreensStep();
44 |
45 | private void addExitAllScreensStep() => AddUntilStep("exit all screens", () =>
46 | {
47 | if (Stack.CurrentScreen == null)
48 | return true;
49 |
50 | Stack.Exit();
51 | return false;
52 | });
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Vignette.Live2D.Tests/Visual/Rendering/TestSceneColours.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 | // This software implements Live2D. Copyright (c) Live2D Inc. All Rights Reserved.
4 | // License for Live2D can be found here: http://live2d.com/eula/live2d-open-software-license-agreement_en.html
5 |
6 | using osu.Framework.Bindables;
7 | using osu.Framework.Graphics;
8 | using osu.Framework.Graphics.UserInterface;
9 |
10 | namespace Vignette.Live2D.Tests.Visual.Rendering
11 | {
12 | public class TestSceneColours : CubismModelTestScene
13 | {
14 | private Bindable colour = new Bindable(Colour4.White);
15 | private BindableFloat alpha = new BindableFloat
16 | {
17 | MinValue = 0.0f,
18 | MaxValue = 1.0f,
19 | Default = 1.0f,
20 | Value = 1.0f,
21 | };
22 |
23 | public TestSceneColours()
24 | {
25 | Extras.AddRange(new Drawable[]
26 | {
27 | new BasicSliderBar
28 | {
29 | Width = 300,
30 | Height = 40,
31 | Current = alpha,
32 | },
33 | new BasicColourPicker
34 | {
35 | Margin = new MarginPadding { Top = 40 },
36 | Anchor = Anchor.BottomLeft,
37 | Origin = Anchor.BottomLeft,
38 | Current = colour,
39 | }
40 | });
41 | }
42 |
43 | protected override void ModelChanged()
44 | {
45 | base.ModelChanged();
46 |
47 | colour.UnbindEvents();
48 | colour.BindValueChanged(c => Model.Colour = c.NewValue, true);
49 |
50 | alpha.UnbindEvents();
51 | alpha.BindValueChanged(a => Model.Alpha = a.NewValue, true);
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/Vignette.Camera.Tests/Visual/TestSceneSharedCamera.cs:
--------------------------------------------------------------------------------
1 | // Copyright 2020 - 2021 Vignette Project
2 | // Licensed under MIT. See LICENSE for details.
3 |
4 | using NUnit.Framework;
5 | using osu.Framework.Graphics;
6 | using osu.Framework.Testing;
7 | using osuTK;
8 | using Vignette.Camera.Graphics;
9 |
10 | namespace Vignette.Camera.Tests.Visual
11 | {
12 | public class TestSceneSharedCamera : TestScene
13 | {
14 | private CameraVirtual camera;
15 |
16 | private DrawableCameraVirtual left, right;
17 |
18 | public TestSceneSharedCamera()
19 | {
20 | camera = new TestCameraVirtual();
21 | }
22 |
23 | [SetUpSteps]
24 | public void SetUp()
25 | {
26 | Add(left = new DrawableCameraVirtual(camera, false)
27 | {
28 | X = -0.25f,
29 | RelativePositionAxes = Axes.X,
30 | Anchor = Anchor.Centre,
31 | Origin = Anchor.Centre,
32 | Size = new Vector2(256),
33 | });
34 |
35 | Add(right = new DrawableCameraVirtual(camera, false)
36 | {
37 | X = 0.25f,
38 | RelativePositionAxes = Axes.X,
39 | Anchor = Anchor.Centre,
40 | Origin = Anchor.Centre,
41 | Size = new Vector2(256),
42 | });
43 | }
44 |
45 | [Test]
46 | public void TestSynchronosity()
47 | {
48 | AddStep("play", () => camera.Start());
49 | AddAssert("check state", () => left.Started == right.Started);
50 |
51 | AddStep("pause", () => camera.Pause());
52 | AddAssert("check state", () => left.Paused == right.Paused);
53 |
54 | AddStep("seek", () => camera.Seek(100));
55 | AddAssert("check position", () => ((ICameraVirtual)left).Position == ((ICameraVirtual)right).Position);
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------