pixelflow_canvas 0.7.5 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8b380720008ef6d7d9e0528289c8f298efdbb8fa8dbb463e9e5fc88ad1df55e8
4
- data.tar.gz: '0993942b01c574d140a0504f23012fdc8d795e20a2ba8c9ca72e1f8b416e034a'
3
+ metadata.gz: 34167db5526c8573b432921cad5a42bce83805792ed89f80b36225c99bc6a061
4
+ data.tar.gz: 257f23ccf8194c6badbfb459d167e829825b8a101d2952674a9eced9ea709ffe
5
5
  SHA512:
6
- metadata.gz: a0a4c5ed7bfa503163051dcbcc525ab01b4c3d36cd9361042f3add7a118afdb07886d4217b18fa118b6822ff5a73bf85dd1a45552e2d7835e5936b116e1a12de
7
- data.tar.gz: 0e5351e955329f6e5402e27435962421f351fec644f58a10cc82c03f7df34eeb9407c8836e03161dfc6119521fc70eeb147044d2c8d222691a0302e23673b42a
6
+ metadata.gz: 363a89e918af10761d1855c0049776b567a4ebbe14971f97be7b05a3496e566b1bea769a25095d626d075cc05891e9c175a25823e7f8acfc55427d14ff67e1e6
7
+ data.tar.gz: 0bc3e8de344ce4b476ea0cacddc64419853463e618c756b2ffd24dc5428deb9c59b5d29661b5f57a9a9980598e264793edb816259e7fad05e7276596e4d03af6
data/README.md CHANGED
@@ -1,45 +1,7 @@
1
1
  # Pixelflow Canvas Ruby Driver
2
2
 
3
- This is a Ruby driver for the Pixelflow Canvas API.
3
+ This is a Ruby driver for the [Pixelflow Canvas](https://github.com/specht/pixelflow_canvas_vscode?tab=readme-ov-file) Visual Studio Code extension.
4
4
 
5
- ## Prerequisites
6
-
7
- This driver requires the Pixelflow Canvas extension for Visual Studio Code. You can install it from the [Visual Studio Code Marketplace](https://marketplace.visualstudio.com/items?itemName=gymnasiumsteglitz.pixelflow-canvas).
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'pixelflow_canvas'
15
- ```
16
-
17
- And then execute:
18
-
19
- ```
20
- $ bundle install
21
- ```
22
-
23
- Or install it yourself as:
24
-
25
- ```
26
- $ gem install pixelflow_canvas
27
- ```
28
-
29
- ## Usage
30
-
31
- Open the Pixelflow Canvas in VS Code via `Ctrl+Shift+P` or `F1` and `Show Pixelflow Canvas`.
32
-
33
- Then you can use the following Ruby code to draw on the canvas:
34
-
35
- ```ruby
36
- require 'pixelflow_canvas'
37
-
38
- canvas = Pixelflow::Canvas.new(16, 16, :palette)
39
- (0...16).each do |y|
40
- (0...16).each do |x|
41
- canvas.set_pixel(x, y, x + y * 16)
42
- end
43
- end
44
- ```
5
+ ## Documentation
45
6
 
7
+ [https://specht.github.io/pixelflow_canvas_ruby](https://specht.github.io/pixelflow_canvas_ruby)
data/docs/index.md CHANGED
@@ -51,7 +51,7 @@ code end --><img class='full' src='images/code/7fa15cea8c83a542.png'>
51
51
  This method allows you to omit the `canvas` variable on every method call:
52
52
 
53
53
  ```ruby
54
- Canvas.new(320, 180, :palette) do
54
+ Pixelflow::Canvas.new(320, 180, :palette) do
55
55
  set_pixel(160, 90, 10)
56
56
  end
57
57
  ```
@@ -59,7 +59,7 @@ end
59
59
  You can also use the `perform` method to run a block on an existing canvas:
60
60
 
61
61
  ```ruby
62
- canvas = Canvas.new(320, 180, :palette)
62
+ canvas = Pixelflow::Canvas.new(320, 180, :palette)
63
63
  canvas.perform do
64
64
  set_pixel(160, 90, 10)
65
65
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PixelflowCanvas
4
- VERSION = "0.7.5"
4
+ VERSION = "0.7.7"
5
5
  end
@@ -133,9 +133,13 @@ module Pixelflow
133
133
  def ensure_max_fps(fps)
134
134
  fps1 = 1.0 / fps
135
135
  t = Time.now.to_f
136
- dt = t - @last_timestamp
137
- sleep(fps1 - dt) if dt < fps1
138
- @last_timestamp = t
136
+ if @last_timestamp
137
+ loop do
138
+ sleep 0.01
139
+ break if (Time.now.to_f - @last_timestamp) >= fps1
140
+ end
141
+ end
142
+ @last_timestamp = Time.now.to_f
139
143
  end
140
144
 
141
145
  def save_as_png(path)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixelflow_canvas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.5
4
+ version: 0.7.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Specht
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-30 00:00:00.000000000 Z
11
+ date: 2024-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chunky_png