mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 10:48:53 +01:00
examples/sprites: Slower increasing num of sprites
This commit is contained in:
parent
66f262c80e
commit
d7c2682c53
@ -105,13 +105,13 @@ var sprites = &Sprites{make([]*Sprite, MaxSprites), 500}
|
|||||||
|
|
||||||
func update(screen *ebiten.Image) error {
|
func update(screen *ebiten.Image) error {
|
||||||
if ebiten.IsKeyPressed(ebiten.KeyLeft) {
|
if ebiten.IsKeyPressed(ebiten.KeyLeft) {
|
||||||
sprites.num -= 100
|
sprites.num -= 20
|
||||||
if sprites.num < MinSprites {
|
if sprites.num < MinSprites {
|
||||||
sprites.num = MinSprites
|
sprites.num = MinSprites
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ebiten.IsKeyPressed(ebiten.KeyRight) {
|
if ebiten.IsKeyPressed(ebiten.KeyRight) {
|
||||||
sprites.num += 100
|
sprites.num += 20
|
||||||
if MaxSprites < sprites.num {
|
if MaxSprites < sprites.num {
|
||||||
sprites.num = MaxSprites
|
sprites.num = MaxSprites
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,9 @@ func (q *commandQueue) Enqueue(command command) {
|
|||||||
q.commands = append(q.commands, command)
|
q.commands = append(q.commands, command)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// commandGroups separates q.commands into some groups.
|
||||||
|
// The number of quads of drawImageCommand in one groups must be equal to or less than
|
||||||
|
// its limit (maxQuads).
|
||||||
func (q *commandQueue) commandGroups() [][]command {
|
func (q *commandQueue) commandGroups() [][]command {
|
||||||
cs := make([]command, len(q.commands))
|
cs := make([]command, len(q.commands))
|
||||||
copy(cs, q.commands)
|
copy(cs, q.commands)
|
||||||
|
Loading…
Reference in New Issue
Block a user