@@ -3,11 +3,10 @@ import { useState } from "react"
|
|||||||
import { Component } from "react-godot-renderer"
|
import { Component } from "react-godot-renderer"
|
||||||
|
|
||||||
|
|
||||||
const VFlowContainer = Component.make(Godot.VFlowContainer)
|
const VFlowContainer = Component.fromClass(Godot.VFlowContainer)
|
||||||
const Label = Component.make(Godot.Label)
|
const Label = Component.fromClass(Godot.Label)
|
||||||
const TextEdit = Component.make(Godot.TextEdit)
|
const TextEdit = Component.fromClass(Godot.TextEdit)
|
||||||
const Button = Component.make(Godot.Button)
|
const Button = Component.fromClass(Godot.Button)
|
||||||
const TestUi1Scene = Component.fromScene("res://src/TestUi1.tscn")
|
|
||||||
|
|
||||||
export function TestUi1Component() {
|
export function TestUi1Component() {
|
||||||
const [text, setText] = useState("Default text")
|
const [text, setText] = useState("Default text")
|
||||||
@@ -26,10 +25,6 @@ export function TestUi1Component() {
|
|||||||
return (
|
return (
|
||||||
<VFlowContainer
|
<VFlowContainer
|
||||||
name="Root"
|
name="Root"
|
||||||
anchor_left={0}
|
|
||||||
anchor_top={0}
|
|
||||||
anchor_right={0}
|
|
||||||
anchor_bottom={0}
|
|
||||||
>
|
>
|
||||||
<Label
|
<Label
|
||||||
name="Label"
|
name="Label"
|
||||||
|
|||||||
@@ -3,10 +3,10 @@ import { useState } from "react"
|
|||||||
import { Component } from "react-godot-renderer"
|
import { Component } from "react-godot-renderer"
|
||||||
|
|
||||||
|
|
||||||
const HFlowContainer = Component.make(Godot.HFlowContainer)
|
const HFlowContainer = Component.fromClass(Godot.HFlowContainer)
|
||||||
const VFlowContainer = Component.make(Godot.VFlowContainer)
|
const VFlowContainer = Component.fromClass(Godot.VFlowContainer)
|
||||||
const Label = Component.make(Godot.Label)
|
const Label = Component.fromClass(Godot.Label)
|
||||||
const CheckBox = Component.make(Godot.CheckBox)
|
const CheckBox = Component.fromClass(Godot.CheckBox)
|
||||||
const TestUi1FC = Component.fromScene("res://src/TestUi1.tscn")
|
const TestUi1FC = Component.fromScene("res://src/TestUi1.tscn")
|
||||||
|
|
||||||
export function TestUi2Component() {
|
export function TestUi2Component() {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export const Prototype: Prototype<any> = {
|
|||||||
useUnsafeRef() { return React.useRef(null) },
|
useUnsafeRef() { return React.useRef(null) },
|
||||||
}
|
}
|
||||||
|
|
||||||
export const make = <T extends Godot.Node<Godot.NodePathMap>>(
|
export const fromClass = <T extends Godot.Node<Godot.NodePathMap>>(
|
||||||
class_: new (...args: any[]) => T
|
class_: new (...args: any[]) => T
|
||||||
): Component<T> => Object.setPrototypeOf(
|
): Component<T> => Object.setPrototypeOf(
|
||||||
Object.assign(
|
Object.assign(
|
||||||
|
|||||||
Reference in New Issue
Block a user