Skip to content

Instantly share code, notes, and snippets.

@drFabio
Last active December 27, 2017 12:27
Show Gist options
  • Save drFabio/a1b53bd9c7807bf6bd32742cb9bd86b5 to your computer and use it in GitHub Desktop.
Save drFabio/a1b53bd9c7807bf6bd32742cb9bd86b5 to your computer and use it in GitHub Desktop.
Render de um jogo em react
render() {
return (
<div id="wrapper" ref={(c) => this._wrapper = c}>
<BgMusic
gameOver={this.state.gameOver}
running={this.state.running}
mute={this.state.mute}
/>
<Brackground
gameOver={this.state.gameOver}
running={this.state.running}
>
<Hud
score={this.state.score}
mute={this.state.mute}
onMuteToogle={this.onMuteToogle}
/>
<Player
running={this.state.running}
gameOver={this.state.gameOver}
style={{
left: `${INITIAL_LEFT}px`,
top: `${this.state.top}px`
}}
ref={(c) => { this._player = c }}
/>
{this.state.obstacles.map((o) => (
<Obstacle
key={o.index}
left={o.left}
onTop={o.onTop}
width={OBSTACLE_WIDTH}
/>
))}
</Brackground>
</div>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment