@@ -2,9 +2,17 @@ import "./App.css";
2
2
import { useComponentValue , useQuerySync } from "@dojoengine/react" ;
3
3
import { Entity } from "@dojoengine/recs" ;
4
4
import { useEffect , useState } from "react" ;
5
- import { Direction } from "./utils" ;
6
5
import { getEntityIdFromKeys } from "@dojoengine/utils" ;
7
6
import { useDojo } from "./dojo/useDojo" ;
7
+ import { Direction } from "./dojo/typescript/models.gen" ;
8
+
9
+ enum DirectionEnum {
10
+ None = "0" ,
11
+ Left = "Left" ,
12
+ Right = "Right" ,
13
+ Up = "Up" ,
14
+ Down = "Down" ,
15
+ }
8
16
9
17
function App ( ) {
10
18
const {
@@ -139,7 +147,9 @@ function App() {
139
147
< button
140
148
onClick = { ( ) =>
141
149
position && position . vec . y > 0
142
- ? move ( account . account , Direction . Up )
150
+ ? move ( account . account , {
151
+ type : DirectionEnum . Up ,
152
+ } )
143
153
: console . log ( "Reach the borders of the world." )
144
154
}
145
155
>
@@ -150,21 +160,27 @@ function App() {
150
160
< button
151
161
onClick = { ( ) =>
152
162
position && position . vec . x > 0
153
- ? move ( account . account , Direction . Left )
163
+ ? move ( account . account , {
164
+ type : DirectionEnum . Left ,
165
+ } )
154
166
: console . log ( "Reach the borders of the world." )
155
167
}
156
168
>
157
169
Move Left
158
170
</ button >
159
171
< button
160
- onClick = { ( ) => move ( account . account , Direction . Right ) }
172
+ onClick = { ( ) =>
173
+ move ( account . account , { type : DirectionEnum . Right } )
174
+ }
161
175
>
162
176
Move Right
163
177
</ button >
164
178
</ div >
165
179
< div >
166
180
< button
167
- onClick = { ( ) => move ( account . account , Direction . Down ) }
181
+ onClick = { ( ) =>
182
+ move ( account . account , { type : DirectionEnum . Down } )
183
+ }
168
184
>
169
185
Move Down
170
186
</ button >
0 commit comments