File tree Expand file tree Collapse file tree 11 files changed +109
-46
lines changed
Expand file tree Collapse file tree 11 files changed +109
-46
lines changed Original file line number Diff line number Diff line change 33 "version" : " 0.1.0" ,
44 "private" : true ,
55 "dependencies" : {
6+ "@react-three/fiber" : " ^8.0.27" ,
67 "@testing-library/jest-dom" : " ^5.16.4" ,
78 "@testing-library/react" : " ^13.3.0" ,
89 "@testing-library/user-event" : " ^13.5.0" ,
10+ "csstype" : " ^3.1.0" ,
911 "react" : " ^18.2.0" ,
1012 "react-dom" : " ^18.2.0" ,
1113 "react-router" : " ^6.3.0" ,
1214 "react-router-dom" : " ^6.3.0" ,
13- "react-three-fiber" : " ^6.0.13" ,
1415 "rsuite" : " ^5.16.0" ,
1516 "web-vitals" : " ^2.1.4"
1617 },
Original file line number Diff line number Diff line change 11import './App.css' ;
22import React , { Component } from 'react' ;
3- import { Canvas } from 'react-three- fiber' ;
3+ import { Canvas , useFrame } from '@ react-three/ fiber' ;
44
55import { Strategy /*changeRed*/ } from './components/Strategy/Strategy' ;
66import { InputField } from './components/Canvas/InputField.js' ;
@@ -13,6 +13,7 @@ import Footer from './components/Page/partial/Footer';
1313import SplashScreen from './components/Page/Splash/SplashScreen' ;
1414import Box from './modals/cube/Box' ;
1515import AppRouter from './AppRouter' ;
16+ import Cell from './components/Board/Cell' ;
1617
1718
1819
@@ -30,15 +31,21 @@ class App extends Component {
3031 render ( ) {
3132
3233 return (
33- < >
34- < div className = "App" >
35- < AppRouter />
34+ /*<div className = "App">
3635
37- </ div >
36+ <AppRouter/ >
3837
39- </ >
40- ) ;
38+ </div>*/
4139
40+ // TESTING PURPOSES: CELL COMPONENT
41+ < Canvas >
42+ < Cell id = { 1 }
43+ value = { 1 }
44+ size = { 1 }
45+ position = { [ 0 , 0 , 0 ] }
46+ />
47+ </ Canvas >
48+ ) ;
4249 }
4350}
4451
Original file line number Diff line number Diff line change 1+ import { Component } from 'react' ;
2+ import { Canvas , useFrame } from '@react-three/fiber' ;
3+
4+
5+
6+ export class Display extends Component {
7+ constructor ( fArgs ) {
8+ super ( fArgs ) ;
9+ this . state = {
10+ displayType : fArgs . displayType ,
11+ algorithm : fArgs . algorithm ,
12+ dataString : fArgs . dataString ,
13+ width : fArgs . innerWidth ,
14+ height : fArgs . innerHeight ,
15+ aspect : fArgs . aspect ,
16+ perspective : fArgs . perspective ,
17+ } ;
18+ }
19+
20+
21+ componentDidMount ( ) {
22+ window . addEventListener ( 'resize' , this . handleWindowSizeChange ) ;
23+ }
24+
25+
26+ componentWillUnmount ( ) {
27+ window . removeEventListener ( 'resize' , this . handleWindowSizeChange ) ;
28+ }
29+
30+
31+ handleWindowSizeChange = ( ) => {
32+ this . setState ( { width : window . innerWidth , height : window . innerHeight } ) ;
33+ } ;
34+
35+
36+ render ( ) {
37+ const { width, height} = this . state ;
38+ const aspect = width / height ;
39+ return (
40+ < Canvas children = { } >
41+
42+ </ Canvas >
43+ ) ;
44+ } ;
45+ }
Original file line number Diff line number Diff line change @@ -50,8 +50,8 @@ class MiniMax {
5050 return 0 ;
5151 }
5252
53- var board = new Board ( grid ) ;
54- var leaves = new Move [ 10 ] ;
53+ var board = new Board ( grid ) ;
54+ let leaves : Move [ ] = new Move [ 10 ] ;
5555
5656 //
5757 for ( var iter = 0 ; iter < leaves . length ; iter ++ ) {
@@ -60,7 +60,7 @@ class MiniMax {
6060 }
6161 }
6262
63- var bestMove = null ;
63+ let bestMove : Move = null ;
6464 for ( var i = 0 ; i < leaves . length ; i ++ ) {
6565 if ( bestMove == null ) {
6666 // bestMove = moves[i];
Original file line number Diff line number Diff line change 1+ import { Component } from 'react' ;
2+ import Box from '../../modals/cube/Box' ;
3+
4+
5+
6+ const Cell = ( fArgs ) => {
7+ const id = fArgs . id ;
8+ const value = fArgs . value ;
9+ const onClick = fArgs . onClick ;
10+ return (
11+ < Box size = { fArgs . size } />
12+ ) ;
13+
14+ } ;
15+
16+ export default Cell ;
Original file line number Diff line number Diff line change 11import React from 'react' ;
22import './splash.css' ;
33import Navigation from '../partial/Navbar/Navigation' ;
4+ import Cell from '../../Board/Cell' ;
45
56
67
You can’t perform that action at this time.
0 commit comments