Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scilla-components
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
劳工
scilla-components
Commits
65f35e4c
Commit
65f35e4c
authored
Apr 22, 2019
by
rockyl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rebuild-lifecycle
parent
c226d8b1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
CameraController.ts
src/other/CameraController.ts
+3
-3
FullStageSize.ts
src/other/FullStageSize.ts
+1
-2
Renderer.ts
src/renderer/Renderer.ts
+6
-2
No files found.
src/other/CameraController.ts
View file @
65f35e4c
...
...
@@ -3,7 +3,7 @@
*
*/
import
{
Entity
,
createVector2D
,
Vector2D
,
math
,
getRenderContext
}
from
"scilla"
;
import
{
Entity
,
createVector2D
,
Vector2D
,
math
,
}
from
"scilla"
;
import
Transform
from
"../base/Transform"
;
import
ScillaComponent
from
"../base/ScillaComponent"
;
...
...
@@ -38,7 +38,7 @@ export default class CameraController extends ScillaComponent {
get
stageSize
(){
if
(
!
this
.
_stageSize
){
this
.
_stageSize
=
getRenderContext
().
getStageSize
()
;
this
.
_stageSize
=
this
.
entity
.
root
.
engine
.
renderContext
.
stageSize
;
}
return
this
.
_stageSize
;
...
...
@@ -77,6 +77,6 @@ export default class CameraController extends ScillaComponent {
this
.
followPosition
.
setXY
(
width
/
2
,
height
/
2
).
subtract
(
this
.
targetPosition
);
position
.
copyFrom
(
math
.
lerpObj
(
position
,
this
.
followPosition
,
0.1
,
Vector2D
,
[
'x'
,
'y'
]));
position
.
copyFrom
(
math
.
lerpObj
(
position
,
this
.
followPosition
,
0.1
,
[
'x'
,
'y'
]));
}
}
src/other/FullStageSize.ts
View file @
65f35e4c
...
...
@@ -3,7 +3,6 @@
*
*/
import
{
getRenderContext
,
}
from
"scilla"
;
import
ScillaComponent
from
"../base/ScillaComponent"
;
/**
...
...
@@ -18,7 +17,7 @@ export default class FullStageSize extends ScillaComponent {
get
stageSize
(){
if
(
!
this
.
_stageSize
){
this
.
_stageSize
=
getRenderContext
().
getStageSize
()
;
this
.
_stageSize
=
this
.
entity
.
root
.
engine
.
renderContext
.
stageSize
;
}
return
this
.
_stageSize
;
...
...
src/renderer/Renderer.ts
View file @
65f35e4c
...
...
@@ -2,7 +2,7 @@
* Created by rockyl on 2018/11/6.
*/
import
{
createCanvas
,
getRenderContext
,
Bounds
,
Vector2D
,
math
,
decorators
,
EngineConfig
}
from
"scilla"
;
import
{
createCanvas
,
Bounds
,
Vector2D
,
math
,
decorators
,
EngineConfig
}
from
"scilla"
;
import
ScillaComponent
from
"../base/ScillaComponent"
;
const
{
dirtyFieldTrigger
}
=
decorators
;
...
...
@@ -52,7 +52,7 @@ export default class Renderer extends ScillaComponent {
protected
_anchorOffset
:
Vector2D
=
new
Vector2D
();
//渲染上下文
protected
_context
=
getRenderContext
().
getContext
()
;
protected
_context
;
/**
* 扩展尺寸
...
...
@@ -106,6 +106,7 @@ export default class Renderer extends ScillaComponent {
onAwake
()
{
super
.
onAwake
();
this
.
_context
=
this
.
entity
.
root
.
engine
.
renderContext
.
context
;
if
(
!
this
.
transform
)
{
console
.
warn
(
'renderer need a transform component'
);
}
...
...
@@ -205,6 +206,9 @@ export default class Renderer extends ScillaComponent {
const
{
a
,
b
,
c
,
d
,
tx
,
ty
}
=
transform
.
getMatrix
(
true
,
false
,
true
);
const
offX
=
ax
*
a
+
ay
*
c
;
const
offY
=
ax
*
b
+
ay
*
d
;
if
(
!
this
.
_context
){
console
.
log
();
}
this
.
_context
.
setTransform
(
a
,
b
,
c
,
d
,
tx
-
offX
,
ty
-
offY
);
}
else
{
this
.
_context
.
setTransform
(
1
,
0
,
0
,
1
,
-
ax
,
-
ay
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment