WIP: No idea what exactly i did over those past 2 days
This commit is contained in:
+1
-1
@@ -4,7 +4,7 @@ import Rigidbody2D from '../rigidbody/rigidbody2d';
|
||||
export class AABB {
|
||||
private size: Vector2 = new Vector2();
|
||||
private halfSize: Vector2 = new Vector2();
|
||||
private rigidbody: Rigidbody2D | null = null;
|
||||
private rigidbody: Rigidbody2D = new Rigidbody2D();
|
||||
|
||||
constructor(min?: Vector2, max?: Vector2) {
|
||||
if (min !== undefined && max !== undefined) this.size = new Vector2(max).sub(min);
|
||||
+6
-2
@@ -1,10 +1,10 @@
|
||||
import Vector2 from '$lib/vector';
|
||||
import type Rigidbody2D from '../rigidbody/rigidbody2d';
|
||||
import Rigidbody2D from '../rigidbody/rigidbody2d';
|
||||
|
||||
export class Box2D {
|
||||
private size: Vector2 = new Vector2();
|
||||
private halfSize: Vector2 = new Vector2();
|
||||
private rigidbody: Rigidbody2D | null = null;
|
||||
private rigidbody: Rigidbody2D = new Rigidbody2D();
|
||||
|
||||
constructor();
|
||||
constructor(min?: Vector2, max?: Vector2) {
|
||||
@@ -44,6 +44,10 @@ export class Box2D {
|
||||
public get getRigidbody(): Rigidbody2D {
|
||||
return this.rigidbody;
|
||||
}
|
||||
|
||||
public get getHalfSize(): Vector2 {
|
||||
return this.halfSize;
|
||||
}
|
||||
}
|
||||
|
||||
export default Box2D;
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
import type Vector2 from '$lib/vector';
|
||||
import type Rigidbody2D from '../rigidbody/rigidbody2d';
|
||||
import Rigidbody2D from '../rigidbody/rigidbody2d';
|
||||
|
||||
class Circle {
|
||||
private radius: number = 1.0;
|
||||
private rigidbody: Rigidbody2D;
|
||||
private rigidbody: Rigidbody2D = new Rigidbody2D();
|
||||
|
||||
public get Radius(): number {
|
||||
return this.radius;
|
||||
+51
-1
@@ -1,4 +1,4 @@
|
||||
import Line2D from '$lib/shimeji/renderer/line2d';
|
||||
import Line2D from '$lib/shimagic/renderer/line2d';
|
||||
import Vector2 from '$lib/vector';
|
||||
import VMath from '$lib/vmath';
|
||||
import AABB from '../primitives/aabb';
|
||||
@@ -177,7 +177,57 @@ class IntersectionDetector2D {
|
||||
return true;
|
||||
} else {
|
||||
//TODO: Box2D implementation
|
||||
|
||||
RaycastResult.reset(result);
|
||||
|
||||
const halfSize: Vector2 = primitive.getHalfSize;
|
||||
|
||||
const xAxis: Vector2 = new Vector2(1, 0);
|
||||
const yAxis: Vector2 = new Vector2(0, 1);
|
||||
VMath.rotate(xAxis, primitive.getRigidbody.Rotation, Vector2.zero);
|
||||
VMath.rotate(yAxis, primitive.getRigidbody.Rotation, Vector2.zero);
|
||||
|
||||
const p: Vector2 = new Vector2(primitive.getRigidbody.Position).sub(ray.Origin);
|
||||
const f: Vector2 = new Vector2(xAxis.dot(ray.Direction), yAxis.dot(ray.Direction));
|
||||
const e: Vector2 = new Vector2(xAxis.dot(p), yAxis.dot(p));
|
||||
|
||||
const tArr: number[] = [0, 0, 0, 0];
|
||||
if (VMath.compare(f.x, 0)) {
|
||||
if (-e.x - halfSize.x > 0 || -e.x + halfSize.x < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
f.x = 0.00001;
|
||||
tArr[0 * 2 + 0] = e.x + halfSize.x / f.x;
|
||||
tArr[0 * 2 + 1] = e.x - halfSize.x / f.x;
|
||||
|
||||
if (VMath.compare(f.y, 0)) {
|
||||
if (-e.y - halfSize.y > 0 || -e.y + halfSize.y < 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
f.y = 0.00001;
|
||||
tArr[1 * 2 + 0] = e.y + halfSize.y / f.y;
|
||||
tArr[1 * 2 + 1] = e.x - halfSize.x / f.x;
|
||||
|
||||
const tmin: number = Math.max(Math.min(tArr[0], tArr[1]), Math.min(tArr[2], tArr[3]));
|
||||
const tmax: number = Math.min(Math.max(tArr[0], tArr[1]), Math.max(tArr[2], tArr[3]));
|
||||
|
||||
const t = tmin < 0 ? tmax : tmin;
|
||||
const hit: boolean = t > 0; //&& t * t < ray.Distance;
|
||||
if (!hit) return false;
|
||||
|
||||
if (result != null) {
|
||||
const point: Vector2 = new Vector2(ray.Origin).add(new Vector2(ray.Direction).mul(t));
|
||||
const normal: Vector2 = new Vector2(ray.Origin).sub(point);
|
||||
normal.normalize();
|
||||
|
||||
result.init(point, normal, t, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static circleAndLine()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
import { WebG } from './renderer/web_g_engine';
|
||||
|
||||
export namespace Shimagic {
|
||||
export class Shimeji {
|
||||
private WebGEngine: WebG.Engine;
|
||||
//private PhysisEngine: Physis.Engine;
|
||||
private size!: number;
|
||||
|
||||
private AnimID: number | null = null;
|
||||
private pDeltaT: number = 0;
|
||||
|
||||
constructor(webgengine: WebG.Engine /* physis: Physis.Engine */) {
|
||||
this.WebGEngine = webgengine;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method: Initializes all sub-systems like WebG & Physis aswell as initializes the Shimeji and starts its animation
|
||||
* @async
|
||||
* @public
|
||||
* @param {ShimejiConfig} config - Shimeji configuration
|
||||
* @returns {Promise<Shimeji>} that resolves when the Shimeji is done initializing
|
||||
*/
|
||||
public static async Initialize(config: ShimejiConfig): Promise<Shimeji> {
|
||||
const webg = await WebG.Engine.Initialize(config.webG);
|
||||
//const physis = await Physis.Engine.Initialize(config.physis);
|
||||
|
||||
const shimeji = new Shimeji(webg);
|
||||
shimeji.size = config.size;
|
||||
|
||||
const AFrame = (delta: number) => {
|
||||
shimeji.pDeltaT = delta;
|
||||
shimeji.AnimID = requestAnimationFrame(shimeji._anim);
|
||||
};
|
||||
|
||||
shimeji.AnimID = requestAnimationFrame(AFrame);
|
||||
|
||||
return shimeji;
|
||||
}
|
||||
|
||||
private _anim(delta: number) {
|
||||
let dt = (delta - this.pDeltaT) / 1000;
|
||||
dt = Math.min(dt, 0.05 /* * this.Physis.TIMESCALE */);
|
||||
this.pDeltaT = delta;
|
||||
|
||||
this.UpdatePhysics(dt);
|
||||
this.UpdateFrame(dt);
|
||||
|
||||
this.AnimID = requestAnimationFrame(this._anim);
|
||||
}
|
||||
|
||||
/**
|
||||
* A function called automatically every "frame" where the code for calculating the next physics frame of the Shimeji is placed
|
||||
* @param delta - Automatically passed in deltaT value;
|
||||
*/
|
||||
private UpdatePhysics(delta: number): void {}
|
||||
|
||||
/**
|
||||
* A function called automatically every "frame" where the code for drawing the next frame of the Shimeji is placed
|
||||
* @param delta - Automatically passed in deltaT value;
|
||||
*/
|
||||
private UpdateFrame(delta: number): void {}
|
||||
}
|
||||
|
||||
interface ShimejiConfig {
|
||||
sprite: string; //temp soultion to
|
||||
size: number;
|
||||
webG: WebG.EngineConfig;
|
||||
//physis: Physis.EngineConfig;
|
||||
}
|
||||
}
|
||||
@@ -25,6 +25,8 @@ export type CommandResultData = {
|
||||
args?: CommandArgs;
|
||||
};
|
||||
|
||||
TermOS.Shell.Command.
|
||||
|
||||
export const COMMANDS = {
|
||||
cd,
|
||||
ls,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import type { Bash } from "./bash";
|
||||
import type { User } from "./etc/userData";
|
||||
import type { Permission, TimeStamps } from "./metadata";
|
||||
import type { User } from './etc/userData';
|
||||
import type { Permission, TimeStamps } from './metadata';
|
||||
|
||||
export enum Type {
|
||||
Directory = 16384,
|
||||
@@ -8,7 +7,7 @@ export enum Type {
|
||||
SymbolicLink = 40960
|
||||
}
|
||||
|
||||
export type NodePerms = {
|
||||
export type NodePermission = {
|
||||
user: Permission;
|
||||
group: Permission;
|
||||
other: Permission;
|
||||
@@ -65,8 +64,7 @@ export class VirtualFS {
|
||||
if (!currentNode)
|
||||
throw new Error('could not find the node in the fs table - inodetopathstring');
|
||||
|
||||
if (!currentNode.parent ||
|
||||
currentNode.inode === this.rootINode) {
|
||||
if (!currentNode.parent || currentNode.inode === this.rootINode) {
|
||||
return '/';
|
||||
}
|
||||
|
||||
@@ -157,7 +155,12 @@ export class VirtualFS {
|
||||
return node;
|
||||
}
|
||||
|
||||
public recursiveTraversalPre(node: TreeNode, callback: (param: TreeNode) => void, childIndex?: number[], depthIndex?: number): void {
|
||||
public recursiveTraversalPre(
|
||||
node: TreeNode,
|
||||
callback: (param: TreeNode) => void,
|
||||
childIndex?: number[],
|
||||
depthIndex?: number
|
||||
): void {
|
||||
if (!depthIndex) depthIndex = 0;
|
||||
if (!childIndex) childIndex = [0];
|
||||
|
||||
@@ -167,8 +170,7 @@ export class VirtualFS {
|
||||
if (!childIndex[depthIndex]) childIndex[depthIndex] = 0;
|
||||
|
||||
callback(node);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
node = this.getNodeByINode(node.parent);
|
||||
childIndex[depthIndex] = 0;
|
||||
depthIndex--;
|
||||
@@ -179,4 +181,37 @@ export class VirtualFS {
|
||||
|
||||
this.recursiveTraversalPre(node, callback, childIndex, depthIndex);
|
||||
}
|
||||
|
||||
private _createNode(name: string, type: Type, path: number, user: number): void {
|
||||
let children: null | number[];
|
||||
|
||||
const node: TreeNode = {
|
||||
inode: this.FsTable.size + 1,
|
||||
name: name,
|
||||
type: type,
|
||||
size: 4096, //TODO: Calculate the size from the content
|
||||
children: [],
|
||||
content: '',
|
||||
link: -1,
|
||||
permission: {
|
||||
user: {
|
||||
r: true,
|
||||
w: true,
|
||||
x: false
|
||||
},
|
||||
group: {
|
||||
r: true,
|
||||
w: false,
|
||||
x: false
|
||||
},
|
||||
other: {
|
||||
r: true,
|
||||
w: false,
|
||||
x: false
|
||||
}
|
||||
},
|
||||
owner: user,
|
||||
group:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
//import Renderer from '$lib/shimeji/renderer/renderer';
|
||||
import { WebG } from '$lib/shimeji/renderer/web_g_engine';
|
||||
import { WebG } from '$lib/shimagic/renderer/web_g_engine';
|
||||
import Vector2 from '../vector';
|
||||
|
||||
export class Shimejii {
|
||||
@@ -211,7 +211,7 @@ export class Shimejii {
|
||||
moveTo(pos: number) {}
|
||||
}
|
||||
|
||||
namespace Shimagic {
|
||||
export namespace Shimagic {
|
||||
export class Shimeji {
|
||||
private WebGEngine: WebG.Engine;
|
||||
//private PhysisEngine: Physis.Engine;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { User } from '../bash/etc/userData';
|
||||
import { TermOS } from '$lib/termos/termos';
|
||||
import type { TreeNode } from '../bash/fs';
|
||||
//import { type ILocale } from './localeRegistry';
|
||||
import { Terminal, type PageCallbacks, type TermInitArgs } from './terminal';
|
||||
@@ -108,8 +108,10 @@ async function fetchLocale(id: string): Promise<any> {
|
||||
return data;
|
||||
}
|
||||
|
||||
TermOS.Shell.Bash;
|
||||
|
||||
export async function initTerminal(
|
||||
user: {username: string, password: string},
|
||||
user: { username: string; password: string },
|
||||
callbackInit: PageCallbacks,
|
||||
localeId: string
|
||||
): Promise<Terminal> {
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import type { BooleanLiteral } from 'typescript';
|
||||
import { Bash, Signal, type BashInitArgs, type Result } from '../bash/bash';
|
||||
import { Bash, type BashInitArgs, type Result } from '../bash/bash';
|
||||
import type { CommandArgs } from '../bash/commandRegistry';
|
||||
import type { User } from '../bash/etc/userData';
|
||||
import { VirtualFS, type TreeNode } from '../bash/fs';
|
||||
import { VirtualFS } from '../bash/fs';
|
||||
import { KeybindInhibitor } from '../bash/keybindInhibitor';
|
||||
import { ExitCode } from '../bash/metadata';
|
||||
import type { Process } from '../bash/process';
|
||||
@@ -53,7 +52,6 @@ export class Terminal {
|
||||
this._keybindInhibitor = new KeybindInhibitor(keybinds);
|
||||
|
||||
//this.locale = args.locale;
|
||||
|
||||
}
|
||||
|
||||
private _processKill(): ExitCode {
|
||||
@@ -62,7 +60,7 @@ export class Terminal {
|
||||
|
||||
const process: Process = get;
|
||||
const result = process.sigKill(() => {
|
||||
console.log("process kill successful");
|
||||
console.log('process kill successful');
|
||||
});
|
||||
|
||||
//this.isProcessActive = false;
|
||||
@@ -144,12 +142,10 @@ export class Terminal {
|
||||
}
|
||||
|
||||
getPrimaryKeybindInhibitor(): KeybindInhibitor {
|
||||
const processKeybinds: KeybindInhibitor | null =
|
||||
this._bash.getProcessKeybindInhibitor();
|
||||
const processKeybinds: KeybindInhibitor | null = this._bash.getProcessKeybindInhibitor();
|
||||
if (processKeybinds) {
|
||||
return processKeybinds;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return this._keybindInhibitor;
|
||||
}
|
||||
}
|
||||
@@ -170,14 +166,18 @@ export class Terminal {
|
||||
|
||||
getTerminalWidth(): number {
|
||||
const width = this._callbacks.getWidth?.();
|
||||
if(!width) { throw new Error('somehow width is undefined still after all the checks'); }
|
||||
if (!width) {
|
||||
throw new Error('somehow width is undefined still after all the checks');
|
||||
}
|
||||
|
||||
return width;
|
||||
}
|
||||
|
||||
getFontSize(): number {
|
||||
const size = this._callbacks.getFontSize?.();
|
||||
if(!size) { throw new Error('somehow font size is undefined still after all the checks'); }
|
||||
if (!size) {
|
||||
throw new Error('somehow font size is undefined still after all the checks');
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
declare namespace FileSystem {}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
namespace TermOS {
|
||||
export namespace Shell {
|
||||
export class Bash {
|
||||
private readonly _fs: TermOS.
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
namespace TermOS {
|
||||
export namespace Shell {
|
||||
export abstract class Command {
|
||||
public abstract readonly _flags: CommandFlag[];
|
||||
public abstract readonly _root: boolean;
|
||||
public abstract readonly _keybinds?: Map<KeyBind, () => any>;
|
||||
public abstract readonly _help: string; //TODO: Dont know where to pull the help text from yet
|
||||
public abstract result: CommandResult = { bin: this.constructor.name };
|
||||
|
||||
public abstract Main(this: Bash, flags: CommandFlag[], args: string[]) {}
|
||||
}
|
||||
|
||||
export type CommandFlag = {
|
||||
flag: string;
|
||||
values?: string[];
|
||||
};
|
||||
|
||||
export type CommandResult = {
|
||||
bin: string;
|
||||
flags?: CommandFlag[];
|
||||
args?: string[];
|
||||
path: number;
|
||||
exitcode: ExitCode;
|
||||
data?: any;
|
||||
};
|
||||
}
|
||||
}
|
||||
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
import type { CommandArgs } from "$lib/stores/bash/commandRegistry";
|
||||
import type { KeybindInhibitor } from "$lib/stores/bash/keybindInhibitor";
|
||||
import type { ExitCode } from "$lib/stores/bash/metadata";
|
||||
|
||||
namespace TermOS {
|
||||
export namespace Shell {
|
||||
export class Process {
|
||||
private _bash: Bash;
|
||||
private _uid: number;
|
||||
private _name: string;
|
||||
private _timestamp: Date;
|
||||
private _keybindInhibitor?: KeybindInhibitor;
|
||||
private _abortController: AbortController;
|
||||
|
||||
constructor(
|
||||
bash: Bash,
|
||||
uid: number,
|
||||
name: string,
|
||||
command: Command,
|
||||
args: CommandArgs
|
||||
) {
|
||||
this._bash = bash;
|
||||
this._uid = uid;
|
||||
this._name = name;
|
||||
this._timestamp = new Date();
|
||||
this._abortController = new AbortController();
|
||||
|
||||
if(command._keybinds) {
|
||||
this._keybindInhibitor = new KeybindInhibitor(command.keybinds)
|
||||
}
|
||||
|
||||
this._Exec(command, bash, args);
|
||||
}
|
||||
|
||||
public getKeybindInhibitor(): KeybindInhibitor | null {
|
||||
if(this._keybindInhibitor) return this._keybindInhibitor;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public sigKill(callback: () => void): ExitCode {
|
||||
this._abortController.abort();
|
||||
callback();
|
||||
|
||||
return ExitCode.INT;
|
||||
}
|
||||
|
||||
public get Uid(): number {
|
||||
|
||||
}
|
||||
|
||||
public get Timestamp(): Date {
|
||||
return this._timestamp;
|
||||
}
|
||||
|
||||
public get Name(): string {
|
||||
return this._name
|
||||
}
|
||||
|
||||
public async get Result(): Promise<CommandResult>
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+280
@@ -0,0 +1,280 @@
|
||||
declare namespace TermOS {
|
||||
export async function Initialize() {}
|
||||
|
||||
export declare namespace Shell {
|
||||
async function _init() {}
|
||||
|
||||
export type User = {
|
||||
username: string;
|
||||
password: string;
|
||||
readonly uid: number;
|
||||
readonly gid: number;
|
||||
home: string;
|
||||
accessible: boolean;
|
||||
history: string;
|
||||
cwd?: number;
|
||||
pwd?: number;
|
||||
};
|
||||
|
||||
export type Group = {
|
||||
groupname: string;
|
||||
gid: number;
|
||||
members: number[];
|
||||
};
|
||||
|
||||
export enum ExitCode {
|
||||
OK = 0,
|
||||
ERR = 1,
|
||||
INT = 2
|
||||
}
|
||||
}
|
||||
|
||||
export declare namespace Terminal {
|
||||
async function _init() {}
|
||||
|
||||
export class KeybindInhibitor {
|
||||
private readonly _keybinds: Map<KeyBind, () => any>;
|
||||
|
||||
constructor(keybinds: Map<KeyBind, () => any>) {
|
||||
this._keybinds = keybinds;
|
||||
}
|
||||
|
||||
private parseModifierStates(event: KeyboardEvent): Modifier[] | undefined {
|
||||
const mods: Modifier[] = [];
|
||||
|
||||
if (event.altKey) mods.push('Alt');
|
||||
if (event.ctrlKey) mods.push('Ctrl');
|
||||
if (event.shiftKey) mods.push('Ctrl');
|
||||
|
||||
if (mods.length == 0) return undefined;
|
||||
|
||||
return mods;
|
||||
}
|
||||
|
||||
processKeystroke(event: KeyboardEvent) {
|
||||
const keybind: KeyBind = [
|
||||
{
|
||||
key: event.key,
|
||||
mods: this.parseModifierStates(event)
|
||||
}
|
||||
];
|
||||
|
||||
const out = this._keybinds.get(keybind);
|
||||
if (out) out();
|
||||
}
|
||||
}
|
||||
|
||||
type Modifier = 'Ctrl' | 'Alt' | 'Shift';
|
||||
|
||||
type KeyStroke = {
|
||||
key: string;
|
||||
mods?: Modifier[];
|
||||
};
|
||||
|
||||
export type KeyBind = [KeyStroke] | [KeyStroke, KeyStroke];
|
||||
}
|
||||
|
||||
export declare namespace FileSystem {}
|
||||
}
|
||||
|
||||
/*
|
||||
namespace TermOS {
|
||||
export async function Initialize() {}
|
||||
|
||||
|
||||
export namespace Shell {
|
||||
export class Bash {
|
||||
private readonly _fs: FileSystem;
|
||||
private _passwd:
|
||||
}
|
||||
|
||||
abstract class Command {
|
||||
public abstract readonly FLAGS: CommandFlag[];
|
||||
public abstract readonly ROOT: boolean;
|
||||
public abstract readonly KEYBINDS: KeybindIn
|
||||
|
||||
public abstract async Main(this: Bash): Promise<CommandResult>
|
||||
}
|
||||
|
||||
export class Process {
|
||||
|
||||
private _bash: Bash;
|
||||
private _result: Result;
|
||||
private _uid: number;
|
||||
private _name: string;
|
||||
private _initTimestamp: Date;
|
||||
private _keybindInhibitor?: KeybindInhibitor;
|
||||
private _abortController: AbortController;
|
||||
|
||||
constructor(
|
||||
_bashInstance: Bash,
|
||||
uid: number,
|
||||
name: string,
|
||||
command: Command,
|
||||
args: CommandArgs
|
||||
) {
|
||||
this._bash = _bashInstance;
|
||||
this._result = { exitCode: ExitCode.ERROR, path: this._bash.getCwd() }
|
||||
this._uid = uid;
|
||||
this._name = name;
|
||||
this._initTimestamp = new Date();
|
||||
this._abortController = new AbortController();
|
||||
|
||||
if(command.keybinds) {
|
||||
this._keybindInhibitor = new KeybindInhibitor(command.keybinds);
|
||||
}
|
||||
|
||||
this._Run(command, _bashInstance, args);
|
||||
}
|
||||
|
||||
public getKeybindInhibitor(): KeybindInhibitor | null {
|
||||
if(this._keybindInhibitor) {
|
||||
return this._keybindInhibitor;
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public sigKill(callback: () => void): ExitCode {
|
||||
this._abortController.abort();
|
||||
callback();
|
||||
|
||||
return ExitCode.SUCCESS //Only temp, need to add ExitCode.INT
|
||||
}
|
||||
|
||||
public getUid(): number {
|
||||
return this._uid;
|
||||
}
|
||||
|
||||
public getInitTime(): Date {
|
||||
return this._initTimestamp;
|
||||
}
|
||||
|
||||
public getName(): string {
|
||||
return this._name;
|
||||
}
|
||||
|
||||
public async getResult(): Promise<Result> {
|
||||
return this._result;
|
||||
}
|
||||
|
||||
private async _Run(command: ICommand, bashInstance: Bash, args: CommandArgs) {
|
||||
this._result = command.method.call(
|
||||
bashInstance, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
type CommandFlag = {
|
||||
flag: string;
|
||||
values?: string[];
|
||||
}
|
||||
|
||||
enum ExitCode {
|
||||
SUCCESS = 0,
|
||||
ERROR = 1
|
||||
}
|
||||
|
||||
type CommandResult = {
|
||||
exit_code: ExitCode;
|
||||
path: number;
|
||||
data?: any;
|
||||
}
|
||||
|
||||
type User = {
|
||||
username: string;
|
||||
password: string;
|
||||
readonly uid: number;
|
||||
readonly gid: number;
|
||||
home: string;
|
||||
accessible: boolean;
|
||||
bash_history: string[];
|
||||
cwd?: number;
|
||||
pwd?: number;
|
||||
}
|
||||
|
||||
const COMMANDS
|
||||
const PASSWD
|
||||
const GROUP
|
||||
}
|
||||
class She {
|
||||
private readonly _fs: FileSystem = new FileSystem();
|
||||
|
||||
constructor() {}
|
||||
|
||||
private static async _init() {}
|
||||
}
|
||||
|
||||
export namespace Terminal {
|
||||
export class KeybindInhibitor {
|
||||
private readonly _KEYBINDS:
|
||||
}
|
||||
}
|
||||
|
||||
class Terminal {
|
||||
constructor() {}
|
||||
|
||||
private static async _init() {}
|
||||
}
|
||||
|
||||
class FileSystem {
|
||||
private _table: Map<number, TreeNode>;
|
||||
|
||||
constructor(fs: Map<number, TreeNode>, user: User) {}
|
||||
|
||||
private static async _init() {}
|
||||
|
||||
public type TreeNod {
|
||||
inode: number;
|
||||
}
|
||||
}
|
||||
|
||||
type TreeNode = {
|
||||
inode: number;
|
||||
parent: number;
|
||||
name: string;
|
||||
type: Type;
|
||||
size: number; //Size in Bytes
|
||||
children: number[];
|
||||
content: string; // GUID of the cache file that contains the file contents.
|
||||
link: number; // Links
|
||||
permission: NodePermission;
|
||||
owner: number;
|
||||
group: number;
|
||||
timestamps: TimeStamps;
|
||||
interactible: boolean;
|
||||
func: any;
|
||||
}
|
||||
|
||||
enum Type {
|
||||
Directory = 16384,
|
||||
File = 32768,
|
||||
|
||||
}
|
||||
|
||||
type NodePermission = {
|
||||
user: Permission;
|
||||
group: Permission;
|
||||
other: Permission;
|
||||
}
|
||||
|
||||
type TimeStamps = {
|
||||
modified: Date;
|
||||
changed: Date;
|
||||
accessed: Date;
|
||||
}
|
||||
|
||||
// TODO: Finish this
|
||||
enum ExitCode {
|
||||
SUCCESS = 0,
|
||||
ERROR = 1
|
||||
}
|
||||
|
||||
type Permission = {
|
||||
r: boolean;
|
||||
w: boolean;
|
||||
x: boolean;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -2,6 +2,11 @@ class Vector2 {
|
||||
public x: number;
|
||||
public y: number;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param x
|
||||
* @param y
|
||||
*/
|
||||
constructor(x?: number, y?: number);
|
||||
constructor(v?: Vector2);
|
||||
constructor(x: Vector2 | number = 0, y: number = 0) {
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<script lang="ts">
|
||||
import Renderer from '$lib/shimeji/renderer/renderer';
|
||||
import { WebGEngine } from '$lib/shimeji/renderer/web_g_engine';
|
||||
import { Shimeji } from '$lib/stores/shimeji';
|
||||
import Renderer from '$lib/shimagic/renderer/rendererr';
|
||||
import { WebG } from '$lib/shimagic/renderer/web_g_enginee';
|
||||
import { Shimagic } from '$lib/stores/shimeji';
|
||||
import Vector2 from '$lib/vector';
|
||||
import { onMount } from 'svelte';
|
||||
|
||||
const drag: number = 3;
|
||||
const speed: number = 2;
|
||||
|
||||
let shimeji: Shimeji;
|
||||
let shimeji: Shimagic.Shimeji;
|
||||
let renderer: Renderer;
|
||||
let sprite: HTMLElement;
|
||||
let canvas: HTMLCanvasElement;
|
||||
@@ -32,7 +32,7 @@
|
||||
//const vert = await fetchShader('src/lib/shimeji/renderer/shaders/vertex_shader.vert');
|
||||
//const frag = await fetchShader('src/lib/shimeji/renderer/shaders/fragment_shader.frag');
|
||||
|
||||
const engineConfig: WebGEngine.EngineConfig = {
|
||||
const engineConfig: WebG.EngineConfig = {
|
||||
canvas: canvas,
|
||||
vertexShaderUrl: 'src/lib/shimeji/renderer/shaders/vertex_shader.vert',
|
||||
fragmentShaderUrl: 'src/lib/shimeji/renderer/shaders/fragment_shader.frag',
|
||||
@@ -42,9 +42,9 @@
|
||||
}
|
||||
};
|
||||
|
||||
const engine = await WebGEngine.Engine.Initialize(engineConfig);
|
||||
const engine = await WebG.Engine.Initialize(engineConfig);
|
||||
|
||||
const drawArgs: WebGEngine.DrawCallArgs = {
|
||||
const drawArgs: WebG.DrawCallArgs = {
|
||||
vertices: [
|
||||
new Vector2(200, 200),
|
||||
new Vector2(700, 700),
|
||||
@@ -55,7 +55,7 @@
|
||||
]
|
||||
};
|
||||
|
||||
engine.setDrawMode(WebGEngine.EngineDrawMode.TEXTURE);
|
||||
engine.setDrawMode(WebG.EngineDrawMode.TEXTURE);
|
||||
engine.draw(drawArgs);
|
||||
|
||||
/* shimeji = new Shimeji(40, canvas, renderer);
|
||||
|
||||
Reference in New Issue
Block a user