changed a texture

This commit is contained in:
Matei Adriel 2019-08-02 12:01:32 +03:00
parent edefa4294c
commit 13521ba3ee
4 changed files with 42 additions and 10 deletions

22
src/assets/ic.svg Normal file
View file

@ -0,0 +1,22 @@
<svg width="800" height="800" viewBox="0 0 800 800" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="800" height="800" fill="#211E33"/>
<rect x="330" y="331" width="140" height="140" fill="#211E33" stroke="white" stroke-width="10"/>
<path d="M360 365V439.5" stroke="white" stroke-width="10"/>
<path d="M440 377.5H360.5" stroke="white" stroke-width="10"/>
<path d="M439.5 426H360" stroke="white" stroke-width="10"/>
<path d="M400 364V438.5" stroke="white" stroke-width="10"/>
<path d="M441 365V439.5" stroke="white" stroke-width="10"/>
<path d="M466.5 331.5L507.208 288H564.5" stroke="white" stroke-width="10"/>
<path d="M466 464L506.708 507.5H564" stroke="white" stroke-width="10"/>
<path d="M333 335.5L292.292 292H235" stroke="white" stroke-width="10"/>
<path d="M333 468.5L292.292 512H235" stroke="white" stroke-width="10"/>
<path d="M467.5 361H558.5" stroke="white" stroke-width="10"/>
<path d="M466 402H557" stroke="white" stroke-width="10"/>
<path d="M464.5 443H555.5" stroke="white" stroke-width="10"/>
<path d="M240 360H331" stroke="white" stroke-width="10"/>
<path d="M239 401H330" stroke="white" stroke-width="10"/>
<path d="M237 442H328" stroke="white" stroke-width="10"/>
<path d="M329 401H358.5" stroke="white" stroke-width="10"/>
<path d="M329 401H358.5" stroke="white" stroke-width="10"/>
<path d="M438 402H467.5" stroke="white" stroke-width="10"/>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -48,7 +48,11 @@ export const compileIc = (state: SimulationState) => {
count: outputCount count: outputCount
} }
}, },
category: categories.ic category: categories.ic,
material: {
type: 'image',
fill: require('../../../assets/ic')
}
} }
templateStore.set(name, result) templateStore.set(name, result)

View file

@ -13,6 +13,7 @@ import { calculateGateHeight } from '../../simulationRenderer/helpers/calculateG
import { getRendererSafely } from '../../logic-gates/helpers/getRendererSafely' import { getRendererSafely } from '../../logic-gates/helpers/getRendererSafely'
import { rendererSubject } from '../../core/subjects/rendererSubject' import { rendererSubject } from '../../core/subjects/rendererSubject'
import { filter, take } from 'rxjs/operators' import { filter, take } from 'rxjs/operators'
import { vector2 } from '../../../common/math/types/vector2'
/** /**
* Contains methods for transforming saved state into the respective class instances * Contains methods for transforming saved state into the respective class instances
@ -46,10 +47,9 @@ export const fromSimulationState = (
gate.transform = fromTransformState(gateState.transform) gate.transform = fromTransformState(gateState.transform)
const fixWrongHeight = () => { const fixWrongHeight = () => {
gate.transform.height = calculateGateHeight( gate.transform.scale = [...Array(2)].fill(
getRendererSafely(), calculateGateHeight(getRendererSafely(), gate)
gate ) as vector2
)
} }
try { try {

View file

@ -1,7 +1,12 @@
import { templateStore } from '../../saving/stores/templateStore' import { templateStore } from '../../saving/stores/templateStore'
import { SimulationError } from '../../errors/classes/SimulationError' import { SimulationError } from '../../errors/classes/SimulationError'
import { Gate } from '../classes/Gate' import { Gate } from '../classes/Gate'
import { add, relativeTo, multiply } from '../../vector2/helpers/basic' import {
add,
relativeTo,
multiply,
multiplyVectors
} from '../../vector2/helpers/basic'
import { SimulationRenderer } from '../../simulationRenderer/classes/SimulationRenderer' import { SimulationRenderer } from '../../simulationRenderer/classes/SimulationRenderer'
import { DefaultGateTemplate } from '../constants' import { DefaultGateTemplate } from '../constants'
import { vector2 } from '../../../common/math/types/vector2' import { vector2 } from '../../../common/math/types/vector2'
@ -35,16 +40,17 @@ export const addGate = (
? (template.shape.scale as vector2) ? (template.shape.scale as vector2)
: DefaultGateTemplate.shape.scale : DefaultGateTemplate.shape.scale
const origin = relativeTo( const origin = renderer.camera.toWordPostition(
multiply(gateScale, 0.5), add(multiply(gateScale, 0.5), Screen.center)
relativeTo(renderer.camera.transform.position, Screen.center)
) )
const scalarOffset = renderer.options.spawning.spawnOffset const scalarOffset = renderer.options.spawning.spawnOffset
const offset = multiply([scalarOffset, scalarOffset], renderer.spawnCount) const offset = multiply([scalarOffset, scalarOffset], renderer.spawnCount)
gate.transform.position = add(origin, offset) gate.transform.position = add(origin, offset)
gate.transform.height = calculateGateHeight(renderer, gate) gate.transform.scale = [...Array(2)].fill(
calculateGateHeight(renderer, gate)
) as vector2
renderer.simulation.push(gate) renderer.simulation.push(gate)
renderer.spawnCount++ renderer.spawnCount++