diff --git a/JEU/src/client/pong.css b/JEU/src/client/pong.css deleted file mode 100644 index c481c502..00000000 --- a/JEU/src/client/pong.css +++ /dev/null @@ -1,53 +0,0 @@ - -@font-face { - font-family: "Bit5x3"; - src: url("http://localhost:8080/Bit5x3.woff2") format("woff2"), - url("http://localhost:8080/Bit5x3.woff") format("woff"); - font-weight: normal; - font-style: normal; - font-display: swap; -} -#preload_font { - font-family: "Bit5x3"; - opacity:0; - height:0; - width:0; - display:inline-block; -} -body { - margin: 0; - background-color: #222425; -} -#canvas_container { - text-align: center; - /* border: dashed rgb(245, 245, 245) 5px; */ - /* max-height: 80vh; */ - /* overflow: hidden; */ -} -#div_game_options { - text-align: center; - font-family: "Bit5x3"; - color: rgb(245, 245, 245); - font-size: x-large; -} -#div_game_options fieldset { - max-width: 50vw; - width: auto; - margin: 0 auto; -} -#div_game_options fieldset div { - padding: 10px; -} -#play_pong_button { - font-family: "Bit5x3"; - color: rgb(245, 245, 245); - background-color: #333333; - font-size: x-large; - padding: 10px; -} -canvas { - background-color: #333333; - max-width: 75vw; - /* max-height: 100vh; */ - width: 80%; -} diff --git a/JEU/src/client/pong.html b/JEU/src/client/pong.html deleted file mode 100644 index d23e5590..00000000 --- a/JEU/src/client/pong.html +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - -
.
- -
-
- game options -
- - -
-
- - -
-
- - - - - -
-
- -
-
-
- -
- -
- - - - - diff --git a/JEU/src/server/constants.ts b/JEU/src/server/constants.ts deleted file mode 100644 index bd5f8e9e..00000000 --- a/JEU/src/server/constants.ts +++ /dev/null @@ -1,9 +0,0 @@ - -export * from "../shared_js/constants.js" - -// 15ms == 1000/66.666 -export const serverGameLoopIntervalMS = 15; // millisecond -export const fixedDeltaTime = serverGameLoopIntervalMS/1000; // second - -// 33.333ms == 1000/30 -export const clientsUpdateIntervalMS = 1000/30; // millisecond diff --git a/JEU/src/server/utils.ts b/JEU/src/server/utils.ts deleted file mode 100644 index 0c939b8c..00000000 --- a/JEU/src/server/utils.ts +++ /dev/null @@ -1,8 +0,0 @@ - -export * from "../shared_js/utils.js" - -function shortId(id: string): string { - return id.substring(0, id.indexOf("-")); -} - -export {shortId} diff --git a/JEU/www/Bit5x3.woff b/JEU/www/Bit5x3.woff deleted file mode 100644 index 72c8b293..00000000 Binary files a/JEU/www/Bit5x3.woff and /dev/null differ diff --git a/JEU/www/Bit5x3.woff2 b/JEU/www/Bit5x3.woff2 deleted file mode 100644 index 27d538bf..00000000 Binary files a/JEU/www/Bit5x3.woff2 and /dev/null differ diff --git a/JEU/www/favicon.ico b/JEU/www/favicon.ico deleted file mode 100644 index b7e7e5ca..00000000 Binary files a/JEU/www/favicon.ico and /dev/null differ diff --git a/JEU/jsconfig.json b/JEU2/jsconfig.json similarity index 100% rename from JEU/jsconfig.json rename to JEU2/jsconfig.json diff --git a/JEU/make.sh b/JEU2/make.sh similarity index 100% rename from JEU/make.sh rename to JEU2/make.sh diff --git a/JEU/memo.txt b/JEU2/memo.txt similarity index 100% rename from JEU/memo.txt rename to JEU2/memo.txt diff --git a/JEU/package-lock.json b/JEU2/package-lock.json similarity index 100% rename from JEU/package-lock.json rename to JEU2/package-lock.json diff --git a/JEU/package.json b/JEU2/package.json similarity index 100% rename from JEU/package.json rename to JEU2/package.json diff --git a/JEU/src/server/class/Client.ts b/JEU2/src/server/class/Client.ts similarity index 89% rename from JEU/src/server/class/Client.ts rename to JEU2/src/server/class/Client.ts index fbdd8fd3..dead987b 100644 --- a/JEU/src/server/class/Client.ts +++ b/JEU2/src/server/class/Client.ts @@ -2,8 +2,8 @@ import { WebSocket } from "../wsServer.js"; import { Racket } from "../../shared_js/class/Rectangle.js"; import { GameSession } from "./GameSession.js"; -import * as ev from "../../shared_js/class/Event.js" -import * as en from "../../shared_js/enums.js" +import * as ev from "./Event.js" +import * as en from "../enums.js" class Client { socket: WebSocket; diff --git a/JEU/src/shared_js/class/Event.ts b/JEU2/src/server/class/Event.ts similarity index 100% rename from JEU/src/shared_js/class/Event.ts rename to JEU2/src/server/class/Event.ts diff --git a/JEU2/src/server/class/GameComponents.ts b/JEU2/src/server/class/GameComponents.ts new file mode 100644 index 00000000..5bbcd511 --- /dev/null +++ b/JEU2/src/server/class/GameComponents.ts @@ -0,0 +1,65 @@ + +import * as c from "../constants.js" +import * as en from "../enums.js" +import { VectorInteger } from "./Vector.js"; +import { Rectangle, MovingRectangle, Racket, Ball } from "./Rectangle.js"; +import { random } from "../utils.js"; + +class GameComponents { + wallTop: Rectangle | MovingRectangle; + wallBottom: Rectangle | MovingRectangle; + playerLeft: Racket; + playerRight: Racket; + ballsArr: Ball[] = []; + constructor(options: en.MatchOptions) + { + const pos = new VectorInteger; + + // Rackets + pos.assign(0+c.pw, c.h_mid-c.ph/2); + this.playerLeft = new Racket(pos, c.pw, c.ph, c.racketSpeed); + pos.assign(c.w-c.pw-c.pw, c.h_mid-c.ph/2); + this.playerRight = new Racket(pos, c.pw, c.ph, c.racketSpeed); + + // Balls + let ballsCount = 1; + if (options & en.MatchOptions.multiBalls) { + ballsCount = c.multiBallsCount; + } + pos.assign(-c.ballSize, -c.ballSize); // ball out =) + while (this.ballsArr.length < ballsCount) { + this.ballsArr.push(new Ball(pos, c.ballSize, c.ballSpeed, c.ballSpeedIncrease)) + } + this.ballsArr.forEach((ball) => { + ball.dir.x = 1; + if (random() > 0.5) { + ball.dir.x *= -1; + } + + ball.dir.y = random(0, 0.2); + if (random() > 0.5) { + ball.dir.y *= -1; + } + + ball.dir = ball.dir.normalized(); + }); + + // Walls + if (options & en.MatchOptions.movingWalls) { + pos.assign(0, 0); + this.wallTop = new MovingRectangle(pos, c.w, c.wallSize, c.movingWallSpeed); + (this.wallTop).dir.y = -1; + pos.assign(0, c.h-c.wallSize); + this.wallBottom = new MovingRectangle(pos, c.w, c.wallSize, c.movingWallSpeed); + (this.wallBottom).dir.y = 1; + } + else { + pos.assign(0, 0); + this.wallTop = new Rectangle(pos, c.w, c.wallSize); + pos.assign(0, c.h-c.wallSize); + this.wallBottom = new Rectangle(pos, c.w, c.wallSize); + } + } +} + +export {GameComponents} diff --git a/JEU/src/server/class/GameComponentsServer.ts b/JEU2/src/server/class/GameComponentsServer.ts similarity index 86% rename from JEU/src/server/class/GameComponentsServer.ts rename to JEU2/src/server/class/GameComponentsServer.ts index d8f2c044..d05858e7 100644 --- a/JEU/src/server/class/GameComponentsServer.ts +++ b/JEU2/src/server/class/GameComponentsServer.ts @@ -1,6 +1,6 @@ import * as c from "../constants.js" -import * as en from "../../shared_js/enums.js" +import * as en from "../enums.js" import { GameComponents } from "../../shared_js/class/GameComponents.js"; class GameComponentsServer extends GameComponents { diff --git a/JEU/src/server/class/GameSession.ts b/JEU2/src/server/class/GameSession.ts similarity index 98% rename from JEU/src/server/class/GameSession.ts rename to JEU2/src/server/class/GameSession.ts index 93cc544a..f10dccdf 100644 --- a/JEU/src/server/class/GameSession.ts +++ b/JEU2/src/server/class/GameSession.ts @@ -1,6 +1,6 @@ -import * as en from "../../shared_js/enums.js" -import * as ev from "../../shared_js/class/Event.js" +import * as en from "../enums.js" +import * as ev from "./Event.js" import * as c from "../constants.js" import { ClientPlayer } from "./Client"; import { GameComponentsServer } from "./GameComponentsServer.js"; diff --git a/JEU/src/shared_js/class/Rectangle.ts b/JEU2/src/server/class/Rectangle.ts similarity index 100% rename from JEU/src/shared_js/class/Rectangle.ts rename to JEU2/src/server/class/Rectangle.ts diff --git a/JEU/src/shared_js/class/Vector.ts b/JEU2/src/server/class/Vector.ts similarity index 100% rename from JEU/src/shared_js/class/Vector.ts rename to JEU2/src/server/class/Vector.ts diff --git a/JEU/src/shared_js/class/interface.ts b/JEU2/src/server/class/interface.ts similarity index 100% rename from JEU/src/shared_js/class/interface.ts rename to JEU2/src/server/class/interface.ts diff --git a/JEU2/src/server/constants.ts b/JEU2/src/server/constants.ts new file mode 100644 index 00000000..89c27829 --- /dev/null +++ b/JEU2/src/server/constants.ts @@ -0,0 +1,35 @@ + +export * from "../shared_js/constants.js" + +// 15ms == 1000/66.666 +export const serverGameLoopIntervalMS = 15; // millisecond +export const fixedDeltaTime = serverGameLoopIntervalMS/1000; // second + +// 33.333ms == 1000/30 +export const clientsUpdateIntervalMS = 1000/30; // millisecond + +export const CanvasWidth = 1500; +export const CanvasRatio = 1.66666; +/* ratio 5/3 (1.66) */ + +export const w = CanvasWidth; +export const h = CanvasWidth / CanvasRatio; +export const w_mid = Math.floor(w/2); +export const h_mid = Math.floor(h/2); +export const pw = Math.floor(w*0.017); +export const ph = pw*6; +export const ballSize = pw; +export const wallSize = Math.floor(w*0.01); +export const racketSpeed = Math.floor(w*0.66); // pixel per second +export const ballSpeed = Math.floor(w*0.66); // pixel per second +export const ballSpeedIncrease = Math.floor(ballSpeed*0.05); // pixel per second + +export const normalizedSpeed = false; // for consistency in speed independent of direction + +export const matchStartDelay = 3000; // millisecond +export const newRoundDelay = 1500; // millisecond + +// Game Variantes +export const multiBallsCount = 3; +export const movingWallPosMax = Math.floor(w*0.12); +export const movingWallSpeed = Math.floor(w*0.08); diff --git a/JEU/src/shared_js/enums.ts b/JEU2/src/server/enums.ts similarity index 100% rename from JEU/src/shared_js/enums.ts rename to JEU2/src/server/enums.ts diff --git a/JEU/src/server/server.ts b/JEU2/src/server/server.ts similarity index 100% rename from JEU/src/server/server.ts rename to JEU2/src/server/server.ts diff --git a/JEU2/src/server/utils.ts b/JEU2/src/server/utils.ts new file mode 100644 index 00000000..39929054 --- /dev/null +++ b/JEU2/src/server/utils.ts @@ -0,0 +1,33 @@ +import { MovingRectangle } from "./class/Rectangle.js"; +export * from "../shared_js/utils.js" + +function shortId(id: string): string { + return id.substring(0, id.indexOf("-")); +} + +export {shortId} + +function random(min: number = 0, max: number = 1) { + return Math.random() * (max - min) + min; +} + +function sleep (ms: number) { + return new Promise((resolve) => setTimeout(resolve, ms)); +} + +function clamp(n: number, min: number, max: number) : number +{ + if (n < min) + n = min; + else if (n > max) + n = max; + return (n); +} + +// Typescript hack, unused +function assertMovingRectangle(value: unknown): asserts value is MovingRectangle { + // if (value !== MovingRectangle) throw new Error("Not a MovingRectangle"); + return; +} + +export {random, sleep, clamp, assertMovingRectangle} diff --git a/JEU/src/shared_js/wallsMovement.ts b/JEU2/src/server/wallsMovement.ts similarity index 100% rename from JEU/src/shared_js/wallsMovement.ts rename to JEU2/src/server/wallsMovement.ts diff --git a/JEU/src/server/wsServer.ts b/JEU2/src/server/wsServer.ts similarity index 98% rename from JEU/src/server/wsServer.ts rename to JEU2/src/server/wsServer.ts index a82df62d..bc3901bc 100644 --- a/JEU/src/server/wsServer.ts +++ b/JEU2/src/server/wsServer.ts @@ -8,8 +8,8 @@ export class WebSocket extends BaseLibWebSocket { import { IncomingMessage } from "http"; import { v4 as uuidv4 } from 'uuid'; -import * as en from "../shared_js/enums.js" -import * as ev from "../shared_js/class/Event.js" +import * as en from "./enums.js" +import * as ev from "./class/Event.js" import { Client, ClientPlayer } from "./class/Client.js" import { GameSession } from "./class/GameSession.js" import { shortId } from "./utils.js"; diff --git a/JEU/tsconfig.json b/JEU2/tsconfig.json similarity index 100% rename from JEU/tsconfig.json rename to JEU2/tsconfig.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index da5fa458..00000000 --- a/package-lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "group_transcendence", - "lockfileVersion": 2, - "requires": true, - "packages": {} -} diff --git a/srcs/requirements/nestjs/api_back/src/friendship/dto/create-friendship.dto.ts b/srcs/requirements/nestjs/api_back/src/friendship/dto/create-friendship.dto.ts index 4285b556..3fb61e19 100644 --- a/srcs/requirements/nestjs/api_back/src/friendship/dto/create-friendship.dto.ts +++ b/srcs/requirements/nestjs/api_back/src/friendship/dto/create-friendship.dto.ts @@ -3,9 +3,9 @@ import { FriendshipStatus } from '../entities/friendship.entity'; export class CreateFriendshipDto { @IsString() - readonly requesterId: string; + readonly requesterUsername: string; @IsString() - readonly addresseeId: string; + readonly addresseeUsername: string; @IsEnum(FriendshipStatus) readonly status: FriendshipStatus; } diff --git a/srcs/requirements/nestjs/api_back/src/friendship/entities/friendship.entity.ts b/srcs/requirements/nestjs/api_back/src/friendship/entities/friendship.entity.ts index 0b8f08bd..12526de6 100644 --- a/srcs/requirements/nestjs/api_back/src/friendship/entities/friendship.entity.ts +++ b/srcs/requirements/nestjs/api_back/src/friendship/entities/friendship.entity.ts @@ -18,12 +18,12 @@ export class Friendship { date : Date; @Column() - @ManyToOne(type => User, user => user.requesterId) - requesterId: string; + @ManyToOne(type => User, user => user.username) + requesterUsername: string; @Column() - @ManyToOne(type => User, user => user.addresseeId) - addresseeId: string; + @ManyToOne(type => User, user => user.username) + addresseeUsername: string; @Column({ type: 'enum', enum: FriendshipStatus, default: FriendshipStatus.REQUESTED}) status: FriendshipStatus; diff --git a/srcs/requirements/nestjs/api_back/src/friendship/friendship.controller.ts b/srcs/requirements/nestjs/api_back/src/friendship/friendship.controller.ts index 225f1b4a..1441c3b7 100644 --- a/srcs/requirements/nestjs/api_back/src/friendship/friendship.controller.ts +++ b/srcs/requirements/nestjs/api_back/src/friendship/friendship.controller.ts @@ -36,14 +36,8 @@ export class FriendshipController { @UseGuards(TwoFactorGuard) create(@Body() createFriendshipDto: CreateFriendshipDto, @Req() req) { const user = req.user; - - console.log("WHAT IS UP MY GUYS IT IS YOUR BOI THAT IDIOT YOU HATE 22222"); - - // console.log(`User id: ${user.id}\nFriend id: ${createFriendshipDto.requesterId}\nStatus: ${createFriendshipDto.status}`); - // console.log(`My User id: ${createFriendshipDto.requesterId}`) - console.log(`My User id: ${user.id}`) - console.log(`User id: ${user.id}\nFriend id: ${createFriendshipDto.addresseeId}\nStatus: ${createFriendshipDto.status}`); - if (user.id === +createFriendshipDto.requesterId) + console.log(`User id: ${user.id}\nFriend id: ${createFriendshipDto.requesterUsername}\nStatus: ${createFriendshipDto.status}`); + if (user.username === createFriendshipDto.requesterUsername) return this.friendshipService.create(createFriendshipDto, user); return new HttpException('You can\'t request a frienship for another user', HttpStatus.FORBIDDEN); } @@ -73,7 +67,7 @@ export class FriendshipController { @UseGuards(TwoFactorGuard) findAllBlocked(@Req() req) { const user = req.user; - return this.friendshipService.findAllBlockedFriends(user.id); + return this.friendshipService.findAllBlockedFriends(user.username); } // GET http://transcendance:8080/api/v2/network/pending diff --git a/srcs/requirements/nestjs/api_back/src/friendship/friendship.service.ts b/srcs/requirements/nestjs/api_back/src/friendship/friendship.service.ts index 6066a881..348921db 100644 --- a/srcs/requirements/nestjs/api_back/src/friendship/friendship.service.ts +++ b/srcs/requirements/nestjs/api_back/src/friendship/friendship.service.ts @@ -3,7 +3,6 @@ import { InjectRepository } from '@nestjs/typeorm'; import { User } from 'src/users/entities/user.entity'; import { Repository } from 'typeorm'; import { CreateFriendshipDto } from './dto/create-friendship.dto'; -import { UpdateFriendshipDto } from './dto/update-friendship.dto'; import { Friendship, FriendshipStatus } from './entities/friendship.entity'; @Injectable() @@ -17,8 +16,8 @@ export class FriendshipService { ) { } - async findOneFriend(friendshipId: string, userId: string) { - const friendship = await this.friendshipRepository.find({ where: { id: +friendshipId, requesterId: userId, status: FriendshipStatus.ACCEPTED } }); + async findOneFriend(friendshipId: string, username: string) { + const friendship = await this.friendshipRepository.find({ where: { id: +friendshipId, requesterUsername: username, status: FriendshipStatus.ACCEPTED } }); if (!friendship) throw new HttpException(`The requested friend not found.`, HttpStatus.NOT_FOUND); return friendship; @@ -31,12 +30,12 @@ export class FriendshipService { return friendship; } - async findAllFriends(userId: string) { + async findAllFriends(username: string) { const friendship = await this.friendshipRepository .createQueryBuilder('friendship') .where('friendship.status = :status', { status: FriendshipStatus.ACCEPTED }) - .andWhere('friendship.addresseeId = :addressee', { addressee: userId }) - .orWhere('friendship.requesterId = :requester', { requester: userId }) + .andWhere('friendship.addresseeUsername = :addressee', { addressee: username }) + .orWhere('friendship.requesterUsername = :requester', { requester: username }) .andWhere('friendship.status = :status', { status: FriendshipStatus.ACCEPTED }) .getMany(); for (const friend of friendship) @@ -44,40 +43,39 @@ export class FriendshipService { return friendship; } - async findAllBlockedFriends(userId: string) { + async findAllBlockedFriends(username: string) { return await this.friendshipRepository .createQueryBuilder('friendship') - .where('friendship.requesterId = :requestee', { requestee: userId }) - .orWhere('friendship.addresseeId = :addressee', { addressee: userId }) + .where('friendship.requesterUsername = :requestee', { requestee: username }) .andWhere('friendship.status = :status', { status: FriendshipStatus.BLOCKED }) .getMany(); } - async findAllPendantRequestsForFriendship(userId: string) { + async findAllPendantRequestsForFriendship(username: string) { return await this.friendshipRepository .createQueryBuilder('friendship') - .where('friendship.requesterId = :requestee', { requestee: userId }) + .where('friendship.requesterUsername = :requestee', { requestee: username }) .andWhere('friendship.status = :status', { status: FriendshipStatus.REQUESTED }) .getMany(); } - async findAllReceivedRequestsForFriendship(userId: string) { + async findAllReceivedRequestsForFriendship(username: string) { return await this.friendshipRepository .createQueryBuilder('friendship') - .where('friendship.addresseeId = :addressee', { addressee: userId }) + .where('friendship.addresseeUsername = :addressee', { addressee: username }) .andWhere('friendship.status = :status', { status: FriendshipStatus.REQUESTED }) .getMany(); } //GROS CHANTIER async create(createFriendshipDto: CreateFriendshipDto, creator : User) { - const addressee = await this.userRepository.findOneBy({ id: +createFriendshipDto.addresseeId }); + const addressee = await this.userRepository.findOneBy({username: createFriendshipDto.requesterUsername}); if (!addressee) throw new HttpException(`The addressee does not exist.`, HttpStatus.NOT_FOUND); if (creator.id === addressee.id) throw new HttpException(`You can't add yourself.`, HttpStatus.FORBIDDEN); if (createFriendshipDto.status !== FriendshipStatus.REQUESTED && createFriendshipDto.status !== FriendshipStatus.BLOCKED) throw new HttpException(`The status is not valid.`, HttpStatus.NOT_FOUND); - const friendship = await this.friendshipRepository.findOneBy({ requesterId: createFriendshipDto.requesterId, addresseeId: createFriendshipDto.addresseeId }); + const friendship = await this.friendshipRepository.findOneBy({ requesterUsername: createFriendshipDto.requesterUsername, addresseeUsername: createFriendshipDto.addresseeUsername }); if (friendship) { if (friendship.status && friendship.status === FriendshipStatus.ACCEPTED) throw new HttpException(`The friendship request has already been accepted.`, HttpStatus.OK); @@ -96,7 +94,7 @@ export class FriendshipService { const relation = await this.friendshipRepository.findOneBy({ id: +relationshipId }); if (!relation) throw new HttpException(`The requested relationship not found.`, HttpStatus.NOT_FOUND); - if (+relation.requesterId === user.id) { + if (+relation.requesterUsername === user.id) { throw new HttpException(`You can't accept your own request.`, HttpStatus.NOT_FOUND); } if (status === FriendshipStatus.ACCEPTED) @@ -122,8 +120,8 @@ export class FriendshipService { async findIfUserIsBlockedOrHasBlocked(userConnectedId: string, userToCheckId: string) { const friendship = await this.friendshipRepository .createQueryBuilder('friendship') - .where('friendship.requesterId = :requestee', { requestee: userConnectedId }) - .orWhere('friendship.requesterId = :requesteeBis', { requesteeBis: userToCheckId }) + .where('friendship.requesterUsername = :requestee', { requestee: userConnectedId }) + .orWhere('friendship.requesterUsername = :requesteeBis', { requesteeBis: userToCheckId }) .andWhere('friendship.status = :status', { status: FriendshipStatus.BLOCKED }) .getOne(); if (friendship) diff --git a/srcs/requirements/nestjs/api_back/src/game/dto/create-party.dto.ts b/srcs/requirements/nestjs/api_back/src/game/dto/create-party.dto.ts new file mode 100644 index 00000000..14d2e14c --- /dev/null +++ b/srcs/requirements/nestjs/api_back/src/game/dto/create-party.dto.ts @@ -0,0 +1,16 @@ +import { IsBoolean, IsEmail, IsNotEmpty, IsString } from 'class-validator'; + +export class CreateUsersDto { + @IsString() + @IsNotEmpty() + readonly username: string; + readonly fortyTwoId: string; + @IsEmail() + readonly email: string; + @IsString() + readonly image_url: string; + @IsString() + readonly status: string; + @IsBoolean() + readonly isEnabledTwoFactorAuth: boolean; +} diff --git a/srcs/requirements/nestjs/api_back/src/game/entity/user.entity.ts b/srcs/requirements/nestjs/api_back/src/game/entity/user.entity.ts new file mode 100644 index 00000000..6c45d3a5 --- /dev/null +++ b/srcs/requirements/nestjs/api_back/src/game/entity/user.entity.ts @@ -0,0 +1,22 @@ +import { Column, Entity, PrimaryGeneratedColumn } from "typeorm"; + + + +@Entity('gameParty') +export class gameParty { + + @PrimaryGeneratedColumn() + id: number; + + @Column() + playerOne: string + + @Column() + playerTwo: string + + @Column() + resultOfTheMatch: string + + @Column() + gameServerIdOfTheMatch: string +} diff --git a/srcs/requirements/nestjs/api_back/src/users/entities/user.entity.ts b/srcs/requirements/nestjs/api_back/src/users/entities/user.entity.ts index fa0fce5b..a3c3f904 100644 --- a/srcs/requirements/nestjs/api_back/src/users/entities/user.entity.ts +++ b/srcs/requirements/nestjs/api_back/src/users/entities/user.entity.ts @@ -44,11 +44,11 @@ export class User { secretTwoFactorAuth: string; @JoinTable() - @OneToMany(type => Friendship , (friendship) => friendship.requesterId) + @OneToMany(type => Friendship , (friendship) => friendship.requesterUsername) requesterId: Friendship[]; @JoinTable() - @OneToMany(type => Friendship , (friendship) => friendship.addresseeId) + @OneToMany(type => Friendship , (friendship) => friendship.addresseeUsername) addresseeId: Friendship[]; @JoinColumn() diff --git a/JEU/src/client/audio.ts b/srcs/requirements/svelte/api_front/public/game/audio.ts similarity index 100% rename from JEU/src/client/audio.ts rename to srcs/requirements/svelte/api_front/public/game/audio.ts diff --git a/srcs/requirements/svelte/api_front/public/game/class/Event.ts b/srcs/requirements/svelte/api_front/public/game/class/Event.ts new file mode 100644 index 00000000..3f0d440a --- /dev/null +++ b/srcs/requirements/svelte/api_front/public/game/class/Event.ts @@ -0,0 +1,107 @@ + +import * as en from "../enums.js" + +/* From Server */ +class ServerEvent { + type: en.EventTypes; + constructor(type: en.EventTypes = 0) { + this.type = type; + } +} + +class EventAssignId extends ServerEvent { + id: string; + constructor(id: string) { + super(en.EventTypes.assignId); + this.id = id; + } +} + +class EventMatchmakingComplete extends ServerEvent { + side: en.PlayerSide; + constructor(side: en.PlayerSide) { + super(en.EventTypes.matchmakingComplete); + this.side = side; + } +} + +class EventGameUpdate extends ServerEvent { + playerLeft = { + y: 0 + }; + playerRight = { + y: 0 + }; + ballsArr: { + x: number, + y: number, + dirX: number, + dirY: number, + speed: number + }[] = []; + wallTop? = { + y: 0 + }; + wallBottom? = { + y: 0 + }; + lastInputId = 0; + constructor() { // TODO: constructor that take GameComponentsServer maybe ? + super(en.EventTypes.gameUpdate); + } +} + +class EventScoreUpdate extends ServerEvent { + scoreLeft: number; + scoreRight: number; + constructor(scoreLeft: number, scoreRight: number) { + super(en.EventTypes.scoreUpdate); + this.scoreLeft = scoreLeft; + this.scoreRight = scoreRight; + } +} + +class EventMatchEnd extends ServerEvent { + winner: en.PlayerSide; + constructor(winner: en.PlayerSide) { + super(en.EventTypes.matchEnd); + this.winner = winner; + } +} + + +/* From Client */ +class ClientEvent { + type: en.EventTypes; // readonly ? + constructor(type: en.EventTypes = 0) { + this.type = type; + } +} + +class ClientAnnounce extends ClientEvent { + role: en.ClientRole; + clientId: string; + matchOptions: en.MatchOptions; + constructor(role: en.ClientRole, matchOptions: en.MatchOptions, clientId: string = "") { + super(en.EventTypes.clientAnnounce); + this.role = role; + this.clientId = clientId; + this.matchOptions = matchOptions; + } +} + +class EventInput extends ClientEvent { + input: en.InputEnum; + id: number; + constructor(input: en.InputEnum = en.InputEnum.noInput, id: number = 0) { + super(en.EventTypes.clientInput); + this.input = input; + this.id = id; + } +} + +export { + ServerEvent, EventAssignId, EventMatchmakingComplete, + EventGameUpdate, EventScoreUpdate, EventMatchEnd, + ClientEvent, ClientAnnounce, EventInput +} diff --git a/JEU/src/client/class/GameArea.ts b/srcs/requirements/svelte/api_front/public/game/class/GameArea.ts similarity index 100% rename from JEU/src/client/class/GameArea.ts rename to srcs/requirements/svelte/api_front/public/game/class/GameArea.ts diff --git a/JEU/src/shared_js/class/GameComponents.ts b/srcs/requirements/svelte/api_front/public/game/class/GameComponents.ts similarity index 100% rename from JEU/src/shared_js/class/GameComponents.ts rename to srcs/requirements/svelte/api_front/public/game/class/GameComponents.ts diff --git a/JEU/src/client/class/GameComponentsClient.ts b/srcs/requirements/svelte/api_front/public/game/class/GameComponentsClient.ts similarity index 100% rename from JEU/src/client/class/GameComponentsClient.ts rename to srcs/requirements/svelte/api_front/public/game/class/GameComponentsClient.ts diff --git a/JEU/src/client/class/InputHistory.ts b/srcs/requirements/svelte/api_front/public/game/class/InputHistory.ts similarity index 100% rename from JEU/src/client/class/InputHistory.ts rename to srcs/requirements/svelte/api_front/public/game/class/InputHistory.ts diff --git a/srcs/requirements/svelte/api_front/public/game/class/Rectangle.ts b/srcs/requirements/svelte/api_front/public/game/class/Rectangle.ts new file mode 100644 index 00000000..fff71dc9 --- /dev/null +++ b/srcs/requirements/svelte/api_front/public/game/class/Rectangle.ts @@ -0,0 +1,144 @@ + +import { Vector, VectorInteger } from "./Vector.js"; +import { Component, Moving } from "./interface.js"; +import * as c from "../constants.js" + +class Rectangle implements Component { + pos: VectorInteger; + width: number; + height: number; + constructor(pos: VectorInteger, width: number, height: number) { + this.pos = new VectorInteger(pos.x, pos.y); + this.width = width; + this.height = height; + } + collision(collider: Rectangle): boolean { + const thisLeft = this.pos.x; + const thisRight = this.pos.x + this.width; + const thisTop = this.pos.y; + const thisBottom = this.pos.y + this.height; + const colliderLeft = collider.pos.x; + const colliderRight = collider.pos.x + collider.width; + const colliderTop = collider.pos.y; + const colliderBottom = collider.pos.y + collider.height; + if ((thisBottom < colliderTop) + || (thisTop > colliderBottom) + || (thisRight < colliderLeft) + || (thisLeft > colliderRight)) { + return false; + } + else { + return true; + } + } +} + +class MovingRectangle extends Rectangle implements Moving { + dir: Vector = new Vector(0,0); + speed: number; + readonly baseSpeed: number; + constructor(pos: VectorInteger, width: number, height: number, baseSpeed: number) { + super(pos, width, height); + this.baseSpeed = baseSpeed; + this.speed = baseSpeed; + } + move(delta: number) { // Math.floor WIP until VectorInteger debug + // console.log(`delta: ${delta}, speed: ${this.speed}, speed*delta: ${this.speed * delta}`); + // this.pos.x += Math.floor(this.dir.x * this.speed * delta); + // this.pos.y += Math.floor(this.dir.y * this.speed * delta); + this.pos.x += this.dir.x * this.speed * delta; + this.pos.y += this.dir.y * this.speed * delta; + } + moveAndCollide(delta: number, colliderArr: Rectangle[]) { + this._moveAndCollideAlgo(delta, colliderArr); + } + protected _moveAndCollideAlgo(delta: number, colliderArr: Rectangle[]) { + let oldPos = new VectorInteger(this.pos.x, this.pos.y); + this.move(delta); + if (colliderArr.some(this.collision, this)) { + this.pos = oldPos; + } + } +} + +class Racket extends MovingRectangle { + constructor(pos: VectorInteger, width: number, height: number, baseSpeed: number) { + super(pos, width, height, baseSpeed); + } + moveAndCollide(delta: number, colliderArr: Rectangle[]) { + // let oldPos = new VectorInteger(this.pos.x, this.pos.y); // debug + this._moveAndCollideAlgo(delta, colliderArr); + // console.log(`y change: ${this.pos.y - oldPos.y}`); + } +} + +class Ball extends MovingRectangle { + readonly speedIncrease: number; + ballInPlay: boolean = false; + constructor(pos: VectorInteger, size: number, baseSpeed: number, speedIncrease: number) { + super(pos, size, size, baseSpeed); + this.speedIncrease = speedIncrease; + } + bounce(collider?: Rectangle) { + this._bounceAlgo(collider); + } + protected _bounceAlgo(collider?: Rectangle) { + /* Could be more generic, but testing only Racket is enough, + because in Pong collider can only be Racket or Wall. */ + if (collider instanceof Racket) { + this._bounceRacket(collider); + } + else { + this._bounceWall(); + } + } + moveAndBounce(delta: number, colliderArr: Rectangle[]) { + this.move(delta); + let i = colliderArr.findIndex(this.collision, this); + if (i != -1) + { + this.bounce(colliderArr[i]); + this.move(delta); + } + } + protected _bounceWall() { // Should be enough for Wall + this.dir.y = this.dir.y * -1; + } + protected _bounceRacket(racket: Racket) { + this._bounceRacketAlgo(racket); + } + protected _bounceRacketAlgo(racket: Racket) { + this.speed += this.speedIncrease; + + let x = this.dir.x * -1; + + const angleFactorDegree = 60; + const angleFactor = angleFactorDegree / 90; + const racketHalf = racket.height/2; + const ballMid = this.pos.y + this.height/2; + const racketMid = racket.pos.y + racketHalf; + + let impact = ballMid - racketMid; + const horizontalMargin = racketHalf * 0.15; + if (impact < horizontalMargin && impact > -horizontalMargin) { + impact = 0; + } + else if (impact > 0) { + impact = impact - horizontalMargin; + } + else if (impact < 0) { + impact = impact + horizontalMargin; + } + + let y = impact / (racketHalf - horizontalMargin) * angleFactor; + + this.dir.assign(x, y); + // Normalize Vector (for consistency in speed independent of direction) + if (c.normalizedSpeed) { + this.dir = this.dir.normalized(); + } + // console.log(`x: ${this.dir.x}, y: ${this.dir.y}`); + } +} + +export {Rectangle, MovingRectangle, Racket, Ball} diff --git a/JEU/src/client/class/RectangleClient.ts b/srcs/requirements/svelte/api_front/public/game/class/RectangleClient.ts similarity index 100% rename from JEU/src/client/class/RectangleClient.ts rename to srcs/requirements/svelte/api_front/public/game/class/RectangleClient.ts diff --git a/JEU/src/client/class/Text.ts b/srcs/requirements/svelte/api_front/public/game/class/Text.ts similarity index 100% rename from JEU/src/client/class/Text.ts rename to srcs/requirements/svelte/api_front/public/game/class/Text.ts diff --git a/srcs/requirements/svelte/api_front/public/game/class/Vector.ts b/srcs/requirements/svelte/api_front/public/game/class/Vector.ts new file mode 100644 index 00000000..025bca36 --- /dev/null +++ b/srcs/requirements/svelte/api_front/public/game/class/Vector.ts @@ -0,0 +1,49 @@ + +class Vector { + x: number; + y: number; + constructor(x: number = 0, y: number = 0) { + this.x = x; + this.y = y; + } + assign(x: number, y: number) { + this.x = x; + this.y = y; + } + normalized() : Vector { + const normalizationFactor = Math.abs(this.x) + Math.abs(this.y); + return new Vector(this.x/normalizationFactor, this.y/normalizationFactor); + } +} + +class VectorInteger extends Vector { + // PLACEHOLDER + // VectorInteger with set/get dont work (No draw on the screen). Why ? +} + +/* +class VectorInteger { + // private _x: number = 0; + // private _y: number = 0; + // constructor(x: number = 0, y: number = 0) { + // this._x = x; + // this._y = y; + // } + // get x(): number { + // return this._x; + // } + // set x(v: number) { + // // this._x = Math.floor(v); + // this._x = v; + // } + // get y(): number { + // return this._y; + // } + // set y(v: number) { + // // this._y = Math.floor(v); + // this._y = v; + // } +} +*/ + +export {Vector, VectorInteger} diff --git a/srcs/requirements/svelte/api_front/public/game/class/interface.ts b/srcs/requirements/svelte/api_front/public/game/class/interface.ts new file mode 100644 index 00000000..39753de1 --- /dev/null +++ b/srcs/requirements/svelte/api_front/public/game/class/interface.ts @@ -0,0 +1,21 @@ + +import { Vector, VectorInteger } from "./Vector.js"; + +interface Component { + pos: VectorInteger; +} + +interface GraphicComponent extends Component { + ctx: CanvasRenderingContext2D; + color: string; + update: () => void; + clear: (pos?: VectorInteger) => void; +} + +interface Moving { + dir: Vector; + speed: number; // pixel per second + move(delta: number): void; +} + +export {Component, GraphicComponent, Moving} diff --git a/JEU/src/shared_js/constants.ts b/srcs/requirements/svelte/api_front/public/game/constants copy.ts similarity index 100% rename from JEU/src/shared_js/constants.ts rename to srcs/requirements/svelte/api_front/public/game/constants copy.ts diff --git a/JEU/src/client/constants.ts b/srcs/requirements/svelte/api_front/public/game/constants.ts similarity index 100% rename from JEU/src/client/constants.ts rename to srcs/requirements/svelte/api_front/public/game/constants.ts diff --git a/JEU/src/client/draw.ts b/srcs/requirements/svelte/api_front/public/game/draw.ts similarity index 100% rename from JEU/src/client/draw.ts rename to srcs/requirements/svelte/api_front/public/game/draw.ts diff --git a/srcs/requirements/svelte/api_front/public/game/enums.ts b/srcs/requirements/svelte/api_front/public/game/enums.ts new file mode 100644 index 00000000..dfba2aa3 --- /dev/null +++ b/srcs/requirements/svelte/api_front/public/game/enums.ts @@ -0,0 +1,47 @@ + +enum EventTypes { + // Class Implemented + gameUpdate = 1, + scoreUpdate, + matchEnd, + assignId, + matchmakingComplete, + + // Generic + matchmakingInProgress, + matchStart, + matchNewRound, // unused + matchPause, // unused + matchResume, // unused + + // Client + clientAnnounce, + clientPlayerReady, + clientInput, + +} + +enum InputEnum { + noInput = 0, + up = 1, + down, +} + +enum PlayerSide { + left = 1, + right +} + +enum ClientRole { + player = 1, + spectator +} + +enum MatchOptions { + // binary flags, can be mixed + noOption = 0b0, + multiBalls = 1 << 0, + movingWalls = 1 << 1 +} + +export {EventTypes, InputEnum, PlayerSide, ClientRole, MatchOptions} diff --git a/JEU/src/client/gameLoop.ts b/srcs/requirements/svelte/api_front/public/game/gameLoop.ts similarity index 100% rename from JEU/src/client/gameLoop.ts rename to srcs/requirements/svelte/api_front/public/game/gameLoop.ts diff --git a/JEU/src/client/global.ts b/srcs/requirements/svelte/api_front/public/game/global.ts similarity index 100% rename from JEU/src/client/global.ts rename to srcs/requirements/svelte/api_front/public/game/global.ts diff --git a/JEU/src/client/handleInput.ts b/srcs/requirements/svelte/api_front/public/game/handleInput.ts similarity index 100% rename from JEU/src/client/handleInput.ts rename to srcs/requirements/svelte/api_front/public/game/handleInput.ts diff --git a/JEU/src/client/pong.ts b/srcs/requirements/svelte/api_front/public/game/pong.ts similarity index 100% rename from JEU/src/client/pong.ts rename to srcs/requirements/svelte/api_front/public/game/pong.ts diff --git a/JEU/src/shared_js/utils.ts b/srcs/requirements/svelte/api_front/public/game/utils copy.ts similarity index 100% rename from JEU/src/shared_js/utils.ts rename to srcs/requirements/svelte/api_front/public/game/utils copy.ts diff --git a/JEU/src/client/utils.ts b/srcs/requirements/svelte/api_front/public/game/utils.ts similarity index 100% rename from JEU/src/client/utils.ts rename to srcs/requirements/svelte/api_front/public/game/utils.ts diff --git a/srcs/requirements/svelte/api_front/public/game/wallsMovement.ts b/srcs/requirements/svelte/api_front/public/game/wallsMovement.ts new file mode 100644 index 00000000..dbf3f558 --- /dev/null +++ b/srcs/requirements/svelte/api_front/public/game/wallsMovement.ts @@ -0,0 +1,20 @@ + +import * as c from "./constants.js"; +import { MovingRectangle } from "../shared_js/class/Rectangle.js"; +import { GameComponents } from "./class/GameComponents.js"; + +function wallsMovements(delta: number, gc: GameComponents) +{ + const wallTop = gc.wallTop; + const wallBottom = gc.wallBottom; + if (wallTop.pos.y <= 0 || wallTop.pos.y >= c.movingWallPosMax) { + wallTop.dir.y *= -1; + } + if (wallBottom.pos.y >= c.h-c.wallSize || wallBottom.pos.y <= c.h-c.movingWallPosMax) { + wallBottom.dir.y *= -1; + } + wallTop.moveAndCollide(delta, [gc.playerLeft, gc.playerRight]); + wallBottom.moveAndCollide(delta, [gc.playerLeft, gc.playerRight]); +} + +export {wallsMovements} diff --git a/JEU/src/client/ws.ts b/srcs/requirements/svelte/api_front/public/game/ws.ts similarity index 100% rename from JEU/src/client/ws.ts rename to srcs/requirements/svelte/api_front/public/game/ws.ts diff --git a/JEU/www/sound/pong/0.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/0.ogg similarity index 100% rename from JEU/www/sound/pong/0.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/0.ogg diff --git a/JEU/www/sound/pong/1.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/1.ogg similarity index 100% rename from JEU/www/sound/pong/1.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/1.ogg diff --git a/JEU/www/sound/pong/10.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/10.ogg similarity index 100% rename from JEU/www/sound/pong/10.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/10.ogg diff --git a/JEU/www/sound/pong/11.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/11.ogg similarity index 100% rename from JEU/www/sound/pong/11.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/11.ogg diff --git a/JEU/www/sound/pong/12.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/12.ogg similarity index 100% rename from JEU/www/sound/pong/12.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/12.ogg diff --git a/JEU/www/sound/pong/13.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/13.ogg similarity index 100% rename from JEU/www/sound/pong/13.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/13.ogg diff --git a/JEU/www/sound/pong/14.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/14.ogg similarity index 100% rename from JEU/www/sound/pong/14.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/14.ogg diff --git a/JEU/www/sound/pong/15.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/15.ogg similarity index 100% rename from JEU/www/sound/pong/15.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/15.ogg diff --git a/JEU/www/sound/pong/16.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/16.ogg similarity index 100% rename from JEU/www/sound/pong/16.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/16.ogg diff --git a/JEU/www/sound/pong/17.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/17.ogg similarity index 100% rename from JEU/www/sound/pong/17.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/17.ogg diff --git a/JEU/www/sound/pong/18.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/18.ogg similarity index 100% rename from JEU/www/sound/pong/18.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/18.ogg diff --git a/JEU/www/sound/pong/19.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/19.ogg similarity index 100% rename from JEU/www/sound/pong/19.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/19.ogg diff --git a/JEU/www/sound/pong/2.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/2.ogg similarity index 100% rename from JEU/www/sound/pong/2.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/2.ogg diff --git a/JEU/www/sound/pong/20.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/20.ogg similarity index 100% rename from JEU/www/sound/pong/20.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/20.ogg diff --git a/JEU/www/sound/pong/21.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/21.ogg similarity index 100% rename from JEU/www/sound/pong/21.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/21.ogg diff --git a/JEU/www/sound/pong/22.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/22.ogg similarity index 100% rename from JEU/www/sound/pong/22.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/22.ogg diff --git a/JEU/www/sound/pong/23.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/23.ogg similarity index 100% rename from JEU/www/sound/pong/23.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/23.ogg diff --git a/JEU/www/sound/pong/24.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/24.ogg similarity index 100% rename from JEU/www/sound/pong/24.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/24.ogg diff --git a/JEU/www/sound/pong/25.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/25.ogg similarity index 100% rename from JEU/www/sound/pong/25.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/25.ogg diff --git a/JEU/www/sound/pong/26.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/26.ogg similarity index 100% rename from JEU/www/sound/pong/26.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/26.ogg diff --git a/JEU/www/sound/pong/27.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/27.ogg similarity index 100% rename from JEU/www/sound/pong/27.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/27.ogg diff --git a/JEU/www/sound/pong/28.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/28.ogg similarity index 100% rename from JEU/www/sound/pong/28.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/28.ogg diff --git a/JEU/www/sound/pong/29.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/29.ogg similarity index 100% rename from JEU/www/sound/pong/29.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/29.ogg diff --git a/JEU/www/sound/pong/3.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/3.ogg similarity index 100% rename from JEU/www/sound/pong/3.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/3.ogg diff --git a/JEU/www/sound/pong/30.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/30.ogg similarity index 100% rename from JEU/www/sound/pong/30.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/30.ogg diff --git a/JEU/www/sound/pong/31.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/31.ogg similarity index 100% rename from JEU/www/sound/pong/31.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/31.ogg diff --git a/JEU/www/sound/pong/32.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/32.ogg similarity index 100% rename from JEU/www/sound/pong/32.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/32.ogg diff --git a/JEU/www/sound/pong/4.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/4.ogg similarity index 100% rename from JEU/www/sound/pong/4.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/4.ogg diff --git a/JEU/www/sound/pong/5.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/5.ogg similarity index 100% rename from JEU/www/sound/pong/5.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/5.ogg diff --git a/JEU/www/sound/pong/6.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/6.ogg similarity index 100% rename from JEU/www/sound/pong/6.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/6.ogg diff --git a/JEU/www/sound/pong/7.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/7.ogg similarity index 100% rename from JEU/www/sound/pong/7.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/7.ogg diff --git a/JEU/www/sound/pong/8.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/8.ogg similarity index 100% rename from JEU/www/sound/pong/8.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/8.ogg diff --git a/JEU/www/sound/pong/9.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/pong/9.ogg similarity index 100% rename from JEU/www/sound/pong/9.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/pong/9.ogg diff --git a/JEU/www/sound/roblox-oof.ogg b/srcs/requirements/svelte/api_front/public/sounds/sound/roblox-oof.ogg similarity index 100% rename from JEU/www/sound/roblox-oof.ogg rename to srcs/requirements/svelte/api_front/public/sounds/sound/roblox-oof.ogg diff --git a/srcs/requirements/svelte/api_front/src/pages/game/Game.svelte b/srcs/requirements/svelte/api_front/src/pages/game/Game.svelte new file mode 100644 index 00000000..4a4741b1 --- /dev/null +++ b/srcs/requirements/svelte/api_front/src/pages/game/Game.svelte @@ -0,0 +1,99 @@ + + + + + + + + + +
.
+ +
+
+ game options +
+ + +
+
+ + +
+
+ + + + + +
+
+ +
+
+
+ +
+ +
+ + + + + diff --git a/srcs/requirements/svelte/api_front/tsconfig.json b/srcs/requirements/svelte/api_front/tsconfig.json index b082e968..8dec1621 100644 --- a/srcs/requirements/svelte/api_front/tsconfig.json +++ b/srcs/requirements/svelte/api_front/tsconfig.json @@ -1,6 +1,6 @@ { "extends": "@tsconfig/svelte/tsconfig.json", - "include": ["src/**/*"], + "include": ["src/**/*", "public/game"], "exclude": ["node_modules/*", "__sapper__/*", "public/*"] -} \ No newline at end of file +}