Added ClassiCube
1
.gitignore
vendored
@@ -21,6 +21,7 @@ public/Users/Public/**
|
||||
!public/Users/Public/Start Menu/Emulators
|
||||
!public/Users/Public/Start Menu/Emulators/*.url
|
||||
!public/Users/Public/Start Menu/Games
|
||||
!public/Users/Public/Start Menu/Games/ClassiCube.url
|
||||
!public/Users/Public/Start Menu/Games/Space Cadet.url
|
||||
!public/Users/Public/Videos
|
||||
!public/Users/Public/Videos/Make an OS with ReactJS & Next.js
|
||||
|
||||
13
components/apps/ClassiCube/StyledClassiCube.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import styled from "styled-components";
|
||||
|
||||
const StyledClassiCube = styled.div`
|
||||
height: ${({ theme }) => `calc(100% - ${theme.sizes.titleBar.height}px)`};
|
||||
width: 100%;
|
||||
|
||||
canvas {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
`;
|
||||
|
||||
export default StyledClassiCube;
|
||||
16
components/apps/ClassiCube/index.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import AppContainer from "components/apps/AppContainer";
|
||||
import StyledClassiCube from "components/apps/ClassiCube/StyledClassiCube";
|
||||
import useClassiCube from "components/apps/ClassiCube/useClassiCube";
|
||||
import type { ComponentProcessProps } from "components/system/Apps/RenderComponent";
|
||||
|
||||
const ClassiCube: FC<ComponentProcessProps> = ({ id }) => (
|
||||
<AppContainer
|
||||
StyledComponent={StyledClassiCube}
|
||||
id={id}
|
||||
useHook={useClassiCube}
|
||||
>
|
||||
<canvas />
|
||||
</AppContainer>
|
||||
);
|
||||
|
||||
export default ClassiCube;
|
||||
61
components/apps/ClassiCube/useClassiCube.ts
Normal file
@@ -0,0 +1,61 @@
|
||||
import { useProcesses } from "contexts/process";
|
||||
import { useCallback, useEffect } from "react";
|
||||
import { TRANSITIONS_IN_MILLISECONDS } from "utils/constants";
|
||||
import { loadFiles } from "utils/functions";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
CCModule: {
|
||||
arguments: string[];
|
||||
canvas: HTMLCanvasElement;
|
||||
postRun: (() => void)[];
|
||||
print: () => void;
|
||||
setStatus: () => void;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const useClassiCube = (
|
||||
id: string,
|
||||
_url: string,
|
||||
containerRef: React.MutableRefObject<HTMLDivElement | null>,
|
||||
setLoading: React.Dispatch<React.SetStateAction<boolean>>
|
||||
): void => {
|
||||
const { processes: { [id]: process } = {} } = useProcesses();
|
||||
const { libs } = process || {};
|
||||
const getCanvas = useCallback(
|
||||
() =>
|
||||
(containerRef.current as HTMLElement)?.querySelector(
|
||||
"canvas"
|
||||
) as HTMLCanvasElement,
|
||||
[containerRef]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (window.CCModule) return;
|
||||
|
||||
setTimeout(() => {
|
||||
const canvas = getCanvas();
|
||||
|
||||
window.CCModule = {
|
||||
arguments: ["Singleplayer"],
|
||||
canvas,
|
||||
postRun: [
|
||||
() => setLoading(false),
|
||||
() => {
|
||||
const { width, height } = canvas.getBoundingClientRect() || {};
|
||||
|
||||
canvas.width = width;
|
||||
canvas.height = height;
|
||||
},
|
||||
],
|
||||
print: console.info,
|
||||
setStatus: console.info,
|
||||
};
|
||||
|
||||
loadFiles(libs);
|
||||
}, TRANSITIONS_IN_MILLISECONDS.WINDOW);
|
||||
}, [getCanvas, libs, setLoading]);
|
||||
};
|
||||
|
||||
export default useClassiCube;
|
||||
@@ -30,6 +30,7 @@ const KEYVAL_STORE_NAME = "keyval";
|
||||
const KEYVAL_DB = `${KEYVAL_STORE_NAME}-store`;
|
||||
|
||||
const KNOWN_IDB_DBS = [
|
||||
"/classicube",
|
||||
"/data/saves",
|
||||
"ejs-bios",
|
||||
"ejs-roms",
|
||||
|
||||
@@ -32,6 +32,18 @@ const directory: Processes = {
|
||||
icon: "/System/Icons/chromium.webp",
|
||||
title: "Browser",
|
||||
},
|
||||
ClassiCube: {
|
||||
Component: dynamic(() => import("components/apps/ClassiCube")),
|
||||
allowResizing: false,
|
||||
backgroundColor: "#201E20",
|
||||
defaultSize: {
|
||||
height: 420,
|
||||
width: 700,
|
||||
},
|
||||
icon: "/System/Icons/classicube.webp",
|
||||
libs: ["/Program Files/ClassiCube/ClassiCube.js"],
|
||||
title: "ClassiCube",
|
||||
},
|
||||
DXBall: {
|
||||
Component: dynamic(() => import("components/apps/DX-Ball")),
|
||||
backgroundColor: "#000",
|
||||
|
||||
@@ -73,6 +73,7 @@ This project is greatly augmented by code from the open source community. Thank
|
||||
- [jspaint](https://github.com/1j01/jspaint)
|
||||
- [Print.js](https://github.com/crabbly/print.js)
|
||||
- [Kiwi IRC](https://github.com/kiwiirc/kiwiirc)
|
||||
- [ClassiCube](https://github.com/UnknownShadow200/ClassiCube)
|
||||
|
||||
## Services
|
||||
|
||||
|
||||
107835
public/Program Files/ClassiCube/ClassiCube.js
Normal file
BIN
public/Program Files/ClassiCube/default.zip
Normal file
BIN
public/Program Files/ClassiCube/skin/Singleplayer.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
public/System/Icons/144x144/classicube.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
BIN
public/System/Icons/144x144/classicube.webp
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
public/System/Icons/16x16/classicube.png
Normal file
|
After Width: | Height: | Size: 212 B |
BIN
public/System/Icons/16x16/classicube.webp
Normal file
|
After Width: | Height: | Size: 176 B |
BIN
public/System/Icons/32x32/classicube.png
Normal file
|
After Width: | Height: | Size: 466 B |
BIN
public/System/Icons/32x32/classicube.webp
Normal file
|
After Width: | Height: | Size: 396 B |
BIN
public/System/Icons/48x48/classicube.png
Normal file
|
After Width: | Height: | Size: 713 B |
BIN
public/System/Icons/48x48/classicube.webp
Normal file
|
After Width: | Height: | Size: 620 B |
BIN
public/System/Icons/96x96/classicube.png
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
BIN
public/System/Icons/96x96/classicube.webp
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
3
public/Users/Public/Start Menu/Games/ClassiCube.url
Normal file
@@ -0,0 +1,3 @@
|
||||
[InternetShortcut]
|
||||
BaseURL=ClassiCube
|
||||
Comment=Minecraft Classic 0.30
|
||||