https://github.com/benpollarduk/netaf.wpf
An extension library for NetAF targeting WPF and providing controls to allow NetAF to be easily integrated into WPF applications.
https://github.com/benpollarduk/netaf.wpf
csharp framework interactive-fiction netaf text-adventure wpf
Last synced: 3 days ago
JSON representation
An extension library for NetAF targeting WPF and providing controls to allow NetAF to be easily integrated into WPF applications.
- Host: GitHub
- URL: https://github.com/benpollarduk/netaf.wpf
- Owner: benpollarduk
- License: mit
- Created: 2025-01-10T16:02:46.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-03-13T23:35:37.000Z (21 days ago)
- Last Synced: 2026-03-14T02:06:52.851Z (21 days ago)
- Topics: csharp, framework, interactive-fiction, netaf, text-adventure, wpf
- Language: C#
- Homepage:
- Size: 187 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NetAF.WPF
An extension library for NetAF targeting WPF and providing controls to allow NetAF to be easily integrated into WPF applications.

[](https://github.com/benpollarduk/NetAF.WPF/actions/workflows/main-ci.yml)
[](https://github.com/benpollarduk/NetAF.WPF/releases)
[](https://www.nuget.org/packages/netaf.wpf/)
[](https://www.nuget.org/packages/netaf.wpf/)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.WPF)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.WPF)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.WPF)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.WPF)
[](https://sonarcloud.io/summary/new_code?id=benpollarduk_NetAF.WPF)
[](https://opensource.org/licenses/MIT)
## Getting Started
### Running the Example
Getting started running [NetAF](https://github.com/benpollarduk/NetAF/) in WPF is easy!
* Clone the repo.
* Build and run NetAF.WPF.TestApp.

## How it Works
You need a couple of components to run a NetAF game:
* Input - a way to interact with the game.
* Output - a way to view the game.
### Input
NetAF.WPF provides some easy ways to interact with the game:
#### Prompt
The prompt allows direct text entry. Add the prompt to a window or control:
```
```
This will send input directly to the active game, in a window it looks like this:
```
```
#### Command Buttons
Command buttons make it easier to interact with a game. There are a few main types:
* **NetAFCommandPicker** - functions as a general command picker for all commands.
* **NetAFMovementCommandPicker** - functions as a general command picker for movement commands.
* **NetAFRegionMapCommandPicker** - functions as a general command picker for navigating the region map.
These can be used individually or as a combination. The **ButtonLayout** control provides a preconfigured control that combines all of the above controls.
```
```
Adding that to the window:
```
```
### Output
NetAF provides a options for viewing the game:
#### Text Terminal
A basic terminal that just displays text without any styling.

```
```
Adding that to the window:
```
```
#### Markup Terminal
The markup terminal is highly recommended as it provides customisable styling to frames.

```
```
Adding that to the window:
```
```
#### Directing Game Output to the Terminal
The game output needs to be pointed to the terminal. This is done with adapters. In the case of a NetAFTextTerminal the terminal is passed directly to the adapter on configuration:
```csharp
using NetAF.Logic;
using NetAF.Rendering.FrameBuilders;
using NetAF.Targets.Text;
using System.Windows;
namespace NetAF.WPF.TestApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var configuration = new GameConfiguration(new TextAdapter(Terminal), FrameBuilderCollections.Text, Assets.Size.Dynamic);
GameExecutor.Execute(ExampleGame.Create(configuration));
}
}
}
```
And in the case that markup is used:
```csharp
using NetAF.Logic;
using NetAF.Rendering.FrameBuilders;
using NetAF.Targets.Markup;
using System.Windows;
namespace NetAF.WPF.TestApp
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
var configuration = new GameConfiguration(new MarkupAdapter(Terminal), FrameBuilderCollections.Markup, Assets.Size.Dynamic);
GameExecutor.Execute(ExampleGame.Create(configuration));
}
}
}
```
With that you should be ready to go!
## Persistence
The **NetAFFileManager** control adds easy persistence options to a game:
```
```

No configuration is required.
## Styling
The controls can all be styled. By default a dark style is included - Targets/WPF/Styles/Dark.xaml.
To use this style merge it with the resource dictionary of your window or control:
```
```
And then apply the styles to the various controls:
```
```
## Example Game
The [ExampleGame](NetAF.WPF.TestApp/Example.cs) is included in the repo.
## Documentation
Please visit [https://benpollarduk.github.io/NetAF-docs/](https://benpollarduk.github.io/NetAF-docs/) to view the NetAF documentation.
## For Open Questions
Visit https://github.com/benpollarduk/NetAF.WPF/issues