added wasm example to itch

This commit is contained in:
Booklordofthedings 2024-06-30 21:31:22 +02:00
parent 808dc98488
commit 6969a03bb8
6 changed files with 69 additions and 26 deletions

View file

@ -1,26 +0,0 @@
FileVersion = 1
Projects = {TheaterGui = {Path = "."}, raylib-beef = {Path = "../../External/raylib-beef/raylib-beef"}, ExampleGui = {Path = "../../../Projects/ExampleGui"}}
[Workspace]
StartupProject = "ExampleGui"
[Configs.Debug.Win64]
ConfigSelections = {raylib-beef = {Config = "StaticDebug"}}
[Configs.Debug.wasm32]
AllocType = "CRT"
EnableObjectDebugFlags = false
EmitObjectAccessCheck = false
[Configs.Release.Win64]
ConfigSelections = {raylib-beef = {Config = "StaticRelease"}}
[Configs.Paranoid.wasm32]
AllocType = "CRT"
EnableObjectDebugFlags = false
EmitObjectAccessCheck = false
[Configs.Test.wasm32]
AllocType = "CRT"
EnableObjectDebugFlags = false
EmitObjectAccessCheck = false

View file

@ -4,3 +4,6 @@ Dependencies = {corlib = "*", TheaterGui = "*"}
[Project] [Project]
Name = "examples" Name = "examples"
StartupObject = "examples.Program" StartupObject = "examples.Program"
[Configs.Release.wasm32]
OtherLinkFlags = "$(LinkFlags) --shell-file $(ProjectDir)/index.html"

View file

@ -3,3 +3,18 @@ Projects = {examples = {Path = "."}, TheaterGui = {Path = ".."}}
[Workspace] [Workspace]
StartupProject = "examples" StartupProject = "examples"
[Configs.Debug.wasm32]
AllocType = "CRT"
EnableObjectDebugFlags = false
EmitObjectAccessCheck = false
[Configs.Paranoid.wasm32]
AllocType = "CRT"
EnableObjectDebugFlags = false
EmitObjectAccessCheck = false
[Configs.Test.wasm32]
AllocType = "CRT"
EnableObjectDebugFlags = false
EmitObjectAccessCheck = false

45
examples/index.html Normal file
View file

@ -0,0 +1,45 @@
<!doctype html>
<title>Game</title>
<meta name=viewport content="width=device-width, maximum-scale=1.0, user-scalable=no, viewport-fit=cover, interactive-widget=resizes-content">
<style>
:root, body {
margin: 0;
padding: 0;
height: 100%;
overflow: hidden;
contain: strict;
}
canvas {
width: 100%;
height: 100%;
border: 0;
background: black;
}
</style>
<canvas id=canvas></canvas>
<script>
let canvas = window.canvas
function updateCanvasSize() {
const box = canvas.getBoundingClientRect()
canvas.width = box.width * devicePixelRatio
canvas.height = box.height * devicePixelRatio
}
updateCanvasSize()
addEventListener('resize', updateCanvasSize)
Module = {
canvas,
arguments: location.hash.slice(1).split(' '),
}
onerror = (...args) => {
alert(JSON.stringify(args))
}
</script>
{{{ SCRIPT }}}

View file

@ -20,14 +20,18 @@ class ExampleToolbar : Toolbar
public void PrintVersion() public void PrintVersion()
{ {
#if !BF_PLATFORM_WASM
System.Console.WriteLine("1.0"); System.Console.WriteLine("1.0");
#endif
} }
public void PrintAbout() public void PrintAbout()
{ {
#if !BF_PLATFORM_WASM
System.Console.WriteLine(""" System.Console.WriteLine("""
TheaterGui by Booklordofthedings TheaterGui by Booklordofthedings
A simple easy to use gui library for tools A simple easy to use gui library for tools
"""); """);
#endif
} }
} }

View file

@ -18,6 +18,8 @@ class HorSlider : HSlider
public override void OnValueChange(float newVal) public override void OnValueChange(float newVal)
{ {
#if !BF_PLATFORM_WASM
System.Console.WriteLine(Value); System.Console.WriteLine(Value);
#endif
} }
} }