Skip to content

Commit

Permalink
Make fx converter live update, remove PPLAF, change lua online website
Browse files Browse the repository at this point in the history
  • Loading branch information
Tasty-Kiwi committed Mar 28, 2024
1 parent 4c7ef5a commit d9d9f94
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion docs/Guides/Lua/beginner.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_position: 1

# Beginner Lua Tutorial

[https://repl.it/languages/lua](https://repl.it/languages/lua) can be used to try Lua in the browser.
[https://onecompiler.com/lua](https://onecompiler.com/lua) can be used to try Lua in the browser.

These examples are more for review, rather than learning! If you see something here that you don't understand, continue to watch Lua tutorials on youtube!

Expand Down
2 changes: 0 additions & 2 deletions docs/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,10 @@ indentation to be consistent with the rest of PewPew's codebase.

- [PewPew Snippets] is an essential Visual Studio Code extension that offers autocompletion and useful code snippets for creating levels.
- [PewPewLive-MeshExporter] is a Blender plugin for converting scenes into PewPew Live 3D meshes.
- [PPLAF] is an opinionated Lua framework for creating advanced levels.

[Discord]: https://pewpew.live/discord
[simple_level]: https://github.com/jyaif/ppl-utils/blob/d32dbec8a171c9bcc0f800dcd864f175c42c34fd/content/levels/simple_level/
[LuaRocks's style guide]: https://github.com/luarocks/lua-style-guide
[https://pewpew.live]: https://pewpew.live
[PewPewLive-MeshExporter]: https://github.com/ModEngineer/PewPewLive-MeshExporter
[PewPew Snippets]: https://hybroid.pewpew.live/pps/
[PPLAF]: https://github.com/glebi574/PPLAF/
16 changes: 8 additions & 8 deletions src/components/fx-converter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { useRef, useState } from "react"

function floatToFixedpoint(input: string): string {
let float = parseFloat(input)
if (isNaN(float)) return "Error!"

let abs_float = Math.abs(float)
let int = Math.floor(abs_float)
if (int > 2 << 51) {
Expand All @@ -18,21 +20,19 @@ function floatToFixedpoint(input: string): string {
}

export default function FxConverter() {
const [num, setNum] = useState<string>("2.718")

const outputRef = useRef(null)

return (
<div>
<input type="text" defaultValue="2.718" onInput={(event) => setNum(event.target.value)} />
<input
type="button"
defaultValue="to FixedPoint →"
onClick={() => {
outputRef.current.value = floatToFixedpoint(num)
type="text"
defaultValue="2.718"
onInput={(event) => {
outputRef.current.innerText = floatToFixedpoint(event.target.value)
}}
/>
<input type="text" readonly ref={outputRef} />
<br />
<code ref={outputRef}>2.2940fx</code>
</div>
)
}

0 comments on commit d9d9f94

Please sign in to comment.