diff --git a/app.go b/app.go index 8ee29a3..0d0e6f3 100644 --- a/app.go +++ b/app.go @@ -4,7 +4,8 @@ import ( "context" "fmt" - "conjure-os/lib" + "conjure-os/lib/inputs" + "conjure-os/lib/provider" "github.com/wailsapp/wails/v2/pkg/runtime" ) @@ -14,13 +15,6 @@ type App struct { ctx context.Context } -type Game struct { - Title string - Developper string - Year int - Cartridge string -} - // NewApp creates a new App application struct func NewApp() *App { return &App{} @@ -30,7 +24,8 @@ func NewApp() *App { // so we can call the runtime methods func (a *App) startup(ctx context.Context) { a.ctx = ctx - lib.Start() + inputs.Start() + provider.Update() } // Greet returns a greeting for the given name @@ -42,7 +37,6 @@ func (a *App) Greet(name string) string { func (a *App) SelectGame(id string) { } -func (a *App) LoadGames() []Game { - - return []Game{Game{"Soul Shaper", "Conjure", 2024, "https://img.itch.zone/aW1hZ2UvMTkwMzc5MS8xMTgzNzY0Ny5wbmc=/794x1000/Tj3YaD.png"}, Game{"Overdue", "Conjure", 2023, "https://img.itch.zone/aW1hZ2UvMTM2MTI1OS84NjE0MDY4LnBuZw==/794x1000/Y%2B8kqa.png"}} +func (a *App) LoadGames() []provider.Game { + return provider.ObtainConjureGameInfo() } diff --git a/frontend/README.md b/frontend/README.md index a346289..727ce49 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -1,5 +1,11 @@ + + # Svelte + Vite + +## HOW TO RUN +`wails dev` + This template should help get you started developing with Svelte in Vite. ## Recommended IDE Setup diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index e379306..47fa8e4 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -3,8 +3,6 @@ import { onMount } from 'svelte'; import {LoadGames, SelectGame} from '../wailsjs/go/main/App.js' - let resultText = "Please enter your name below 👇" - let name let games = [] let activeIndex = 0; let currentDeg = 0; @@ -27,7 +25,6 @@ function parse(node) { - var degree = 360/games.length; let i = 0; games.forEach(game => { if(document.getElementById(game.Title) != null) { @@ -35,7 +32,6 @@ document.getElementById(game.Title).style.transform = "rotateY("+40*i+"deg) translateZ(412px)"; } i ++; - }); } @@ -54,13 +50,17 @@ } function switchGame(direction) { + if(activeIndex-direction < 0 || activeIndex-direction >= games.length) + return; + activeIndex -= direction; if(activeIndex > games.length){ - activeIndex = 0; + activeIndex += direction; + return; } - currentDeg = direction *40 * activeIndex; let carrousel = document.getElementById("carousel"); + currentDeg = 40 * activeIndex * -1; carrousel.style.transform = `rotateY(${currentDeg}deg) `;/*carouselnext 40s steps(1000, end) 1";*/ @@ -142,7 +142,9 @@
+ {selectedGame.Description} +