-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/C2DH/zoomland
- Loading branch information
Showing
14 changed files
with
162 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
.GameControls { | ||
position: fixed; | ||
z-index: var(--z-index-game-controls); | ||
background: var(--dark-blue-alpha); | ||
border-radius: var(--small-border-radius); | ||
|
||
width: 50%; | ||
top: 150px; | ||
left: 50%; | ||
margin-left: -25%; | ||
color: var(--pale-yellow); | ||
} | ||
|
||
.GameControls button { | ||
border: 0 none; | ||
color: var(--pale-yellow); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { useSpring, a } from '@react-spring/web' | ||
import { MenuClosed, useMenuStore } from '../store' | ||
import './GameControls.css' | ||
import { useEffect } from 'react' | ||
|
||
const GameControls = () => { | ||
const [gameControlsStatus, setGameControlsStatus] = useMenuStore((state) => [ | ||
state.gameControlsStatus, | ||
state.setGameControlsStatus, | ||
]) | ||
|
||
const [style, api] = useSpring(() => ({ | ||
opacity: 0, | ||
})) | ||
|
||
const hide = () => { | ||
setGameControlsStatus(MenuClosed) | ||
} | ||
|
||
useEffect(() => { | ||
api.start({ | ||
opacity: gameControlsStatus === MenuClosed ? 0 : 1, | ||
}) | ||
}, [gameControlsStatus]) | ||
|
||
return ( | ||
<a.div style={style} className="GameControls p-5"> | ||
GameControls | ||
<button className="btn btn-link btn-lg" onClick={hide}> | ||
Got it! | ||
</button> | ||
</a.div> | ||
) | ||
} | ||
|
||
export default GameControls |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,18 @@ Command: npx [email protected] public/models/Landscape.gltf | |
|
||
import { useGLTF } from '@react-three/drei' | ||
import { RigidBody, CuboidCollider } from '@react-three/rapier' | ||
import { useQueueStore } from '../store/preload' | ||
import { useEffect } from 'react' | ||
|
||
const Landscape = ({ debug = false, ...props }) => { | ||
const { nodes, materials } = useGLTF('../assets/models/Landscape.glb') | ||
const addToLoaded = useQueueStore((state) => state.addToLoaded) | ||
|
||
useEffect(() => { | ||
console.debug('[Landscape] loaded') | ||
addToLoaded('Landscape') | ||
}, []) | ||
|
||
return ( | ||
<> | ||
{/* {debug && <Debug />*/} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { create } from 'zustand' | ||
|
||
const Expected = ['Landscape', 'IcescreamTruck'] | ||
|
||
export const useQueueStore = create((set, get) => ({ | ||
loaded: [], | ||
isLoadingComplete: false, | ||
addToLoaded: (key) => { | ||
// if key is in loaded already, ignore | ||
const loaded = get().loaded | ||
if (loaded.includes(key)) return | ||
const isLoadingComplete = loaded.length + 1 === Expected.length | ||
console.debug( | ||
'[useQueueStore] addToLoaded:', | ||
key, | ||
'isLoadingComplete', | ||
isLoadingComplete, | ||
'time', | ||
new Date().getTime(), | ||
) | ||
return set({ | ||
loaded: [...loaded, key], | ||
isLoadingComplete: loaded.length + 1 === Expected.length, | ||
}) | ||
}, | ||
})) |