Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Avalonia-powered TextBox with CRT shader applied.

License

NotificationsYou must be signed in to change notification settings

deanthecoder/CrtTextBox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Twitter Follow

CrtTextBox

CrtTextBox is an Avalonia C# project that enhances a standard TextBox control with a custom SKSL shader, giving it the appearance of a retro CRT screen. This effect adds a nostalgic touch to your UI with features like fish-eye distortion, scan lines, vignette, screen jitter, background noise, and a scrolling electron bar.

It makes use of a customShaderControl control, allowing any SKSL shader code to be applied to a source Avalonia UI control.TheCrtTextBox example demonstrate how to use it with aTextBox, but any other source control can be used.

Features

  • Retro CRT Look: The shader applies various effects to create a convincing retro CRT display, including:

    • Fish-eye distortion
    • Scan lines
    • Vignette effect
    • Screen jitter
    • Background noise
    • Scrolling electron bar
    • Monitor 'surround' with screen reflection
  • Cross-Platform Compatibility: Built withAvalonia, ensuring compatibility across Windows, MacOS, and Linux.

  • Customizable: The shader can be easily integrated into any Avalonia application and modified to suit different visual styles.

Getting Started

Prerequisites

Building From Source

  1. Clone the repository from GitHub.
  2. Open the solution in your IDE.
  3. Build and run the project.

Using the Text Editor

The main view is taken up with the shader code itself. Feel free to modify it and pressF5 to apply changes. Right-click outside of the text area to switch Themes.

Create Your Own Theme

Check out theThemes folder in the source tree. Modify the code to toggle features, or create your own theme from scratch.

Using theShaderControl

TheShaderControl object is a standalone class and can be copied into your own project, and applied to any control with any shader code.

  1. AddShaderControl to your AXAML.
  2. From the code-behind, set theControlSource property to the UI control you wish to apply the shader to.
  3. Set theFPS property, which determines the frequency the source control is sampled.
  4. SetShaderUri to point to the location of your SKSL shader code. Usecrt.sksl as a reference.

Customuniform values can be passed into the shader code usingShaderControl.AddUniform(name, value).

Contribution and Improvements

CrtTextBox is an open-source project, and contributions are welcome. If you have ideas for new features, improvements, or bug fixes, feel free to submit a pull request. Please note that this is a side project, so responses might not be immediate.

Credits

The project is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Useful Resources


Follow me on Twitter for more updates:@deanthecoder.

About

Avalonia-powered TextBox with CRT shader applied.

Topics

Resources

License

Stars

Watchers

Forks

Languages


[8]ページ先頭

©2009-2025 Movatter.jp