summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.markdown2
-rw-r--r--Rakefile3
-rw-r--r--src/candy_gear.cpp50
-rw-r--r--src/core.cpp2
-rw-r--r--src/sprite_implementation.cpp59
-rw-r--r--src/sprite_implementation.hpp41
6 files changed, 2 insertions, 155 deletions
diff --git a/README.markdown b/README.markdown
index e2c05db..b9cb3df 100644
--- a/README.markdown
+++ b/README.markdown
@@ -11,7 +11,7 @@ However, because of this flexibility, the engine presumes that you have some bas
Installation
------------
-CandyGear uses the libraries libSDL2, SDL2\_mixer, and yaml-cpp, so before installing CandyGear into a machine, ensure that development libraries for SDL are installed.
+CandyGear uses the libraries libSDL2, SDL2\_mixer, and freetype, so before installing CandyGear into a machine, ensure that development libraries for SDL are installed.
CandyGear is compiled with Ruby Rake; also ensure it is installed.
To compile the code, run `rake` at the root directory; it will generate the binary engine.
To install the core, run `rake install`.
diff --git a/Rakefile b/Rakefile
index 042eac2..838f3ce 100644
--- a/Rakefile
+++ b/Rakefile
@@ -53,8 +53,7 @@ LIBRARIES = [
'SDL2',
'SDL2_mixer',
'freetype',
- 'm',
- 'yaml-cpp'
+ 'm'
]
case OS
when :windows
diff --git a/src/candy_gear.cpp b/src/candy_gear.cpp
index f9c5528..426db4b 100644
--- a/src/candy_gear.cpp
+++ b/src/candy_gear.cpp
@@ -20,47 +20,11 @@
#include <mruby/hash.h>
#include <mruby/string.h>
-#include <yaml-cpp/yaml.h>
-
#include "core.hpp"
#include "view_2d.hpp"
#include "view_3d.hpp"
static mrb_value
-parse_node(mrb_state *mrb, const YAML::Node &node)
-{
- mrb_value value;
- std::string scalar;
-
- switch(node.Type())
- {
- case YAML::NodeType::Null:
- return mrb_nil_value();
-
- case YAML::NodeType::Scalar:
- scalar = node.as<std::string>();
- return mrb_str_new(mrb, scalar.data(), scalar.size());
-
- case YAML::NodeType::Sequence:
- value = mrb_ary_new_capa(mrb, node.size());
- for (YAML::const_iterator it = node.begin(); it != node.end(); it++)
- mrb_ary_push(mrb, value, parse_node(mrb, *it));
- return value;
-
- case YAML::NodeType::Map:
- value = mrb_hash_new_capa(mrb, node.size());
- for(YAML::const_iterator it = node.begin(); it != node.end(); it++)
- mrb_hash_set(
- mrb, value, parse_node(mrb, it->first), parse_node(mrb, it->second));
- return value;
-
- case YAML::NodeType::Undefined:
- default:
- return mrb_nil_value();
- }
-}
-
-static mrb_value
cg_mCandyGear_set_game_name(mrb_state *mrb, mrb_value self)
{
mrb_value name;
@@ -72,18 +36,6 @@ cg_mCandyGear_set_game_name(mrb_state *mrb, mrb_value self)
}
static mrb_value
-cg_mCandyGear_load_yaml(mrb_state *mrb, mrb_value self)
-{
- const char *file_path;
-
- mrb_get_args(mrb, "z", &file_path);
-
- YAML::Node root = YAML::LoadFile(file_path);
-
- return parse_node(mrb, root);
-}
-
-static mrb_value
cg_mCandyGear_set_views(mrb_state *mrb, mrb_value self)
{
struct RClass *cg_m, *cg_cView2D, *cg_cView3D;
@@ -186,8 +138,6 @@ cg_candy_gear_init(mrb_state *mrb)
cg_m = mrb_module_get(mrb, "CandyGear");
mrb_define_class_method(
- mrb, cg_m, "load_yaml", cg_mCandyGear_load_yaml, MRB_ARGS_REQ(1));
- mrb_define_class_method(
mrb, cg_m, "views=", cg_mCandyGear_set_views, MRB_ARGS_REQ(1));
mrb_define_class_method(
mrb, cg_m, "log", cg_mCandyGear_log, MRB_ARGS_REQ(2));
diff --git a/src/core.cpp b/src/core.cpp
index d87bbe9..5039ffe 100644
--- a/src/core.cpp
+++ b/src/core.cpp
@@ -35,8 +35,6 @@
#include <sstream>
#endif
-#include <yaml-cpp/yaml.h>
-
std::random_device random_seed;
std::mt19937 random_number_generator;
diff --git a/src/sprite_implementation.cpp b/src/sprite_implementation.cpp
deleted file mode 100644
index caa56a2..0000000
--- a/src/sprite_implementation.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2022 Frederico de Oliveira Linhares
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "sprite_implementation.hpp"
-
-#include <cstring>
-#include <fstream>
-
-#include <yaml-cpp/yaml.h>
-
-bool
-cg_SpriteArray_constructor(
- struct cg_SpriteArray_s *self, const char *file_path)
-{
- YAML::Node root = YAML::LoadFile(file_path);
- self->len = root.size();
- self->sprites = new cg_Sprite_s[self->len];
-
- int index = 0;
- for(YAML::const_iterator sprite_node = root.begin();
- sprite_node != root.end();
- sprite_node++)
- {
- cg_Sprite_s *sprite = &self->sprites[index];
-
- auto node_name = sprite_node->first.as<std::string>();
- sprite->name = new char[node_name.size() + 1];
- strcpy(sprite->name, node_name.c_str());
-
- sprite->x = sprite_node->second["x"].as<int32_t>();
- sprite->y = sprite_node->second["y"].as<int32_t>();
- sprite->width = sprite_node->second["width"].as<int32_t>();
- sprite->height = sprite_node->second["height"].as<int32_t>();
-
- index++;
- }
-
- return true;
-}
-
-void
-cg_SpriteArray_destructor(struct cg_SpriteArray_s *self)
-{
- for(auto i = 0; i < self->len; i++) delete[] self->sprites[i].name;
- delete[] self->sprites;
-}
diff --git a/src/sprite_implementation.hpp b/src/sprite_implementation.hpp
deleted file mode 100644
index d679272..0000000
--- a/src/sprite_implementation.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2022 Frederico de Oliveira Linhares
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef CANDY_GEAR_SPRITE_IMPLEMENTATION_H
-#define CANDY_GEAR_SPRITE_IMPLEMENTATION_H 1
-
-#include <cstdint>
-
-struct cg_Sprite_s
-{
- char *name;
- int32_t x, y, width, height;
-};
-
-struct cg_SpriteArray_s
-{
- int32_t len;
- struct cg_Sprite_s *sprites;
-};
-
-bool
-cg_SpriteArray_constructor(
- struct cg_SpriteArray_s *self, const char *file_path);
-
-void
-cg_SpriteArray_destructor(struct cg_SpriteArray_s *self);
-
-#endif /* CANDY_GEAR_SPRITE_IMPLEMENTATION_H */