Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev/collision #52

Merged
merged 15 commits into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions h24s_25/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ function save() {
game.data.save("test")
}
function load() {
game.data.load("test").then((data) => {
game.data.load("test").then(() => {
game.edit()
})
}
Expand All @@ -25,6 +25,14 @@ function load() {
<div class="gamespace" id="screen">
</div>
<div class="control-panel left">
<div class="play-edit-container">
<button id="play-button" @click="play()">Play</button>
<button id="edit-button" @click="edit()">Edit</button>
</div>
<div class="save-load-container">
<button id="save-button" @click="save()">Save</button>
<button id="load-button" @click="load()">Load</button>
</div>
<div class="slider-container">
<p>スライダ1</p>
<input class="slider" type="range" id="slider1" min="0" max="100" step="5">
Expand All @@ -39,14 +47,6 @@ function load() {
<div class="checkbox-container">
<input class="ckeckbox" type="checkbox" id="checkbox2" /> <label for="checkbox2">チェックボックス2</label>
</div>
<div class="play-edit-container">
<button id="play-button" @click="play()">Play</button>
<button id="edit-button" @click="edit()">Edit</button>
</div>
<div class="save-load-container">
<button id="save-button" @click="save()">Save</button>
<button id="load-button" @click="load()">Load</button>
</div>
</div>
</div>
</template>
Expand Down
3 changes: 1 addition & 2 deletions h24s_25/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import './assets/main.css'
import Matter, {Events, Mouse, MouseConstraint, Vector} from 'matter-js'

import { createApp } from 'vue'
import App from './App.vue'
Expand Down Expand Up @@ -29,5 +28,5 @@ export const app = initializeApp(firebaseConfig);
export const db = getFirestore(app)

//画面の初期化
export const game = new Screen(true);
export const game = Screen.getInstance(false)
game.init();
13 changes: 13 additions & 0 deletions h24s_25/src/ts/ball/OutputBallImpl.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {OutputBallInterface} from "@/ts/ballInterface";

export class OutputBallImpl extends OutputBallInterface {
override outputIndex: number
constructor(outputIndex: number) {
super();
this.outputIndex = outputIndex
}

override label(): string {
return "out" + this.outputIndex;
}
}
23 changes: 0 additions & 23 deletions h24s_25/src/ts/ball/binaryEqualBall.ts

This file was deleted.

22 changes: 0 additions & 22 deletions h24s_25/src/ts/ball/binaryGreaterThanBall.ts

This file was deleted.

21 changes: 0 additions & 21 deletions h24s_25/src/ts/ball/binaryGreaterThanOrEqualBall.ts

This file was deleted.

21 changes: 0 additions & 21 deletions h24s_25/src/ts/ball/binaryLessThanBall.ts

This file was deleted.

21 changes: 0 additions & 21 deletions h24s_25/src/ts/ball/binaryLessThanOrequalBall.ts

This file was deleted.

16 changes: 0 additions & 16 deletions h24s_25/src/ts/ball/binaryMultiplyBall.ts

This file was deleted.

21 changes: 0 additions & 21 deletions h24s_25/src/ts/ball/binaryNotEqualBall.ts

This file was deleted.

16 changes: 0 additions & 16 deletions h24s_25/src/ts/ball/binaryPlus.ts

This file was deleted.

13 changes: 13 additions & 0 deletions h24s_25/src/ts/ball/function/FunctionType.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
export const FunctionType = {
BINARY_MINUS: 0,
BINARY_PLUS: 1,
BINARY_MULTIPLY: 2,
BINARY_DIVISION: 3,
BINARY_EQUAL: 4,
BINARY_NOT_EQUAL: 5,
BINARY_GREATER_THAN: 6,
BINARY_GREATER_THAN_OR_EQUAL: 7,
BINARY_LESS_THAN: 8,
BINARY_LESS_THAN_OR_EQUAL: 9,
TERNARY_CONDITIONAL: 10,
}
35 changes: 35 additions & 0 deletions h24s_25/src/ts/ball/function/binaryDivisionBall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { FunctionBall } from '@/ts/ballfunction'
import {FunctionBallInterface, type NumberBallInterface} from "@/ts/ballInterface";
import {NumberBall} from "@/ts/numberball";

export class BinaryDivisionBall extends FunctionBall<BinaryDivisionBall|null, DivisionBall> {
constructor(removeSelf: boolean = false) {
super(
(x) => {
return {self: removeSelf ? null : this, other:new DivisionBall(x.value(),removeSelf)}
}
, "/", []
)
}
}

class DivisionBall extends FunctionBallInterface<DivisionBall|null, NumberBallInterface> {
private x: number;
private funcVal: (x: NumberBallInterface) => {self: DivisionBall|null, other: NumberBallInterface}

constructor(x: number, removeSelf: boolean) {
super();
this.funcVal = (y) => {
return {self: removeSelf ? null : this, other: new NumberBall(x/y.value())}
}
this.x = x;
}

override func(x: NumberBallInterface): { self: DivisionBall|null; other: NumberBallInterface } {
return this.funcVal(x);
}

label(): string {
return this.x.toString() + "/";
}
}
35 changes: 35 additions & 0 deletions h24s_25/src/ts/ball/function/binaryEqualBall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { FunctionBall } from '@/ts/ballfunction'
import {FunctionBallInterface, type NumberBallInterface} from "@/ts/ballInterface";
import {NumberBall} from "@/ts/numberball";

export class BinaryEqualBall extends FunctionBall<BinaryEqualBall|null, EqualBall> {
constructor(removeSelf: boolean = false) {
super(
(x) => {
return {self: removeSelf ? null : this, other:new EqualBall(x.value(),removeSelf)}
}
, "==", []
)
}
}

class EqualBall extends FunctionBallInterface<EqualBall|null, NumberBallInterface> {
private x: number;
private funcVal: (x: NumberBallInterface) => {self: EqualBall|null, other: NumberBallInterface}

constructor(x: number, removeSelf: boolean) {
super();
this.funcVal = (y) => {
return {self: removeSelf ? null : this, other: new NumberBall(x==y.value() ? 1 : 0)}
}
this.x = x;
}

override func(x: NumberBallInterface): { self: EqualBall|null; other: NumberBallInterface } {
return this.funcVal(x);
}

label(): string {
return this.x.toString() + "==";
}
}
35 changes: 35 additions & 0 deletions h24s_25/src/ts/ball/function/binaryGreaterThanBall.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { FunctionBall } from '@/ts/ballfunction'
import {FunctionBallInterface, type NumberBallInterface} from "@/ts/ballInterface";
import {NumberBall} from "@/ts/numberball";

export class BinaryGreaterThanBall extends FunctionBall<BinaryGreaterThanBall|null, GreaterThanBall> {
constructor(removeSelf: boolean = false) {
super(
(x) => {
return {self: removeSelf ? null : this, other:new GreaterThanBall(x.value(),removeSelf)}
}
, ">", []
)
}
}

class GreaterThanBall extends FunctionBallInterface<GreaterThanBall|null, NumberBallInterface> {
private x: number;
private funcVal: (x: NumberBallInterface) => {self: GreaterThanBall|null, other: NumberBallInterface}

constructor(x: number, removeSelf: boolean) {
super();
this.funcVal = (y) => {
return {self: removeSelf ? null : this, other: new NumberBall(x>y.value() ? 1 : 0)}
}
this.x = x;
}

override func(x: NumberBallInterface): { self: GreaterThanBall|null; other: NumberBallInterface } {
return this.funcVal(x);
}

label(): string {
return this.x.toString() + ">";
}
}
Loading
Loading