summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--.yardoc/checksums8
-rw-r--r--.yardoc/object_typesbin4911 -> 5075 bytes
-rw-r--r--.yardoc/objects/root.datbin72914 -> 88736 bytes
-rw-r--r--mrbdoc/core.rb36
-rw-r--r--mrblib/color.rb213
-rw-r--r--mrblib/core.rb6
-rw-r--r--mrblib/raylib.rb7
-rw-r--r--src/core.c2
8 files changed, 225 insertions, 47 deletions
diff --git a/.yardoc/checksums b/.yardoc/checksums
index f8ac59d..f40c0e1 100644
--- a/.yardoc/checksums
+++ b/.yardoc/checksums
@@ -1,3 +1,5 @@
-mrblib/raylib.rb ce42382655c9ad1b0aa789cfb6d45d08be4eaf94
-src/core.c b6db3cd16136b72a42912955e51a0745dfc5429b
-src/raylib.c 4c1742dd879b28455ab020b4a51b7bda9916ee60
+mrblib/core.rb d58457d61a6737b2dbdd58671a45dd404e745b77
+mrblib/color.rb b22db1494bc8b736f355981b924415d62513ff90
+mrblib/raylib.rb fbcdcf96e35dd357edb833327d61bf72ee396702
+src/core.c 205286b59e8a0bd65ebf695c482eb331dc2b4a36
+src/raylib.c 68ee756bb18a21e7663ac59cfbbb254d3523b61c
diff --git a/.yardoc/object_types b/.yardoc/object_types
index 63384f0..1d84eb6 100644
--- a/.yardoc/object_types
+++ b/.yardoc/object_types
Binary files differ
diff --git a/.yardoc/objects/root.dat b/.yardoc/objects/root.dat
index 42e3414..69c3888 100644
--- a/.yardoc/objects/root.dat
+++ b/.yardoc/objects/root.dat
Binary files differ
diff --git a/mrbdoc/core.rb b/mrbdoc/core.rb
deleted file mode 100644
index 828bb48..0000000
--- a/mrbdoc/core.rb
+++ /dev/null
@@ -1,36 +0,0 @@
-
-class Rect
- # yardoc garbage test
- #
- # @param poo [Integer] this is more
- def yep(stuff)
- end
-end
-
-module Raylib
- class << self
-
- # Initialize window and OpenGL context.
- #
- # @param width [Integer] width ye
- # @param height [Integer] height ye
- # @param title [String] title ye
- # @return (Nil)
-
- # Creates a new {FelECS::ComponentManager component manager}.
- #
- # @example
- # # Here color is set to default to red
- # # while max and current are nil until set.
- # # When you make a new component using this component manager
- # # these are the values and accessors it will have.
- # FelECS::Component.new('Health', :max, :current, color: 'red')
- #
- # @param width [String] Name of your new component manager. Must be stylized in the format of constants in Ruby
- # @param height [:Symbols] New components made with this manager will include these symbols as accessors, the values of these accessors will default to nil
- # @param title [Keyword: DefaultValue] New components made with this manager will include these keywords as accessors, their defaults set to the values given to the keywords
- # @return [ComponentManager]
- def init_window(width: 800, height: 600, title: "Hello World from FelFlame!")
- end
- end
-end
diff --git a/mrblib/color.rb b/mrblib/color.rb
new file mode 100644
index 0000000..8757abe
--- /dev/null
+++ b/mrblib/color.rb
@@ -0,0 +1,213 @@
+module Raylib
+
+ # In addition to creating custom colors, you can call
+ # any of the default 140 HTML colors(in addition to
+ # RayWhite) seen here:
+ # https://www.w3schools.com/colors/colors_names.asp
+ #
+ # When a default color is called it is created once and
+ # then stored for each future consecutive use. To call
+ # a color method simply use the ruby naming convention
+ # for method calls, for example to use BlueViolet you
+ # would do the following:
+ #
+ # +Rl::Color.blue_violet+
+ #
+ # You can also add custom default colors by adding it to the ColorList hash so that they can be called the same way.
+ class Color
+ class << self
+ # A fully transparent color.
+ # +rgba(0, 0, 0, 0)+
+ # The color is cached when this method creates it.
+ # @return [Color]
+ def clear
+ @clear ||= Color.new(0, 0, 0, 0)
+ end
+
+ # @!visibility private
+ def color_cache(color)
+ @color_cache ||= {}
+ if ColorList[color]
+ @color_cache[color] ||= Raylib::Color.new(ColorList[color][:r],ColorList[color][:g],ColorList[color][:b],255)
+ else
+ raise 'Bad Colorname'
+ end
+ end
+
+ # @!visibility private
+ def method_missing(method, *args)
+ if ColorList[method]
+ if args.empty?
+ self.color_cache(method)
+ else
+ raise ArgumentError.new "Expected no arguments"
+ end
+ else
+ super
+ end
+ end
+
+ # @!visibility private
+ def respond_to_missing?(method, *args)
+ if ColorList[method]
+ true
+ else
+ super
+ end
+ end
+ end
+
+ # Hash of all web colors
+ ColorList = {
+ :ray_white=>{:r=>245, :g=>245, :b=>245},
+ :alice_blue=>{:r=>0, :g=>15, :b=>143},
+ :antique_white=>{:r=>0, :g=>174, :b=>189},
+ :aqua=>{:r=>0, :g=>15, :b=>255},
+ :aquamarine=>{:r=>0, :g=>255, :b=>253},
+ :azure=>{:r=>0, :g=>15, :b=>255},
+ :beige=>{:r=>0, :g=>95, :b=>93},
+ :bisque=>{:r=>0, :g=>254, :b=>76},
+ :black=>{:r=>0, :g=>0, :b=>0},
+ :blanched_almond=>{:r=>0, :g=>254, :b=>188},
+ :blue=>{:r=>0, :g=>0, :b=>15},
+ :blue_violet=>{:r=>0, :g=>162, :b=>190},
+ :brown=>{:r=>0, :g=>82, :b=>162},
+ :burly_wood=>{:r=>0, :g=>235, :b=>136},
+ :cadet_blue=>{:r=>0, :g=>249, :b=>234},
+ :chartreuse=>{:r=>0, :g=>255, :b=>240},
+ :chocolate=>{:r=>0, :g=>38, :b=>145},
+ :coral=>{:r=>0, :g=>247, :b=>245},
+ :cornflower_blue=>{:r=>0, :g=>73, :b=>94},
+ :cornsilk=>{:r=>0, :g=>255, :b=>141},
+ :crimson=>{:r=>0, :g=>193, :b=>67},
+ :cyan=>{:r=>0, :g=>15, :b=>255},
+ :dark_blue=>{:r=>0, :g=>0, :b=>8},
+ :dark_cyan=>{:r=>0, :g=>8, :b=>184},
+ :dark_golden_rod=>{:r=>0, :g=>136, :b=>96},
+ :dark_gray=>{:r=>0, :g=>154, :b=>154},
+ :dark_green=>{:r=>0, :g=>6, :b=>64},
+ :dark_grey=>{:r=>0, :g=>154, :b=>154},
+ :dark_khaki=>{:r=>0, :g=>219, :b=>118},
+ :dark_magenta=>{:r=>0, :g=>176, :b=>8},
+ :dark_olive_green=>{:r=>0, :g=>86, :b=>178},
+ :dark_orange=>{:r=>0, :g=>248, :b=>192},
+ :dark_orchid=>{:r=>0, :g=>147, :b=>44},
+ :dark_red=>{:r=>0, :g=>176, :b=>0},
+ :dark_salmon=>{:r=>0, :g=>153, :b=>103},
+ :dark_sea_green=>{:r=>0, :g=>251, :b=>200},
+ :dark_slate_blue=>{:r=>0, :g=>131, :b=>216},
+ :dark_slate_gray=>{:r=>0, :g=>244, :b=>244},
+ :dark_slate_grey=>{:r=>0, :g=>244, :b=>244},
+ :dark_turquoise=>{:r=>0, :g=>12, :b=>237},
+ :dark_violet=>{:r=>0, :g=>64, :b=>13},
+ :deep_pink=>{:r=>0, :g=>241, :b=>73},
+ :deep_sky_blue=>{:r=>0, :g=>11, :b=>255},
+ :dim_gray=>{:r=>0, :g=>150, :b=>150},
+ :dim_grey=>{:r=>0, :g=>150, :b=>150},
+ :dodger_blue=>{:r=>0, :g=>233, :b=>15},
+ :fire_brick=>{:r=>0, :g=>34, :b=>34},
+ :floral_white=>{:r=>0, :g=>255, :b=>175},
+ :forest_green=>{:r=>0, :g=>40, :b=>178},
+ :fuchsia=>{:r=>0, :g=>240, :b=>15},
+ :gainsboro=>{:r=>0, :g=>205, :b=>205},
+ :ghost_white=>{:r=>0, :g=>143, :b=>143},
+ :golden_rod=>{:r=>0, :g=>170, :b=>82},
+ :gold=>{:r=>0, :g=>253, :b=>112},
+ :gray=>{:r=>0, :g=>8, :b=>8},
+ :green=>{:r=>0, :g=>8, :b=>0},
+ :green_yellow=>{:r=>0, :g=>223, :b=>242},
+ :grey=>{:r=>0, :g=>8, :b=>8},
+ :honey_dew=>{:r=>0, :g=>15, :b=>255},
+ :hot_pink=>{:r=>0, :g=>246, :b=>155},
+ :indian_red=>{:r=>0, :g=>213, :b=>197},
+ :indigo=>{:r=>0, :g=>176, :b=>8},
+ :ivory=>{:r=>0, :g=>255, :b=>255},
+ :khaki=>{:r=>0, :g=>14, :b=>104},
+ :lavender_blush=>{:r=>0, :g=>255, :b=>15},
+ :lavender=>{:r=>0, :g=>110, :b=>111},
+ :lawn_green=>{:r=>0, :g=>207, :b=>192},
+ :lemon_chiffon=>{:r=>0, :g=>255, :b=>172},
+ :light_blue=>{:r=>0, :g=>221, :b=>142},
+ :light_coral=>{:r=>0, :g=>8, :b=>8},
+ :light_cyan=>{:r=>0, :g=>15, :b=>255},
+ :light_golden_rod_yellow=>{:r=>0, :g=>175, :b=>173},
+ :light_gray=>{:r=>0, :g=>61, :b=>61},
+ :light_green=>{:r=>0, :g=>14, :b=>233},
+ :light_grey=>{:r=>0, :g=>61, :b=>61},
+ :light_pink=>{:r=>0, :g=>251, :b=>108},
+ :light_salmon=>{:r=>0, :g=>250, :b=>7},
+ :light_sea_green=>{:r=>0, :g=>11, :b=>42},
+ :light_sky_blue=>{:r=>0, :g=>124, :b=>239},
+ :light_slate_gray=>{:r=>0, :g=>120, :b=>137},
+ :light_slate_grey=>{:r=>0, :g=>120, :b=>137},
+ :light_steel_blue=>{:r=>0, :g=>12, :b=>77},
+ :light_yellow=>{:r=>0, :g=>255, :b=>254},
+ :lime=>{:r=>0, :g=>15, :b=>240},
+ :lime_green=>{:r=>0, :g=>44, :b=>211},
+ :linen=>{:r=>0, :g=>175, :b=>14},
+ :magenta=>{:r=>0, :g=>240, :b=>15},
+ :maroon=>{:r=>0, :g=>0, :b=>0},
+ :medium_aquamarine=>{:r=>0, :g=>108, :b=>218},
+ :medium_blue=>{:r=>0, :g=>0, :b=>12},
+ :medium_orchid=>{:r=>0, :g=>165, :b=>93},
+ :medium_purple=>{:r=>0, :g=>55, :b=>13},
+ :medium_sea_green=>{:r=>0, :g=>203, :b=>55},
+ :medium_slate_blue=>{:r=>0, :g=>182, :b=>142},
+ :medium_spring_green=>{:r=>0, :g=>15, :b=>169},
+ :medium_turquoise=>{:r=>0, :g=>141, :b=>28},
+ :medium_violet_red=>{:r=>0, :g=>113, :b=>88},
+ :midnight_blue=>{:r=>0, :g=>145, :b=>151},
+ :mint_cream=>{:r=>0, :g=>95, :b=>255},
+ :misty_rose=>{:r=>0, :g=>254, :b=>78},
+ :moccasin=>{:r=>0, :g=>254, :b=>75},
+ :navajo_white=>{:r=>0, :g=>253, :b=>234},
+ :navy=>{:r=>0, :g=>0, :b=>8},
+ :old_lace=>{:r=>0, :g=>223, :b=>94},
+ :olive=>{:r=>0, :g=>8, :b=>0},
+ :olive_drab=>{:r=>0, :g=>184, :b=>226},
+ :orange=>{:r=>0, :g=>250, :b=>80},
+ :orange_red=>{:r=>0, :g=>244, :b=>80},
+ :orchid=>{:r=>0, :g=>167, :b=>13},
+ :pale_golden_rod=>{:r=>0, :g=>238, :b=>138},
+ :palegreen=>{:r=>0, :g=>143, :b=>185},
+ :pale_turquoise=>{:r=>0, :g=>254, :b=>238},
+ :pale_violet_red=>{:r=>0, :g=>183, :b=>9},
+ :papaya_whip=>{:r=>0, :g=>254, :b=>253},
+ :peach_puff=>{:r=>0, :g=>253, :b=>171},
+ :peru=>{:r=>0, :g=>216, :b=>83},
+ :pink=>{:r=>0, :g=>252, :b=>12},
+ :plum=>{:r=>0, :g=>218, :b=>13},
+ :powder_blue=>{:r=>0, :g=>14, :b=>14},
+ :purple=>{:r=>0, :g=>0, :b=>8},
+ :rebecca_purple=>{:r=>0, :g=>99, :b=>57},
+ :red=>{:r=>0, :g=>240, :b=>0},
+ :rosy_brown=>{:r=>0, :g=>200, :b=>248},
+ :royal_blue=>{:r=>0, :g=>22, :b=>158},
+ :saddle_brown=>{:r=>0, :g=>180, :b=>81},
+ :salmon=>{:r=>0, :g=>168, :b=>7},
+ :sandy_brown=>{:r=>0, :g=>74, :b=>70},
+ :sea_green=>{:r=>0, :g=>232, :b=>181},
+ :sea_shell=>{:r=>0, :g=>255, :b=>94},
+ :sienna=>{:r=>0, :g=>5, :b=>34},
+ :silver=>{:r=>0, :g=>12, :b=>12},
+ :sky_blue=>{:r=>0, :g=>124, :b=>238},
+ :slate_blue=>{:r=>0, :g=>165, :b=>172},
+ :slate_gray=>{:r=>0, :g=>8, :b=>9},
+ :slate_grey=>{:r=>0, :g=>8, :b=>9},
+ :snow=>{:r=>0, :g=>255, :b=>175},
+ :spring_green=>{:r=>0, :g=>15, :b=>247},
+ :steel_blue=>{:r=>0, :g=>104, :b=>43},
+ :tan=>{:r=>0, :g=>43, :b=>72},
+ :teal=>{:r=>0, :g=>8, :b=>8},
+ :thistle=>{:r=>0, :g=>139, :b=>253},
+ :tomato=>{:r=>0, :g=>246, :b=>52},
+ :turquoise=>{:r=>0, :g=>14, :b=>13},
+ :violet=>{:r=>0, :g=>232, :b=>46},
+ :wheat=>{:r=>0, :g=>93, :b=>235},
+ :white=>{:r=>0, :g=>255, :b=>255},
+ :white_smoke=>{:r=>0, :g=>95, :b=>95},
+ :yellow=>{:r=>0, :g=>255, :b=>240},
+ :yellow_green=>{:r=>0, :g=>172, :b=>211}
+ }
+ end
+end
diff --git a/mrblib/core.rb b/mrblib/core.rb
new file mode 100644
index 0000000..5d27566
--- /dev/null
+++ b/mrblib/core.rb
@@ -0,0 +1,6 @@
+module Raylib
+ class Color
+ class << self
+ end
+ end
+end
diff --git a/mrblib/raylib.rb b/mrblib/raylib.rb
index e0061a2..5ad3e37 100644
--- a/mrblib/raylib.rb
+++ b/mrblib/raylib.rb
@@ -38,13 +38,6 @@ module Raylib
end
end
- class Color
- class << self
- def raywhite
- @raywhite ||= Color.new(245, 245, 245, 255)
- end
- end
- end
class << self
attr_accessor :defined_loop
diff --git a/src/core.c b/src/core.c
index 66674f3..4509cd5 100644
--- a/src/core.c
+++ b/src/core.c
@@ -62,7 +62,7 @@ static mrb_value
mrb_clear_background(mrb_state* mrb, mrb_value self) {
struct RClass *raylib = mrb_module_get(mrb, "Raylib");
struct RClass *color = mrb_class_get_under(mrb, raylib, Color_type.struct_name);
- mrb_value color_obj = mrb_funcall(mrb, mrb_obj_value(color), "raywhite", 0);
+ mrb_value color_obj = mrb_funcall(mrb, mrb_obj_value(color), "ray_white", 0);
uint32_t kw_num = 1;
const mrb_sym kw_names[] = {