bestguigui_lab 0.4.0 → 0.6.0

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: 96f6d3fcc750e5d014248e718d7002117e19cdbe90b3787bc7709e2bf20e940c
4
- data.tar.gz: 4f3e25a6ccade65ceb49178db07e71d70ace4d9afb81482a4bd19089b8ef8809
3
+ metadata.gz: 6d6f1ccaf5c79158aa6dc51cbbf2c9596c9365136e7d11846051de723adab104
4
+ data.tar.gz: 581bc3c963fee75bbf61b56cc6cce393ce0fb23abe50065ef176c3ac70298642
5
5
  SHA512:
6
- metadata.gz: 0512a0c2081412ef87f90d19690e38ba315eebd4ef51eb2f13047538384cf30f149db57bc46a216f30f1d37f3bd7a7800f630ca3ec0da9c7d9a32b5028b4f82b
7
- data.tar.gz: 922ce4a677d389b45eb98272a260c83d620070da48f14979609e2738782f5ff61602a3b7750c19ccbd3f8677b54a520e3a3d816a621a8843b4eb2e03811ac871
6
+ metadata.gz: edeedc5450b235ac9db1612d388c85dc11ac12524d79e4c1c5eb24cbc34a31bf0119d3008ea083ea1a2b070846a86a139cf85456ffa1d9e4ce580bec6efa0583
7
+ data.tar.gz: 6f65e74172370444eca7515ad98a595d41f1cccec471c3b089e1136b08f35dcd5605fa53b07c053ac3af0db5122b4421c3528e4dadfdc85e5e19702456c38576
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Monkey patch de Gosu::Image pour lire/ecrire un pixel individuel.
4
+ class Gosu::Image
5
+ def get_pixel(x, y)
6
+ return nil if x < 0 || x >= width || y < 0 || y >= height
7
+
8
+ r, g, b, a = to_blob[((y * width) + x) * 4, 4].unpack('C4')
9
+ Gosu::Color.new(a, r, g, b)
10
+ end
11
+
12
+ def set_pixel(x, y, color)
13
+ blob = [color.red, color.green, color.blue, color.alpha].pack('C4')
14
+ pixel = Gosu::Image.from_blob(1, 1, blob)
15
+ insert(pixel, x, y)
16
+ end
17
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Bestguigui
4
- VERSION = '0.4.0'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bestguigui
4
+ # Fenêtre de base qui calcule le delta-time et délègue update/draw/
5
+ # button_down à la scène courante (@scene). Hérite-en, fixe @scene
6
+ # dans #initialize (et ajoute switch_scene si plusieurs écrans).
7
+ class Window < Gosu::Window
8
+ def update
9
+ @last_update ||= Gosu.milliseconds
10
+ dt = Gosu.milliseconds - @last_update
11
+ @scene.update(dt)
12
+ @last_update = Gosu.milliseconds
13
+ end
14
+
15
+ def draw
16
+ @scene.draw
17
+ end
18
+
19
+ def button_down(id)
20
+ @scene.button_down(id)
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bestguigui_lab
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bestguigui
@@ -45,12 +45,14 @@ files:
45
45
  - lib/bestguigui_lab/assets.rb
46
46
  - lib/bestguigui_lab/gl_texture.rb
47
47
  - lib/bestguigui_lab/helpers.rb
48
+ - lib/bestguigui_lab/image_pixels.rb
48
49
  - lib/bestguigui_lab/input.rb
49
50
  - lib/bestguigui_lab/obj_model.rb
50
51
  - lib/bestguigui_lab/render_3d.rb
51
52
  - lib/bestguigui_lab/scene.rb
52
53
  - lib/bestguigui_lab/splash_scene.rb
53
54
  - lib/bestguigui_lab/version.rb
55
+ - lib/bestguigui_lab/window.rb
54
56
  homepage: https://github.com/guillaumequillet/bestguigui_lab
55
57
  licenses:
56
58
  - MIT