diff --git a/web/public/fullscreen-close.svg b/web/public/fullscreen-close.svg new file mode 100644 index 00000000..63ecc7e3 --- /dev/null +++ b/web/public/fullscreen-close.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/web/public/fullscreen-open.svg b/web/public/fullscreen-open.svg new file mode 100644 index 00000000..9e8d031e --- /dev/null +++ b/web/public/fullscreen-open.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/web/public/index.html b/web/public/index.html deleted file mode 100644 index a9da110f..00000000 --- a/web/public/index.html +++ /dev/null @@ -1,113 +0,0 @@ - - - - - Quadradius - - - - - - - - -
- How to play & Powerup Cheatsheet. -
-
- - - - - -
- - - - - diff --git a/web/src/app/(main)/index.module.css b/web/src/app/(main)/index.module.css new file mode 100644 index 00000000..466bd458 --- /dev/null +++ b/web/src/app/(main)/index.module.css @@ -0,0 +1,28 @@ +.container { + width: 100%; + height: 100vh; + display: flex; + flex-direction: column; + flex-wrap: wrap; + justify-content: space-between; + align-items: stretch; + align-content: stretch; + position: relative; +} + +.game { + flex: 1; +} + +.embed { + width: 100%; + height: 100%; +} + +.directions { + position: absolute; + right: 8px; + z-index: 1; + top: 8px; + font-size: clamp(0.8rem, 1vw, 1rem); +} diff --git a/web/src/app/(main)/layout.tsx b/web/src/app/(main)/layout.tsx index 8aa91099..1fb368c0 100644 --- a/web/src/app/(main)/layout.tsx +++ b/web/src/app/(main)/layout.tsx @@ -1,3 +1,15 @@ +import '@/styles/globals.css' + +export const metadata = { + title: 'Quadradius', + description: 'Quadradius is a two-player turn-based strategy game from 2007 made in Flash. A game of skill, luck, and deception, with the gameplay of checkerboards on steroids. Originally created by Jimmi Heiserman and Brad Kayal.', +}; + +export const viewport = { + width: 'device-width', + initialScale: 1, +}; + export default function MainLayout({ children, }: { diff --git a/web/src/app/(main)/page.tsx b/web/src/app/(main)/page.tsx index d09daed8..20358d04 100644 --- a/web/src/app/(main)/page.tsx +++ b/web/src/app/(main)/page.tsx @@ -1,5 +1,30 @@ +'use client'; + +import styles from './index.module.css'; +import Ruffle from '@/components/ruffle/ruffle'; +import FullscreenToggle from '@/components/ui/fullscreen-toggle/fullscreen-toggle'; +import Footer from "@/components/ui/footer/footer"; +import { useUnloadWarning } from '@/hooks/use-unload-warning'; + + export default function Home() { + useUnloadWarning(); + return ( -

Quadradius Web App

+ <> +
+ How to play & Powerup Cheatsheet +
+ + + + +
+ + + +
+
+ ) } diff --git a/web/src/components/ruffle/ruffle-config.tsx b/web/src/components/ruffle/ruffle-config.tsx new file mode 100644 index 00000000..d37baafd --- /dev/null +++ b/web/src/components/ruffle/ruffle-config.tsx @@ -0,0 +1,31 @@ +'use client'; + +import { useEffect } from 'react'; + +export default function RuffleConfig() { + useEffect(() => { + const host = window.location.host; + const protocol = window.location.protocol == 'http:' ? 'ws:' : 'wss:'; + + window.RufflePlayer = window.RufflePlayer || {}; + window.RufflePlayer.config = { + autoplay: "on", + contextMenu: "off", + logLevel: "debug", + socketProxy: [ + { + host: "127.0.0.1", + port: 3000, + proxyUrl: `${protocol}//${host}/websocket/lobby`, + }, + { + host: "127.0.0.1", + port: 3001, + proxyUrl: `${protocol}//${host}/websocket/game`, + }, + ], + }; + }, []); + + return null; +} diff --git a/web/src/components/ruffle/ruffle-loader.tsx b/web/src/components/ruffle/ruffle-loader.tsx new file mode 100644 index 00000000..2083efdf --- /dev/null +++ b/web/src/components/ruffle/ruffle-loader.tsx @@ -0,0 +1,27 @@ +'use client'; + +import Script from 'next/script'; +import { useSearchParams } from 'next/navigation'; +import config from '@/configurations/config.json'; + +export default function RuffleLoader() { + const searchParams = useSearchParams(); + + const queryVersion = searchParams.get('ruffle_version'); + + const version = + queryVersion ?? + config.ruffleVersion ?? + ''; + + const ruffleUrl = version + ? `https://unpkg.com/@ruffle-rs/ruffle@${version}/ruffle.js` + : 'https://unpkg.com/@ruffle-rs/ruffle'; + + return ( +