inital commit
This commit is contained in:
5
Fes.toml
Normal file
5
Fes.toml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[app]
|
||||||
|
|
||||||
|
name = "fes-in-fes"
|
||||||
|
version = "0.0.1"
|
||||||
|
authors = ["vx-clutch"]
|
||||||
33
README.md
Normal file
33
README.md
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
# fes-in-fes
|
||||||
|
|
||||||
|
```
|
||||||
|
fes new fes-in-fes
|
||||||
|
```
|
||||||
|
|
||||||
|
> **Know what you are doing?** Delete this file. Have fun!
|
||||||
|
|
||||||
|
## Project Structure
|
||||||
|
|
||||||
|
Inside your Fes project, you'll see the following directories and files:
|
||||||
|
|
||||||
|
```
|
||||||
|
.
|
||||||
|
├── Fes.toml
|
||||||
|
├── README.md
|
||||||
|
└── www
|
||||||
|
└── index.lua
|
||||||
|
```
|
||||||
|
|
||||||
|
Fes looks for `.lua` files in the `www/` directory. Each file is exposed as a route based on its file name.
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
All commands are run from the root of the project, from a terminal:
|
||||||
|
|
||||||
|
| Command | Action |
|
||||||
|
| :------------------------ | :----------------------------------------------- |
|
||||||
|
| `fes run .` | Runs the project at `.` |
|
||||||
|
|
||||||
|
## What to learn more?
|
||||||
|
|
||||||
|
Check out [Fes's docs](https://docs.vxserver.dev/static/fes.html).
|
||||||
34
include/style.lua
Normal file
34
include/style.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
local M = {}
|
||||||
|
|
||||||
|
M.get = function ()
|
||||||
|
return [[
|
||||||
|
<style>
|
||||||
|
.screen {
|
||||||
|
width: 640px;
|
||||||
|
height: 600px;
|
||||||
|
background-image: "/static/bg.jpg";
|
||||||
|
margin: 0;
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
-ms-transform: translate(-50%, -50%);
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.ui {
|
||||||
|
width: 200px;
|
||||||
|
height: 300px;
|
||||||
|
border: 3px solid red;
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
right: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
]]
|
||||||
|
end
|
||||||
|
|
||||||
|
return M
|
||||||
BIN
static/bg.jpg
Normal file
BIN
static/bg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 170 KiB |
31
www/index.lua
Normal file
31
www/index.lua
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
local fes = require("fes")
|
||||||
|
local std = fes.std
|
||||||
|
local u = fes.util
|
||||||
|
|
||||||
|
local screen = function (cnt)
|
||||||
|
return string.format([[
|
||||||
|
%s
|
||||||
|
%s
|
||||||
|
<div class="screen">
|
||||||
|
%s
|
||||||
|
</div>
|
||||||
|
]], fes.app.style.get(), std.center(std.h1("Fes in Fes")), cnt)
|
||||||
|
end
|
||||||
|
|
||||||
|
local act = function (action)
|
||||||
|
return std.a("/?action=" .. action, action)
|
||||||
|
end
|
||||||
|
|
||||||
|
local cnt = u.cc {
|
||||||
|
[[<div class="ui">]],
|
||||||
|
std.h2("Actions:"),
|
||||||
|
std.ul {
|
||||||
|
act("Punch"),
|
||||||
|
act("Kick"),
|
||||||
|
act("Block"),
|
||||||
|
act("Flee"),
|
||||||
|
},
|
||||||
|
[[</div>]],
|
||||||
|
}
|
||||||
|
|
||||||
|
return screen(cnt)
|
||||||
Reference in New Issue
Block a user