Doing some cleanup
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@ -73,4 +73,6 @@ assets/testworld/tileset.png
|
|||||||
oldsrc
|
oldsrc
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
yarn.lock
|
yarn.lock
|
||||||
|
|
||||||
|
*.log
|
@ -20,7 +20,7 @@ set(SETTING_GAME_POKER 1)
|
|||||||
set(SETTING_GAME_DAWN 2)
|
set(SETTING_GAME_DAWN 2)
|
||||||
set(SETTING_GAME_SANDBOX 3)
|
set(SETTING_GAME_SANDBOX 3)
|
||||||
|
|
||||||
set(SETTING_GAME SETTING_GAME_SANDBOX)
|
set(SETTING_GAME SETTING_GAME_POKER)
|
||||||
set(SETTING_GAME_NAME "DawnGame")
|
set(SETTING_GAME_NAME "DawnGame")
|
||||||
|
|
||||||
################################## Targets #####################################
|
################################## Targets #####################################
|
||||||
|
15
package.json
15
package.json
@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "dawn",
|
|
||||||
"version": "1.0.0",
|
|
||||||
"repository": "https://YourWishes@github.com/YourWishes/Dawn.git",
|
|
||||||
"author": "Dominic Masters <dominic@domsplace.com>",
|
|
||||||
"license": "MIT",
|
|
||||||
"private": true,
|
|
||||||
"scripts": {
|
|
||||||
"build": "tsc -p ."
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"tsc": "^2.0.3",
|
|
||||||
"typescript": "^4.4.3"
|
|
||||||
}
|
|
||||||
}
|
|
@ -45,10 +45,8 @@ void sandboxSceneUpdate(sandboxscene_t *game, engine_t *engine) {
|
|||||||
shaderUseCamera(&game->shader, &game->camera);
|
shaderUseCamera(&game->shader, &game->camera);
|
||||||
shaderUsePosition(&game->shader, 0,0,0, 0,0,0);
|
shaderUsePosition(&game->shader, 0,0,0, 0,0,0);
|
||||||
shaderUseTexture(&game->shader, &game->texture);
|
shaderUseTexture(&game->shader, &game->texture);
|
||||||
scripterInvokeMethodSimple(&scripter, "update");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void sandboxSceneDispose(sandboxscene_t *game) {
|
void sandboxSceneDispose(sandboxscene_t *game) {
|
||||||
// scripterInvokeMethodSimple(&scripter, "dispose");
|
|
||||||
scripterDispose(&scripter);
|
scripterDispose(&scripter);
|
||||||
}
|
}
|
@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2021 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "api.h"
|
|
||||||
|
|
||||||
void scriptApiAdd(scripter_t *scripter) {
|
|
||||||
scriptsApiIo(scripter);
|
|
||||||
scriptsApiPrimitive(scripter);
|
|
||||||
}
|
|
@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2021 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <dawn/dawn.h>
|
|
||||||
#include "primitive.h"
|
|
||||||
#include "io.h"
|
|
||||||
|
|
||||||
void scriptApiAdd(scripter_t *scripter);
|
|
1
src/script/api/global.d.ts
vendored
1
src/script/api/global.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
declare type Pointer<T> = { 'POINTER':T };
|
|
@ -1,24 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2021 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "io.h"
|
|
||||||
|
|
||||||
scripterreturn_t _scriptPrint(scriptercontext_t *ctx) {
|
|
||||||
duk_push_string(ctx, " ");
|
|
||||||
duk_insert(ctx, 0);
|
|
||||||
duk_join(ctx, duk_get_top(ctx) - 1);
|
|
||||||
printf("%s\n", duk_safe_to_string(ctx, -1));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void scriptsApiIo(scripter_t *scripter) {
|
|
||||||
scripterDefineMethod(scripter,
|
|
||||||
SCRIPT_IO_PRINT_NAME,
|
|
||||||
SCRIPT_IO_PRINT_ARGS,
|
|
||||||
&_scriptPrint
|
|
||||||
);
|
|
||||||
}
|
|
1
src/script/api/io.d.ts
vendored
1
src/script/api/io.d.ts
vendored
@ -1 +0,0 @@
|
|||||||
declare function print(...args:any):void;
|
|
@ -1,13 +0,0 @@
|
|||||||
// Copyright (c) 2021 Dominic Masters
|
|
||||||
//
|
|
||||||
// This software is released under the MIT License.
|
|
||||||
// https://opensource.org/licenses/MIT
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <dawn/dawn.h>
|
|
||||||
#include "../scripter.h"
|
|
||||||
|
|
||||||
#define SCRIPT_IO_PRINT_NAME "print"
|
|
||||||
#define SCRIPT_IO_PRINT_ARGS SCRIPTER_VARIABLE_ARGUMENT_COUNT
|
|
||||||
|
|
||||||
void scriptsApiIo(scripter_t *scripter);
|
|
@ -1,36 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2021 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "primitive.h"
|
|
||||||
|
|
||||||
scripterreturn_t _scriptPrimitiveDraw(scriptercontext_t *context) {
|
|
||||||
primitive_t *primitive = duk_to_pointer(context, 0);
|
|
||||||
int32_t start = duk_to_number(context, 1);
|
|
||||||
int32_t count = duk_to_number(context, 2);
|
|
||||||
primitiveDraw(primitive, start, count);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
scripterreturn_t _scriptCubeInit(scriptercontext_t *context) {
|
|
||||||
primitive_t *primitive = malloc(sizeof(primitive_t));
|
|
||||||
cubeInit(primitive, 1, 1, 1);
|
|
||||||
duk_push_pointer(context, primitive);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void scriptsApiPrimitive(scripter_t *scripter) {
|
|
||||||
scripterDefineMethod(scripter,
|
|
||||||
SCRIPT_PRIMITIVE_DRAW_NAME,
|
|
||||||
SCRIPT_PRIMITIVE_DRAW_ARGS,
|
|
||||||
&_scriptPrimitiveDraw
|
|
||||||
);
|
|
||||||
scripterDefineMethod(scripter,
|
|
||||||
SCRIPT_CUBE_INIT_NAME,
|
|
||||||
SCRIPT_CUBE_INIT_ARGS,
|
|
||||||
&_scriptCubeInit
|
|
||||||
);
|
|
||||||
}
|
|
5
src/script/api/primitive.d.ts
vendored
5
src/script/api/primitive.d.ts
vendored
@ -1,5 +0,0 @@
|
|||||||
declare type PointerPrimitive = Pointer<'PRIMITIVE'>;
|
|
||||||
|
|
||||||
declare function primitiveDraw(primitive:PointerPrimitive, start:number, count:number);
|
|
||||||
|
|
||||||
declare function cubeCreate():PointerPrimitive;
|
|
@ -1,20 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (c) 2021 Dominic Masters
|
|
||||||
*
|
|
||||||
* This software is released under the MIT License.
|
|
||||||
* https://opensource.org/licenses/MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
#include <dawn/dawn.h>
|
|
||||||
#include "../scripter.h"
|
|
||||||
#include "../../display/primitive.h"
|
|
||||||
#include "../../display/primitives/cube.h"
|
|
||||||
|
|
||||||
#define SCRIPT_PRIMITIVE_DRAW_NAME "primitiveDraw"
|
|
||||||
#define SCRIPT_PRIMITIVE_DRAW_ARGS 3
|
|
||||||
|
|
||||||
#define SCRIPT_CUBE_INIT_NAME "cubeCreate"
|
|
||||||
#define SCRIPT_CUBE_INIT_ARGS 0
|
|
||||||
|
|
||||||
void scriptsApiPrimitive(scripter_t *scripter);
|
|
@ -17,7 +17,6 @@ void scripterInit(scripter_t *scripter, engine_t *engine) {
|
|||||||
duk_put_global_string(scripter->context, SCRIPTER_SELF_NAME);
|
duk_put_global_string(scripter->context, SCRIPTER_SELF_NAME);
|
||||||
|
|
||||||
// Inject API
|
// Inject API
|
||||||
scriptApiAdd(scripter);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void scripterDispose(scripter_t *scripter) {
|
void scripterDispose(scripter_t *scripter) {
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include <dawn/dawn.h>
|
#include <dawn/dawn.h>
|
||||||
#include "api/api.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the scripter engine.
|
* Initialize the scripter engine.
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
import { Primitive } from "./primitive";
|
|
||||||
|
|
||||||
let cube:PointerPrimitive;
|
|
||||||
let prim = new Primitive();
|
|
||||||
|
|
||||||
const init = () => {
|
|
||||||
cube = cubeCreate();
|
|
||||||
print("Created cube", cube);
|
|
||||||
}
|
|
||||||
|
|
||||||
const update = () => {
|
|
||||||
primitiveDraw(cube, 0, -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
const dispose = () => {
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
export class Primitive {
|
|
||||||
constructor() {
|
|
||||||
print('Hello Class!');
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "ES3",
|
|
||||||
"lib": [ "esnext" ],
|
|
||||||
"allowJs": true,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"strict": true,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"module": "esnext",
|
|
||||||
"jsx": "preserve",
|
|
||||||
"baseUrl": ".",
|
|
||||||
"outDir": "build/assets/scripts",
|
|
||||||
"alwaysStrict": false,
|
|
||||||
"noImplicitUseStrict": true
|
|
||||||
},
|
|
||||||
"exclude": [
|
|
||||||
"node_modules"
|
|
||||||
],
|
|
||||||
"include": [
|
|
||||||
"**/*.ts", "**/*.tsx", "**/*.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|
Reference in New Issue
Block a user