retrograph 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. data/README +248 -0
  2. data/Rakefile +54 -0
  3. data/ext/extconf.rb +3 -0
  4. data/ext/retrograph.c +275 -0
  5. data/spec/image-specs/color-blue-bits.case +2 -0
  6. data/spec/image-specs/color-blue-bits.png +0 -0
  7. data/spec/image-specs/color-green-bits.case +2 -0
  8. data/spec/image-specs/color-green-bits.png +0 -0
  9. data/spec/image-specs/color-red-bits.case +2 -0
  10. data/spec/image-specs/color-red-bits.png +0 -0
  11. data/spec/image-specs/default-screen-black.case +1 -0
  12. data/spec/image-specs/default-screen-black.png +0 -0
  13. data/spec/image-specs/default-screen-color-0.case +2 -0
  14. data/spec/image-specs/default-screen-color-0.png +0 -0
  15. data/spec/image-specs/scroll-mode1.case +7 -0
  16. data/spec/image-specs/scroll-mode1.png +0 -0
  17. data/spec/image-specs/scroll-mode2.case +10 -0
  18. data/spec/image-specs/scroll-mode2.png +0 -0
  19. data/spec/image-specs/scroll-mode3.case +10 -0
  20. data/spec/image-specs/scroll-mode3.png +0 -0
  21. data/spec/image-specs/sprites-doubling.case +5 -0
  22. data/spec/image-specs/sprites-doubling.png +0 -0
  23. data/spec/image-specs/sprites-mode2.case +8 -0
  24. data/spec/image-specs/sprites-mode2.png +0 -0
  25. data/spec/image-specs/sprites-mode3.case +8 -0
  26. data/spec/image-specs/sprites-mode3.png +0 -0
  27. data/spec/image-specs/sprites-ordering.case +5 -0
  28. data/spec/image-specs/sprites-ordering.png +0 -0
  29. data/spec/image-specs/text-colors.case +5 -0
  30. data/spec/image-specs/text-colors.png +0 -0
  31. data/spec/image-specs/tile-attributes-mode2.case +9 -0
  32. data/spec/image-specs/tile-attributes-mode2.png +0 -0
  33. data/spec/image-specs/tile-attributes-mode3.case +9 -0
  34. data/spec/image-specs/tile-attributes-mode3.png +0 -0
  35. data/spec/retrograph_spec.rb +133 -0
  36. data/src/retrograph.c +695 -0
  37. data/src/retrograph.h +66 -0
  38. metadata +103 -0
data/src/retrograph.h ADDED
@@ -0,0 +1,66 @@
1
+ /* retrograph
2
+ *
3
+ * Copyright (c) 2009 MenTaLguY <mental@rydia.net>
4
+ *
5
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ * of this software and associated documentation files (the "Software"), to deal
7
+ * in the Software without restriction, including without limitation the rights
8
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ * copies of the Software, and to permit persons to whom the Software is
10
+ * furnished to do so, subject to the following conditions:
11
+ *
12
+ * The above copyright notice and this permission notice shall be included in
13
+ * all copies or substantial portions of the Software.
14
+ *
15
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ * THE SOFTWARE.
22
+ */
23
+ #ifndef SEEN_RETROGRAPH_H
24
+ #define SEEN_RETROGRAPH_H
25
+
26
+ #include <stdlib.h>
27
+ #include <stdint.h>
28
+
29
+ #define RETROGRAPH_DISPLAY_WIDTH 256
30
+ #define RETROGRAPH_DISPLAY_HEIGHT 224
31
+
32
+ #define RETROGRAPH_BYTES_PER_PIXEL 4
33
+ #define RETROGRAPH_BITS_PER_PIXEL (RETROGRAPH_BYTES_PER_PIXEL * 8)
34
+
35
+ #define RETROGRAPH_RED_SHIFT 16
36
+ #define RETROGRAPH_GREEN_SHIFT 8
37
+ #define RETROGRAPH_BLUE_SHIFT 0
38
+
39
+ #define RETROGRAPH_RED_MASK (0xff << RETROGRAPH_RED_SHIFT)
40
+ #define RETROGRAPH_GREEN_MASK (0xff << RETROGRAPH_GREEN_SHIFT)
41
+ #define RETROGRAPH_BLUE_MASK (0xff << RETROGRAPH_BLUE_SHIFT)
42
+ #define RETROGRAPH_ALPHA_MASK 0x00
43
+
44
+ typedef struct retrograph_vdu_tag *retrograph_vdu_t;
45
+
46
+ typedef uint16_t retrograph_addr_t;
47
+
48
+ typedef enum {
49
+ RETROGRAPH_OK=0,
50
+ RETROGRAPH_NO_MEMORY,
51
+ RETROGRAPH_INVALID_ARGUMENT
52
+ } retrograph_error_t;
53
+
54
+ retrograph_vdu_t retrograph_new(void);
55
+ void retrograph_ref(retrograph_vdu_t vdu);
56
+ void retrograph_destroy(retrograph_vdu_t vdu);
57
+
58
+ retrograph_error_t retrograph_get_error(retrograph_vdu_t vdu);
59
+
60
+ void retrograph_write(retrograph_vdu_t vdu, retrograph_addr_t start_address,
61
+ void const *data, size_t n_bytes);
62
+ void retrograph_begin_frame(retrograph_vdu_t vdu);
63
+ void retrograph_render_scanline(retrograph_vdu_t vdu, void *dest,
64
+ size_t dest_size);
65
+
66
+ #endif
metadata ADDED
@@ -0,0 +1,103 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: retrograph
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
+ platform: ruby
6
+ authors:
7
+ - MenTaLguY <mental@rydia.net>
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-06-22 00:00:00 -04:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: rubysdl
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.3.0
24
+ version:
25
+ description: |
26
+ Retrograph is a software scanline renderer which simulates a late-era 8-bit display.
27
+ Its graphical capabilities are similar to those of the Sega Master System.
28
+
29
+ email: mental@rydia.net
30
+ executables: []
31
+
32
+ extensions:
33
+ - ext/extconf.rb
34
+ extra_rdoc_files: []
35
+
36
+ files:
37
+ - Rakefile
38
+ - README
39
+ - src/retrograph.h
40
+ - src/retrograph.c
41
+ - ext/extconf.rb
42
+ - ext/retrograph.c
43
+ - spec/retrograph_spec.rb
44
+ - spec/image-specs/sprites-doubling.case
45
+ - spec/image-specs/text-colors.case
46
+ - spec/image-specs/scroll-mode3.case
47
+ - spec/image-specs/scroll-mode1.case
48
+ - spec/image-specs/color-blue-bits.case
49
+ - spec/image-specs/sprites-mode3.case
50
+ - spec/image-specs/scroll-mode2.case
51
+ - spec/image-specs/default-screen-black.case
52
+ - spec/image-specs/color-red-bits.case
53
+ - spec/image-specs/default-screen-color-0.case
54
+ - spec/image-specs/tile-attributes-mode3.case
55
+ - spec/image-specs/color-green-bits.case
56
+ - spec/image-specs/tile-attributes-mode2.case
57
+ - spec/image-specs/sprites-ordering.case
58
+ - spec/image-specs/sprites-mode2.case
59
+ - spec/image-specs/tile-attributes-mode2.png
60
+ - spec/image-specs/text-colors.png
61
+ - spec/image-specs/color-red-bits.png
62
+ - spec/image-specs/default-screen-black.png
63
+ - spec/image-specs/color-blue-bits.png
64
+ - spec/image-specs/sprites-ordering.png
65
+ - spec/image-specs/scroll-mode1.png
66
+ - spec/image-specs/default-screen-color-0.png
67
+ - spec/image-specs/sprites-doubling.png
68
+ - spec/image-specs/scroll-mode3.png
69
+ - spec/image-specs/color-green-bits.png
70
+ - spec/image-specs/sprites-mode3.png
71
+ - spec/image-specs/sprites-mode2.png
72
+ - spec/image-specs/tile-attributes-mode3.png
73
+ - spec/image-specs/scroll-mode2.png
74
+ has_rdoc: true
75
+ homepage: http://rubyforge.org/projects/retrograph
76
+ licenses: []
77
+
78
+ post_install_message:
79
+ rdoc_options: []
80
+
81
+ require_paths:
82
+ - ext
83
+ required_ruby_version: !ruby/object:Gem::Requirement
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ version: "0"
88
+ version:
89
+ required_rubygems_version: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - ">="
92
+ - !ruby/object:Gem::Version
93
+ version: "0"
94
+ version:
95
+ requirements: []
96
+
97
+ rubyforge_project: retrograph
98
+ rubygems_version: 1.3.4
99
+ signing_key:
100
+ specification_version: 3
101
+ summary: Retrograph, a retrodisplay.
102
+ test_files: []
103
+