Skip to content

Commit 67a68f0

Browse files
author
ranpeng
committed
docs: add README to CAR demo
1 parent 9c33e92 commit 67a68f0

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

Diff for: samples/car/README.md

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# CAR(Cloud Application Rendering)
2+
3+
> In theory, this demo is compatible with both PC and mobile clients (touch events on the mobile client have been processed in `onTouchEvent`).
4+
5+
6+
Detailed description of [interface(index.d.ts)](../../dist/tcg-sdk/index.d.ts).
7+
8+
To add the queue feature, use the [queue demo](../queue).
9+
10+
For more information about TCGSDK, see the [TCGSDK docs](https://ex.cloud-gaming.myqcloud.com/cloud_gaming_web/docs/index.html).
11+
12+
13+
For backend implementation, see the [backend demo](https://ex.cloud-gaming.myqcloud.com/cloud_gaming_web/docs/tutorial-02-cloud-application-backend.html)/[backend demo_en](https://ex.cloud-gaming.myqcloud.com/cloud_gaming_web/docs_en/tutorial-02-cloud-application-backend_EN-US.html) solution.
14+
15+
16+
17+
## Importing the Plugin
18+
19+
For movement operations on the mobile client, Real-Time Cloud Rendering provides an official joystick plugin ([Joystick](../../plugin/joystick/)) to map W/A/S/D or up/down/left/right keys on the keyboard.

Diff for: samples/car/index.html

+16-1
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,24 @@
2424
width: 100%;
2525
height: 100%;
2626
}
27+
28+
#plugin-point {
29+
position: absolute;
30+
left: 100px;
31+
bottom: 150px;
32+
width: 0px;
33+
height: 0px;
34+
}
2735
</style>
2836
</head>
2937

3038
<body>
3139
<div id="demo-container">
3240
<div id="mount-point"></div>
41+
<div id="plugin-point"></div>
3342
</div>
34-
<script type="text/javascript" src="path/to/tcg-sdk"></script>
43+
<script type="text/javascript" src="../../dist/tcg-sdk/index.js"></script>
44+
<script type="text/javascript" src="../../plugin/joystick/joystick.js"></script>
3545
<script type="text/javascript" src="https://cdn.bootcdn.net/ajax/libs/axios/0.26.1/axios.min.js"></script>
3646
<!-- <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.21.1/axios.min.js"></script> -->
3747
<script>
@@ -73,6 +83,11 @@
7383
// Connected successfully.
7484
onConnectSuccess: async (res) => {
7585
console.log('onConnectSuccess', res);
86+
87+
// // Add joystick
88+
// const j = new CloudGamingPlugin.joystick({
89+
// zone: document.querySelector('#plugin-point'),
90+
// });
7691
},
7792
// The network was disconnected or the user was kicked out.
7893
onDisconnect: (res) => {

Diff for: samples/gs/pc-game/index.html

+4
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@
7070
}
7171
}
7272

73+
// For two-finger touch, record the position of the last touch point to facilitate coordinate calculation.
74+
let lastX = null;
75+
let lastY = null;
76+
7377
// For more information on the SDK lifecycle, visit https://ex.cloud-gaming.myqcloud.com/cloud_gaming_web/docs/index.html.
7478
TCGSDK.init({
7579
appid: 1234567,

0 commit comments

Comments
 (0)