hahahahahahah

This commit is contained in:
club 2025-07-12 23:44:45 -04:00 committed by TristanBrault
parent 889a00fc49
commit af42d6c61c
17 changed files with 84 additions and 47 deletions

6
app.go
View File

@ -62,8 +62,12 @@ func (a *App) onControllerChange(state inputs.ControllerState) {
}
func (a *App) StartGame(id string) {
found := false
fmt.Println(id)
for _, game := range games {
fmt.Println(game.Id)
if game.Id == id {
found = true
gamePath := provider.ExtractGame(game)
cmd := exec.Command(gamePath)
gameIsOpen = true
@ -90,6 +94,8 @@ func (a *App) StartGame(id string) {
gameIsOpen = false
}
}
fmt.Printf("Found %b", found)
fmt.Println()
}
func (a *App) LoadGames() []models.Metadata {

View File

@ -1 +1 @@
0439ac4c00128949ad585ea9e2f68e8e
0d0407303e68412fce4ec212f727db35

View File

@ -16,13 +16,19 @@
:game="selectedGame"
@qr="store.showQr"
/>
<GameCarousel
:games="store.filteredGames"
:selectedGame="selectedGame"
:selectedTag="selectedTag"
:direction="transitionDirection"
@selectGame="store.selectGame"
/>
<div class="flex flex-col">
<GameCarousel
:games="store.filteredGames"
:selectedGame="selectedGame"
:selectedTag="selectedTag"
:direction="transitionDirection"
@selectGame="store.selectGame"
class="mb-2"
/>
<div class="bg-black min-h-10 border-1 border-gray-500">
</div>
</div>
</div>
</div>
@ -60,9 +66,7 @@ const {
} = storeToRefs(store);
onMounted(async () => {
games.value = await fetchGames();
tags.value = [...new Set(games.value.flatMap(game => game.genres.split(",")))];
store.selectTag(tags.value[0])
await store.loadGames();
});
// Create the gradient background style

View File

@ -1,7 +1,7 @@
<template>
<div class="relative h-[170px]">
<Transition :name="`carousel-${direction}`" mode="out-in">
<div :key="selectedTag" class="w-full py-4 px-6 flex overflow-x-auto space-x-4 items-end transition-inner">
<div :key="selectedTag" class="w-full py-4 px-6 flex overflow-hidden space-x-4 items-end transition-inner">
<GameCard
v-for="game in games"
:game="game"

View File

@ -2,7 +2,7 @@
<div class="p-6 h-full w-full overflow-auto flex flex-col items-center">
<div v-if="game" class="space-y-4 flex flex-col items-center w-full max-w-400">
<img v-if="game.logoPath" :src="game.logoPath" :alt="game.title" class="h-72"/>
<h1 v-else class="text-4xl font-bold">{{ game.title }}</h1>
<h1 v-else class="text-4xl font-bold py-8">{{ game.title }}</h1>
<!-- Actual carousel pls -->
<!-- <div class="flex">-->
@ -17,9 +17,11 @@
<!-- </div>-->
<div class="flex justify-between w-full space-y-1">
<ImageCarousel :gameId="game.id"
:links="game.mediaPaths"
class="basis-1/4"
<ImageCarousel
v-if="game.mediaPaths"
:gameId="game.id"
:links="game.mediaPaths"
class="basis-1/4"
/>
<!-- <LocalImage-->
<!-- v-for="(img, index) in [game.media_paths[0]]"-->
@ -45,6 +47,7 @@
<div class="space-y-2 w-full flex items-start">
<div class="flex gap-2 mt-2">
<button
v-if="game.executable"
id="btn-play"
key="play"
:style="buttonStyle"
@ -60,7 +63,7 @@
Itch: game?.itchLink
}">
<button
v-if="link"
v-if="!!link"
:key="name"
:style="buttonStyle"
class="bg-blue-600 px-6 py-2 rounded hover:bg-blue-500 rounded-full text-2xl"
@ -73,7 +76,7 @@
</div>
<div class="flex w-full items-start">
<div class="flex gap-3">
<div class="flex gap-3 flex-wrap max-w-full">
<DevCard
class="min-w-60"
v-for="dev in game.developers"

View File

@ -1,7 +1,7 @@
<template>
<div>
<LocalImage :src="imag" :alt="imag" :gameId="gameId" class="rounded-lg border border-gray-600 max-h-52 w-full object-cover" />
<LocalImage v-if="imag" :src="imag" :alt="imag" :gameId="gameId" class="rounded-lg border border-gray-600 max-h-52 w-full object-cover" />
<div class="flex justify-center">
<div class="flex gap-2 relative top-1 points bg-black items-center justify-center px-2 py-1 rounded-full opacity-75">
<div
@ -29,7 +29,10 @@ const props = defineProps<{
const index = ref(0)
const imag = computed(() => {
return props.links[index.value]
if (index.value < (props.links?.length ?? -1)) {
return props.links[index.value];
}
return "";
});
function delay(time: number) {

View File

@ -14,7 +14,7 @@ const localGames: Game[] = [
release: "2023-12-15",
modification: "2023-12-15",
executable: "game\\Soul Shaper.exe",
public_repository_link: "https://github.com/PFE033-ConjureOS/ConjureOS-SoulShaper",
publicRepositoryLink: "https://github.com/PFE033-ConjureOS/ConjureOS-SoulShaper",
genres: "action",
developers: [
new Developer({
@ -30,18 +30,18 @@ const localGames: Game[] = [
name: "Cameron Lamoureux"
}),
],
thumbnail_path: "https://img.itch.zone/aW1hZ2UvMTkwMzc5MS8xMTgzNzY0Ny5wbmc=/original/r7iVIj.png",
itch_link: "https://craftelia.itch.io/gamelab2023-blood-god",
media_paths: [
thumbnailPath: "https://img.itch.zone/aW1hZ2UvMTkwMzc5MS8xMTgzNzY0Ny5wbmc=/original/r7iVIj.png",
itchLink: "https://craftelia.itch.io/gamelab2023-blood-god",
mediaPaths: [
"https://img.itch.zone/aW1hZ2UvMTkwMzc5MS8xMTgyMjc0Ni5wbmc=/original/65c%2FQT.png",
"https://img.itch.zone/aW1hZ2UvMTkwMzc5MS8xMTgyMjc0Ny5wbmc=/original/4FiVFR.png",
"https://img.itch.zone/aW1hZ2UvMTkwMzc5MS8xMTgyMjc0OC5wbmc=/original/IkUG5I.png",
"https://img.itch.zone/aW1hZ2UvMTkwMzc5MS8xMTgzNzY1My5wbmc=/original/jtOMly.png"
],
logo_path: "https://img.itch.zone/aW1nLzExODI4OTQyLnBuZw==/original/0MBnt3.png",
logoPath: "https://img.itch.zone/aW1nLzExODI4OTQyLnBuZw==/original/0MBnt3.png",
backgroundImagePath: "https://img.itch.zone/aW1nLzExODIyNzg4LnBuZw==/original/QVGL4L.png",
collections: "Ubi Gamelab",
color_scheme: {
colorScheme: {
primary: "#66258a",
secondary: "#80f071",
ternary: "#ffffff"
@ -55,7 +55,6 @@ const localGames: Game[] = [
players: "2-2",
release: "2025-04-13",
modification: "2023-05-05",
executable: "game\\FrogginAround.exe",
genres: "action, adventure, puzzle",
developers: [
new Developer({
@ -77,9 +76,9 @@ const localGames: Game[] = [
role: "Art"
}),
],
thumbnail_path: "https://img.itch.zone/aW1nLzIwNzAwNDg1LnBuZw==/original/qGDxOj.png",
itch_link: "https://jeanne444.itch.io/froggin-around",
media_paths: [
thumbnailPath: "https://img.itch.zone/aW1nLzIwNzAwNDg1LnBuZw==/original/qGDxOj.png",
itchLink: "https://jeanne444.itch.io/froggin-around",
mediaPaths: [
"https://img.itch.zone/aW1hZ2UvMzQ2ODYzOS8yMDcxMDI1Mi5wbmc=/original/owXY2q.png",
"https://img.itch.zone/aW1hZ2UvMzQ2ODYzOS8yMDcwMDgwOC5wbmc=/original/PTa96E.png",
"https://img.itch.zone/aW1hZ2UvMzQ2ODYzOS8yMDcwMDgwNy5wbmc=/original/PXw75v.png",
@ -87,14 +86,14 @@ const localGames: Game[] = [
"https://img.itch.zone/aW1hZ2UvMzQ2ODYzOS8yMDcwMDgwOS5wbmc=/original/FYGa9e.png",
"https://img.itch.zone/aW1hZ2UvMzQ2ODYzOS8yMDcyNDg1Mi5naWY=/original/%2BLoLem.gif"
],
logo_path: "https://img.itch.zone/aW1hZ2UvMzQ2ODYzOS8yMDg2MDc1OC5wbmc=/original/tgccKa.png",
logoPath: "https://img.itch.zone/aW1hZ2UvMzQ2ODYzOS8yMDg2MDc1OC5wbmc=/original/tgccKa.png",
collections: "Ubi Gamelab",
color_scheme: {
colorScheme: {
primary: "#cf2d30",
secondary: "#b3cf43",
ternary: "#ffffff"
},
})
}),
];
export async function fetchGames(): Promise<Game[]> {
@ -105,7 +104,7 @@ export async function fetchGames(): Promise<Game[]> {
for (const game of games) {
console.log(game)
}
return games.map(convertToNewFormat);
return [...games.map(convertToNewFormat), ...localGames];
}
function convertToNewFormat(metadata: Metadata): Game {
@ -114,15 +113,15 @@ function convertToNewFormat(metadata: Metadata): Game {
title: metadata.Game,
description: metadata.Description,
collections: metadata.Collection,
thumbnail_path: metadata.ThumbnailPath,
media_paths: [metadata.ImagePath],
thumbnailPath: metadata.ThumbnailPath,
mediaPaths: [metadata.ImagePath],
genres: metadata.Genres,
executable: metadata.Files,
release: metadata.Release,
modification: metadata.Modification,
version: metadata.Version,
players: metadata.Players,
public_repository_link: metadata.PublicRepositoryLink,
publicRepositoryLink: metadata.PublicRepositoryLink,
developers: metadata.Developers.split(",").map((dev) => new Developer({
name: dev
})),

View File

@ -2,6 +2,8 @@ import { defineStore } from 'pinia';
import {models} from "../../wailsjs/go/models";
import Game = models.Game;
import { StartGame } from "../../wailsjs/go/main/App";
import { fetchGames } from '../services/game-service';
import { KeyboardManager } from '../utils/keyboard-manager';
export const useAppStore = defineStore('app', {
state: () => ({
@ -18,10 +20,21 @@ export const useAppStore = defineStore('app', {
}),
getters: {
filteredGames(state): Game[] {
return state.games.filter(game => game.genres.split(",").includes(state.selectedTag ?? ''));
if (state.showSidebar) {
return state.games.filter(game => game.genres.split(",").includes(state.selectedTag ?? ''));
}
return state.games;
}
},
actions: {
async loadGames() {
this.games = await fetchGames();
console.log(this.games);
this.tags = [...new Set(this.games.flatMap(game => game.genres.split(",")))];
if (this.tags.length > 0) {
this.selectTag(this.tags[0])
}
},
moveGameRight() {
this.selectGame(this.selectedGameIndex + 1);
},
@ -52,11 +65,12 @@ export const useAppStore = defineStore('app', {
},
showQr(link: string) {
this.qrLink = link;
KeyboardManager.switchContext("options");
},
async startSelectedGame() {
if (this.selectedGame && !this.gameIsStarting) {
this.gameIsStarting = true;
await StartGame(this.selectedGame.Id);
await StartGame(this.selectedGame.id);
this.gameIsStarting = false;
}
else {

View File

@ -6,7 +6,7 @@ export class ImageManager {
public static async getImage(gameId: string, src: string): Promise<string> {
if (src.startsWith("http")) {
if (!src || src.startsWith("http")) {
return src;
}

View File

@ -29,6 +29,10 @@ export abstract class KeyContext {
case ' ':
this.onSpace();
break;
case 'r':
console.log("Loading games");
this.store.loadGames();
break;
default:
break;
}
@ -58,7 +62,7 @@ export abstract class KeyContext {
}
// TODO should be 0x01 when the power button will work
if ((state.buttons & 0x02) !== 0) {
if ((state.buttons & 0x01) !== 0) {
this.onEscape()
}
}

View File

@ -7,6 +7,7 @@ export class OptionsKeyContext extends ModalKeyContext {
protected override onEscape(): void {
super.onEscape();
this.store.optionsOpen = false;
this.store.qrLink = "";
KeyboardManager.switchContext('carousel');
}

View File

@ -134,7 +134,7 @@ export function WindowIsFullscreen(): Promise<boolean>;
// [WindowSetSize](https://wails.io/docs/reference/runtime/window#windowsetsize)
// Sets the width and height of the window.
export function WindowSetSize(width: number, height: number): Promise<Size>;
export function WindowSetSize(width: number, height: number): void;
// [WindowGetSize](https://wails.io/docs/reference/runtime/window#windowgetsize)
// Gets the width and height of the window.

2
go.mod
View File

@ -6,7 +6,7 @@ toolchain go1.23.5
require (
github.com/karalabe/hid v1.0.0
github.com/wailsapp/wails/v2 v2.9.2
github.com/wailsapp/wails/v2 v2.10.1
gopkg.in/yaml.v3 v3.0.1
)

4
go.sum
View File

@ -69,8 +69,8 @@ github.com/wailsapp/go-webview2 v1.0.19 h1:7U3QcDj1PrBPaxJNCui2k1SkWml+Q5kvFUFyT
github.com/wailsapp/go-webview2 v1.0.19/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
github.com/wailsapp/wails/v2 v2.9.2 h1:Xb5YRTos1w5N7DTMyYegWaGukCP2fIaX9WF21kPPF2k=
github.com/wailsapp/wails/v2 v2.9.2/go.mod h1:uehvlCwJSFcBq7rMCGfk4rxca67QQGsbg5Nm4m9UnBs=
github.com/wailsapp/wails/v2 v2.10.1 h1:QWHvWMXII2nI/nXz77gpPG8P3ehl6zKe+u4su5BWIns=
github.com/wailsapp/wails/v2 v2.10.1/go.mod h1:zrebnFV6MQf9kx8HI4iAv63vsR5v67oS7GTEZ7Pz1TY=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=

View File

@ -139,7 +139,7 @@ func Start(onStateChange func(ControllerState)) {
state.Id = i
// TODO Samuel please fix help me
if (state.Buttons != 0 || state.Joystick.X != 127 || state.Joystick.Y != 127) && !(state.Id == 0 && state.Buttons == 128 && state.Joystick.X != 127 && state.Joystick.Y != 127) {
if (state.Buttons != 0 || state.Joystick.X != 127 || state.Joystick.Y != 127) && !(state.Id == 1 && state.Buttons == 128 && state.Joystick.X == 127 && state.Joystick.Y == 127) {
// fmt.Printf("Id: %d - %d buttons ", state.Id, state.Buttons)
onStateChange(*state)
}

View File

@ -13,7 +13,7 @@ type Metadata struct {
Release string
Modification string
Files string
PublicRepositoryLink string
PublicRepositoryLink string `yaml:"publicRepositoryLink"`
Genres string
Developers string
}

View File

@ -182,6 +182,9 @@ func ExtractGame(game models.Metadata) string {
func GetConjureGameInfo() []models.Metadata {
gamePath := config.GetDefaultConjureGamesDirectory()
fmt.Println("Loading games....")
fmt.Println(gamePath)
entries, err := os.ReadDir(gamePath)
if err != nil {
log.Fatal(err)