Skip to content
This repository was archived by the owner on Mar 8, 2023. It is now read-only.

Commit c255fc1

Browse files
authored
Merge pull request a327ex#7 from Jigoku/master
change colors from rgb > floating-point for love 11.x support
2 parents 2ce0d11 + f50acb2 commit c255fc1

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

Camera.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ local function new(x, y, w, h, scale, rotation)
9191
follow_lead_x = 0, follow_lead_y = 0,
9292
deadzone = nil, bound = nil,
9393
draw_deadzone = false,
94-
flash_duration = 1, flash_timer = 0, flash_color = {0, 0, 0, 255},
94+
flash_duration = 1, flash_timer = 0, flash_color = {0, 0, 0, 1},
9595
fade_duration = 1, fade_timer = 0, fade_color = {0, 0, 0, 0},
9696
}, Camera)
9797
end

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ end
293293

294294
function love.keypressed(key)
295295
if key == 'f' then
296-
camera:flash(0.05, {0, 0, 0, 255})
296+
camera:flash(0.05, {0, 0, 0, 1})
297297
end
298298
end
299299
```
@@ -320,7 +320,7 @@ end
320320

321321
function love.keypressed(key)
322322
if key == 'f' then
323-
camera:fade(1, {0, 0, 0, 255})
323+
camera:fade(1, {0, 0, 0, 1})
324324
end
325325

326326
if key == 'g' then
@@ -361,7 +361,7 @@ function love.draw()
361361
love.graphics.setCanvas()
362362

363363
-- Draw the 400x300 canvas scaled by 2 to a 800x600 screen
364-
love.graphics.setColor(255, 255, 255, 255)
364+
love.graphics.setColor(1, 1, 1, 1)
365365
love.graphics.setBlendMode('alpha', 'premultiplied')
366366
love.graphics.draw(canvas, 0, 0, 0, 2, 2)
367367
love.graphics.setBlendMode('alpha')
@@ -667,13 +667,13 @@ Arguments:
667667
Fills the screen up with a color for a certain duration.
668668

669669
```lua
670-
camera:flash(0.05, {0, 0, 0, 255})
670+
camera:flash(0.05, {0, 0, 0, 1})
671671
```
672672

673673
Arguments:
674674

675675
* `duration` `(number)` - The duration of the flash in seconds
676-
* `color={0, 0, 0, 255}` `(table[number])` - The color of the flash. Defaults to `{0, 0, 0, 255}`
676+
* `color={0, 0, 0, 1}` `(table[number])` - The color of the flash. Defaults to `{0, 0, 0, 1}`
677677

678678
---
679679

@@ -682,7 +682,7 @@ Arguments:
682682
Slowly fills up the screen with a color along the duration.
683683

684684
```lua
685-
camera:fade(1, {0, 0, 0, 255}, function() print(1) end)
685+
camera:fade(1, {0, 0, 0, 1}, function() print(1) end)
686686
```
687687

688688
Arguments:

0 commit comments

Comments
 (0)