Skip to content

Commit

Permalink
Dev (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
goldbuick authored Dec 31, 2024
2 parents d806a1c + cfefe00 commit cadf854
Show file tree
Hide file tree
Showing 10 changed files with 282 additions and 177 deletions.
2 changes: 2 additions & 0 deletions cafe/.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@ ZSS_SHOW_CODE=false
ZSS_TRACE_CODE=
ZSS_LOG_DEBUG=false
ZSS_FORCE_CRT_OFF=false
ZSS_FORCE_LOW_REZ=false
ZSS_FORCE_TOUCH_UI=false
ZSS_HMR_ONLY=false
ZSS_ANALYZER=false
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "zed-software-system",
"private": true,
"version": "0.21.11",
"version": "0.21.13",
"type": "module",
"scripts": {
"sloc": "npx sloc zss",
Expand Down Expand Up @@ -67,7 +67,6 @@
"msgpackr": "^1.11.2",
"nanoid": "^5.0.3",
"nanoid-dictionary": "^4.3.0",
"nipplejs": "^0.10.2",
"path-browserify": "^1.0.0",
"peerjs": "^1.5.4",
"postprocessing": "^6.36.4",
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4463,11 +4463,6 @@ natural-compare@^1.4.0:
resolved "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==

nipplejs@^0.10.2:
version "0.10.2"
resolved "https://registry.npmjs.org/nipplejs/-/nipplejs-0.10.2.tgz#0e8f5346bd60f7a0fe0d44c856bc1654cde2b70c"
integrity sha512-XGxFY8C2DOtobf1fK+MXINTzkkXJLjZDDpfQhOUZf4TSytbc9s4bmA0lB9eKKM8iDivdr9NQkO7DpIQfsST+9g==

[email protected]:
version "5.2.2"
resolved "https://registry.npmjs.org/node-gyp-build-optional-packages/-/node-gyp-build-optional-packages-5.2.2.tgz#522f50c2d53134d7f3a76cd7255de4ab6c96a3a4"
Expand Down
4 changes: 4 additions & 0 deletions zss/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ const SHOW_CODE = !!JSON.parse(import.meta.env.ZSS_SHOW_CODE)
const TRACE_CODE = `${import.meta.env.ZSS_TRACE_CODE}`
const LOG_DEBUG = !!JSON.parse(import.meta.env.ZSS_LOG_DEBUG)
const FORCE_CRT_OFF = !!JSON.parse(import.meta.env.ZSS_FORCE_CRT_OFF)
const FORCE_LOW_REZ = !!JSON.parse(import.meta.env.ZSS_FORCE_LOW_REZ)
const FORCE_TOUCH_UI = !!JSON.parse(import.meta.env.ZSS_FORCE_TOUCH_UI)

// runtime config
export const RUNTIME = {
Expand All @@ -31,4 +33,6 @@ export {
TRACE_CODE,
LOG_DEBUG,
FORCE_CRT_OFF,
FORCE_LOW_REZ,
FORCE_TOUCH_UI,
}
12 changes: 12 additions & 0 deletions zss/device/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ export function tape_editor_close(sender: string, player: string) {
hub.emit('tape:editor:close', sender, undefined, player)
}

export function userinput_up(sender: string, input: INPUT, player: string) {
hub.emit('userinput:up', sender, input, player)
}

export function userinput_down(sender: string, input: INPUT, player: string) {
hub.emit('userinput:down', sender, input, player)
}

export function userinput_update(sender: string, player: string) {
hub.emit('userinput:update', sender, undefined, player)
}

export function vm_books(
sender: string,
books: string,
Expand Down
1 change: 0 additions & 1 deletion zss/device/vm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ const vm = createdevice('vm', ['init', 'tick', 'second'], (message) => {
break
case 'input':
if (message.player) {
console.info(message)
// player input
const flags = memoryreadflags(message.player)
const [input = INPUT.NONE, mods = 0] = message.data ?? [INPUT.NONE, 0]
Expand Down
13 changes: 10 additions & 3 deletions zss/gadget/terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ import { deviceType, primaryInput } from 'detect-it'
import { useEffect, useState } from 'react'
import Stats from 'stats.js'
import { NearestFilter, OrthographicCamera } from 'three'
import { FORCE_CRT_OFF, RUNTIME, STATS_DEV } from 'zss/config'
import {
FORCE_CRT_OFF,
FORCE_LOW_REZ,
FORCE_TOUCH_UI,
RUNTIME,
STATS_DEV,
} from 'zss/config'
import { CRTShape } from 'zss/gadget/fx/crt'
import decoimageurl from 'zss/gadget/fx/scratches.gif'
import { useTexture } from 'zss/gadget/usetexture'
Expand Down Expand Up @@ -54,12 +60,13 @@ export function Terminal() {

// config DRAW_CHAR_SCALE
const minrez = Math.min(viewwidth, viewheight)
const islowrez = minrez < 600
const islowrez = minrez < 600 || FORCE_LOW_REZ
RUNTIME.DRAW_CHAR_SCALE = islowrez ? 1 : 2

// config LAYOUT
const islandscape = viewwidth > viewheight
const showtouchcontrols = deviceType === 'hybrid' || primaryInput === 'touch'
const showtouchcontrols =
FORCE_TOUCH_UI || deviceType === 'hybrid' || primaryInput === 'touch'

// grit texture
const splat = useTexture(decoimageurl)
Expand Down
Loading

0 comments on commit cadf854

Please sign in to comment.