Merge branch 'main' into layout

This commit is contained in:
HJfod 2022-10-22 19:16:57 +03:00
commit 46381e7cbc
486 changed files with 3297 additions and 3957 deletions

3
.gitignore vendored
View file

@ -47,3 +47,6 @@ loader/src/internal/resources.hpp
loader/resources/mod.json
fods-catgirl-hideout.txt
# krita files too because alk is funny
**/*.kra

View file

@ -1,5 +1,28 @@
# Geode Changelog
## v0.6.0
- Mod resource loading has been reworked again, with the intent of adding support for texture pack loaders
- Added `Loader::addTexturePath` and `Loader::removeTexturePath` to work with additional resource paths
- Mods that work with Cocos2d search paths directly should convert to using the above functions
- New header `Geode/ui/LayerBG.hpp` with `createLayerBG` function for creating the blue gradient background GD layers have
- All Cocos2d include paths have been changed to be relative
- `cocos2dx` folder has been removed, cocos2d is now directly inside `Geode/cocos`
- Loader resources updating will no longer check for plist file differences due to problems with CLI on Mac
- More codegen optimizations, Geode mods should now compile faster
- Added `NewResult` class, which will eventually replace the old `Result`
- Add `deprecate` and `nodiscard` attributes to the old `Result` class
- Many more bindings on Mac and Windows
## v0.5.0
- Added `CCFileUtils::get`
- Fix crashes related to setting IDs in `MenuLayer`
- Remove `Loader::updateModResourcePaths` and `Loader::updateResourcePaths`. The minimum mod target version is still v0.4.0 however, as you should never have been using these functions.
- Rework how mod resources are added
- Deprecate `geode::utils::vector` and `geode::utils::container` namespaces and replace them with `geode::utils::ranges`
- Finally added a license to Geode! The framework is now licensed under BSL v1.0.
## v0.4.8
- CLI issues fixed in v1.0.6 so loader again verifies if loader resources are missing / corrupt on startup

View file

@ -39,14 +39,23 @@ target_sources(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/entry.cpp)
add_subdirectory(codegen)
add_custom_target(CodegenRun ALL
message(STATUS ${GEODE_CODEGEN_PATH}/Geode/GeneratedSource.cpp)
add_custom_command(
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/bindings/GeometryDash.bro
${CMAKE_CURRENT_SOURCE_DIR}/bindings/Cocos2d.bro
${CMAKE_CURRENT_SOURCE_DIR}/bindings/Entry.bro
COMMAND Codegen ${GEODE_TARGET_PLATFORM} bindings ${GEODE_CODEGEN_PATH}
COMMAND echo codegen > ${GEODE_CODEGEN_PATH}/.stamp
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Run Codegen"
BYPRODUCTS ${GEODE_CODEGEN_PATH}/Geode/GeneratedSource.cpp
OUTPUT ${GEODE_CODEGEN_PATH}/Geode/GeneratedSource.cpp ${GEODE_CODEGEN_PATH}/.stamp
)
add_custom_target(CodegenRun
DEPENDS ${GEODE_CODEGEN_PATH}/.stamp
)
add_dependencies(${PROJECT_NAME} CodegenRun)
add_dependencies(CodegenRun Codegen)
# Hacky way to supress the not generated error
if (NOT EXISTS ${GEODE_CODEGEN_PATH}/Geode/GeneratedSource.cpp)
@ -60,11 +69,7 @@ target_sources(${PROJECT_NAME} INTERFACE ${GEODE_CODEGEN_PATH}/Geode/GeneratedSo
target_include_directories(${PROJECT_NAME} INTERFACE
${GEODE_CODEGEN_PATH}
${GEODE_LOADER_PATH}/include
${GEODE_LOADER_PATH}/include/Geode/cocos/
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/include
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/support/zip_support
${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/kazmath/include
${GEODE_LOADER_PATH}/include/Geode/cocos/include
${GEODE_LOADER_PATH}/include/Geode/cocos/extensions
${GEODE_LOADER_PATH}/include/Geode/fmod
)
@ -76,7 +81,6 @@ add_subdirectory(fmt)
target_link_libraries(${PROJECT_NAME} INTERFACE filesystem fmt)
if (NOT EXISTS ${GEODE_BIN_PATH})
make_directory(${GEODE_BIN_PATH})
endif()
@ -97,9 +101,12 @@ elseif(EXISTS ${GEODE_PLATFORM_BIN_PATH})
"${GEODE_LOADER_PATH}/include/Geode/DefaultInclude.hpp"
"${GEODE_LOADER_PATH}/include/Geode/Loader.hpp"
"${GEODE_LOADER_PATH}/include/Geode/UI.hpp"
"${GEODE_LOADER_PATH}/include/Geode/cocos/cocos2dx/include/cocos2d.h"
"${GEODE_LOADER_PATH}/include/Geode/cocos/include/cocos2d.h"
"${GEODE_LOADER_PATH}/include/Geode/cocos/extensions/cocos-ext.h"
)
else()
message(FATAL_ERROR "No valid loader binary to link to! Install a pre-built binary for version ${PROJECT_VERSION} with Geode CLI or build it from source.")
message(FATAL_ERROR
"No valid loader binary to link to! Install prebuilts with `geode sdk install-prebuilts` "
"or build Geode from source."
)
endif()

View file

@ -1 +1 @@
0.5.0
0.6.0

View file

@ -36,6 +36,7 @@ class cocos2d::CCArray {
auto fastRemoveObject(cocos2d::CCObject*) = mac 0x41a520;
auto fastRemoveObjectAtIndex(unsigned int) = mac 0x41a500;
auto fastRemoveObjectAtIndexNew(unsigned int) = mac 0x41a510;
auto insertObject(cocos2d::CCObject*, unsigned int) = mac 0x41a460;
auto lastObject() = mac 0x41a360;
auto objectAtIndex(unsigned int) = mac 0x41a340, ios 0x16510c;
auto removeAllObjects() = mac 0x41a4f0, ios 0x1651f0;
@ -428,7 +429,7 @@ class cocos2d::CCMenuItemLabel {
class cocos2d::CCMenuItemSprite {
// virtual ~CCMenuItemSprite() = mac 0x1feab0;
virtual auto selected() = mac 0x1fd3f0, ios 0x02d2cc;
virtual auto selected() = mac 0x1fd3f0, ios 0x2d2cc;
virtual auto unselected() = mac 0x1fd470, ios 0x2d34c;
virtual auto setEnabled(bool) = mac 0x1fd4e0, ios 0x2d3bc;
virtual auto getNormalImage() = mac 0x1fcee0, ios 0x2cf68;

File diff suppressed because it is too large Load diff

View file

@ -166,15 +166,27 @@ function(package_geode_resources_now proname src dest header_dest)
"#include <unordered_map>\n\n"
"static const std::unordered_map<std::string, std::string> "
"LOADER_RESOURCE_HASHES {\n"
# "#include <vector>\n\n"
# "static const std::vector<std::string> "
# "LOADER_RESOURCE_FILES {\n"
)
list(APPEND HASHED_EXTENSIONS ".png")
list(APPEND HASHED_EXTENSIONS ".mp3")
list(APPEND HASHED_EXTENSIONS ".ogg")
foreach(file ${RESOURCE_FILES})
cmake_path(GET file FILENAME FILE_NAME)
if (NOT FILE_NAME STREQUAL ".geode_cache")
get_filename_component(FILE_EXTENSION ${file} EXT)
list(FIND HASHED_EXTENSIONS "${FILE_EXTENSION}" FILE_SHOULD_HASH)
if (NOT FILE_NAME STREQUAL ".geode_cache" AND NOT FILE_SHOULD_HASH EQUAL -1)
file(SHA256 ${file} COMPUTED_HASH)
list(APPEND HEADER_FILE "\t{ \"${FILE_NAME}\", \"${COMPUTED_HASH}\" },\n")
# list(APPEND HEADER_FILE "\t\"${FILE_NAME}\",\n")
endif()
endforeach()

View file

@ -1,4 +1,5 @@
#include "Shared.hpp"
#include "TypeOpt.hpp"
namespace { namespace format_strings {
@ -14,6 +15,9 @@ GEODE_INLINE GEODE_HIDDEN static uintptr_t address{index}() {{
std::string generateAddressHeader(Root& root) {
std::string output;
TypeBank bank;
bank.loadFrom(root);
for (auto& c : root.classes) {
for (auto& field : c.fields) {
@ -26,18 +30,16 @@ std::string generateAddressHeader(Root& root) {
}
if (codegen::getStatus(field) == BindStatus::Binded) {
const auto ids = bank.getIDs(fn->beginning, c.name);
address_str = fmt::format("addresser::get{}Virtual((types::member{})(&{}::{}))",
str_if("Non", !fn->beginning.is_virtual),
field.field_id,
ids.member,
field.parent,
fn->beginning.name
);
} else if (codegen::getStatus(field) == BindStatus::NeedsBinding) {
address_str = fmt::format("base::get() + 0x{:x}", codegen::platformNumber(fn->binds));
} else {
continue;
}

View file

@ -32,9 +32,9 @@ int main(int argc, char** argv) try {
}
writeFile(writeDir / "GeneratedAddress.hpp", generateAddressHeader(root));
writeFile(writeDir / "GeneratedModify.hpp", generateModifyHeader(root, writeDir / "modify")); // pretty much obsolete with a custom compiler
writeFile(writeDir / "GeneratedWrapper.hpp", generateWrapperHeader(root)); // pretty much obsolete with a custom compiler
writeFile(writeDir / "GeneratedType.hpp", generateTypeHeader(root)); // pretty much obsolete with a custom compiler
writeFile(writeDir / "GeneratedModify.hpp", generateModifyHeader(root, writeDir / "modify"));
writeFile(writeDir / "GeneratedWrapper.hpp", generateWrapperHeader(root));
writeFile(writeDir / "GeneratedType.hpp", generateTypeHeader(root));
writeFile(writeDir / "GeneratedBinding.hpp", generateBindingHeader(root, writeDir / "binding"));
writeFile(writeDir / "GeneratedPredeclare.hpp", generatePredeclareHeader(root));
writeFile(writeDir / "GeneratedSource.cpp", generateBindingSource(root));

View file

@ -1,7 +1,23 @@
#include "Shared.hpp"
#include "TypeOpt.hpp"
#include <iostream>
#include <set>
namespace { namespace format_strings {
char const* wrap_start = R"GEN(
namespace wrap {
)GEN";
char const* wrap_declare_identifier = R"GEN(
#ifndef GEODE_WRAP_{function_name}
#define GEODE_WRAP_{function_name}
GEODE_WRAPPER_FOR_IDENTIFIER({function_name})
#endif
)GEN";
char const* wrap_end = R"GEN(
}
)GEN";
// requires: class_name
char const* modify_start = R"GEN(#pragma once
#include <Geode/modify/Modify.hpp>
@ -10,6 +26,7 @@ namespace { namespace format_strings {
using namespace geode::modifier;
namespace geode::modifier {{
{wrap}
template<class Derived>
struct Modify<Derived, {class_name}> : ModifyBase<Modify<Derived, {class_name}>> {{
using ModifyBase<Modify<Derived, {class_name}>>::ModifyBase;
@ -24,7 +41,7 @@ namespace geode::modifier {{
// requires: index, class_name, arg_types, function_name, raw_arg_types, non_virtual
char const* apply_function = R"GEN(
GEODE_APPLY_MODIFY_FOR_FUNCTION({index}, {function_convention}, {class_name}, {function_name}))GEN";
GEODE_APPLY_MODIFY_FOR_FUNCTION({addr_index}, {pure_index}, {function_convention}, {class_name}, {function_name}))GEN";
char const* modify_end = R"GEN(
}
@ -40,6 +57,9 @@ namespace geode::modifier {{
std::string generateModifyHeader(Root& root, ghc::filesystem::path const& singleFolder) {
std::string output;
TypeBank bank;
bank.loadFrom(root);
for (auto c : root.classes) {
if (c.name == "cocos2d")
continue;
@ -50,11 +70,29 @@ std::string generateModifyHeader(Root& root, ghc::filesystem::path const& single
);
std::string single_output;
std::string wrap;
// wrap
wrap += format_strings::wrap_start;
std::set<std::string> used;
for (auto& f : c.fields) {
if (auto fn = f.get_fn()) {
if (fn->type == FunctionType::Normal && !used.count(fn->name)) {
used.insert(fn->name);
wrap += fmt::format(format_strings::wrap_declare_identifier,
fmt::arg("function_name", fn->name)
);
}
}
}
wrap += format_strings::wrap_end;
single_output += fmt::format(format_strings::modify_start,
fmt::arg("class_name", c.name)
fmt::arg("class_name", c.name),
fmt::arg("wrap", wrap)
);
// modify
for (auto& f : c.fields) {
if (codegen::getStatus(f) != BindStatus::Unbindable) {
auto begin = f.get_fn();
@ -74,7 +112,8 @@ std::string generateModifyHeader(Root& root, ghc::filesystem::path const& single
}
single_output += fmt::format(format_strings::apply_function,
fmt::arg("index", f.field_id),
fmt::arg("addr_index", f.field_id),
fmt::arg("pure_index", bank.getPure(*begin, c.name)),
fmt::arg("class_name", c.name),
fmt::arg("function_name", function_name),
fmt::arg("function_convention", codegen::getConvention(f))

View file

@ -175,113 +175,4 @@ namespace codegen {
if (index == std::string::npos) return s;
return s.substr(index + 2);
}
/*
// defined : we have a symbol that is usable
inline bool isFunctionDefined(Function const& f) {
// basically this is true for
// fmod for all platforms
// cocos for windows
// all funcs without stl parameter for android
// destructors for no platforms
if (f.function_type == kDestructor) return false;
if (f.function_type == kConstructor) return false;
if (f.parent_class->name.rfind("fmod::", 0) == 0) return true;
if (f.parent_class->name.rfind("cocos2d::", 0) == 0 && codegen::platform == kWindows) return true;
if (getParameterTypes(f).find("gd::", 0) != string::npos && codegen::platform == kAndroid) return false;
if (codegen::platform == kAndroid) return true;
return false;
}
// definable : we can define it and hook it
inline bool isFunctionDefinable(Function const& f) {
// basically this is true for
// all funcs that we have the offset for
// all funcs with stl parameter for android
if (getParameterTypes(f).find("gd::", 0) != string::npos && codegen::platform == kAndroid) return true;
if (getBind(f) != "") return true;
return false;
}
inline std::string getUnqualifiedClassName(Function const& f) {
auto index = f.parent_class->name.rfind("::");
if (index == std::string::npos) return f.parent_class->name;
return f.parent_class->name.substr(index + 2);
}
inline std::string getFunctionName(Function const& f) {
return f.name;
}
inline std::string getConst(Function const& f) {
return f.is_const ? "const" : "";
}
inline std::string getConstWhitespace(Function const& f) {
return f.is_const ? " " : "";
}
inline std::string getParameterTypes(Function const& f) { //int, float
return fmt::format("{}", fmt::join(f.args, ", "));
}
inline std::string getArguments(Function const& f) { // p0, p1
return fmt::format("{}", fmt::join(f.argnames, ", "));
}
inline std::string getParameterComma(Function const& f) { // int p0, float p1
return f.args.size() > 0 ? ", " : "";
}
inline std::string getParameterTypeComma(Function const& f) { //int, float
return f.args.size() > 0 ? ", " : "";
}
inline std::string getArgumentComma(Function const& f) { // p0, p1
return f.argnames.size() > 0 ? ", " : "";
}
// defined : we have a symbol that is usable
inline bool isFunctionDefined(Function const& f) {
// basically this is true for
// fmod for all platforms
// cocos for windows
// all funcs without stl parameter for android
// destructors for no platforms
if (f.function_type == kDestructor) return false;
if (f.function_type == kConstructor) return false;
if (f.parent_class->name.rfind("fmod::", 0) == 0) return true;
if (f.parent_class->name.rfind("cocos2d::", 0) == 0 && codegen::platform == kWindows) return true;
if (getParameterTypes(f).find("gd::", 0) != string::npos && codegen::platform == kAndroid) return false;
if (codegen::platform == kAndroid) return true;
return false;
}
// definable : we can define it and hook it
inline bool isFunctionDefinable(Function const& f) {
// basically this is true for
// all funcs that we have the offset for
// all funcs with stl parameter for android
if (getParameterTypes(f).find("gd::", 0) != string::npos && codegen::platform == kAndroid) return true;
if (getBind(f) != "") return true;
return false;
}
inline std::string getConvention(Function const& f) {
if (codegen::platform != kWindows) return "DefaultConv";
switch (f.function_type) {
case kConstructor: [[fallthrough]];
case kDestructor: [[fallthrough]];
case kRegularFunction:
if (isFunctionDefined(f)) return "x86::Thiscall";
return "x86::Membercall";
case kVirtualFunction:
return "x86::Thiscall";
case kStaticFunction:
if (isFunctionDefined(f)) return "x86::Cdecl";
return "x86::Optcall";
}
return "x86::Membercall";
}*/
}

View file

@ -1,4 +1,5 @@
#include "Shared.hpp"
#include "TypeOpt.hpp"
namespace { namespace format_strings {
char const* source_start = R"CAC(
@ -16,23 +17,23 @@ using namespace geode::modifier; // types
)CAC";
char const* declare_member = R"GEN(
types::ret{index} {class_name}::{function_name}({parameters}){const} {{
auto func = Function<types::meta{index}, {convention}>({{addresses::address{index}()}});
types::ret{ret_index} {class_name}::{function_name}({parameters}){const} {{
auto func = Function<types::meta{meta_index}, {convention}>({{addresses::address{addr_index}()}});
return func(this{parameter_comma}{arguments});
}}
)GEN";
char const* declare_virtual = R"GEN(
types::ret{index} {class_name}::{function_name}({parameters}){const} {{
auto self = addresser::thunkAdjust((types::member{index})(&{class_name}::{function_name}), this);
auto func = Function<types::meta{index}, {convention}>({{addresses::address{index}()}});
types::ret{ret_index} {class_name}::{function_name}({parameters}){const} {{
auto self = addresser::thunkAdjust((types::member{member_index})(&{class_name}::{function_name}), this);
auto func = Function<types::meta{meta_index}, {convention}>({{addresses::address{addr_index}()}});
return func(self{parameter_comma}{arguments});
}}
)GEN";
char const* declare_static = R"GEN(
types::ret{index} {class_name}::{function_name}({parameters}){const} {{
auto func = Function<types::meta{index}, {convention}>({{addresses::address{index}()}});
types::ret{ret_index} {class_name}::{function_name}({parameters}){const} {{
auto func = Function<types::meta{meta_index}, {convention}>({{addresses::address{addr_index}()}});
return func({arguments});
}}
)GEN";
@ -42,7 +43,7 @@ types::ret{index} {class_name}::{function_name}({parameters}){const} {{
// basically we destruct it once by calling the gd function,
// then lock it, so that other gd destructors dont get called
if (CCDestructor::lock(this)) return;
auto func = Function<types::meta{index}, {convention}>({{addresses::address{index}()}});
auto func = Function<types::meta{meta_index}, {convention}>({{addresses::address{addr_index}()}});
func(this{parameter_comma}{arguments});
// we need to construct it back so that it uhhh ummm doesnt crash
// while going to the child destructors
@ -58,7 +59,7 @@ types::ret{index} {class_name}::{function_name}({parameters}){const} {{
// no crashes :pray:
CCDestructor::lock(this) = true;
{class_name}::~{unqualified_class_name}();
auto func = Function<types::meta{index}, {convention}>({{addresses::address{index}()}});
auto func = Function<types::meta{meta_index}, {convention}>({{addresses::address{addr_index}()}});
func(this{parameter_comma}{arguments});
}}
)GEN";
@ -75,6 +76,9 @@ types::ret{index} {class_name}::{function_name}({parameters}){const} {{
std::string generateBindingSource(Root& root) {
std::string output(format_strings::source_start);
TypeBank bank;
bank.loadFrom(root);
for (auto& c : root.classes) {
for (auto& f : c.fields) {
@ -100,7 +104,6 @@ std::string generateBindingSource(Root& root) {
fmt::arg("const", str_if(" const ", fn->beginning.is_const)),
fmt::arg("class_name", c.name),
fmt::arg("parameters", codegen::getParameters(fn->beginning)),
fmt::arg("index", f.field_id),
fmt::arg("definition", fn->inner)
);
break;
@ -110,7 +113,6 @@ std::string generateBindingSource(Root& root) {
fmt::arg("const", str_if(" const ", fn->beginning.is_const)),
fmt::arg("class_name", c.name),
fmt::arg("parameters", codegen::getParameters(fn->beginning)),
fmt::arg("index", f.field_id),
fmt::arg("definition", fn->inner),
fmt::arg("return", fn->beginning.ret.name)
);
@ -140,13 +142,18 @@ std::string generateBindingSource(Root& root) {
if (fn->beginning.is_virtual && fn->beginning.type != FunctionType::Dtor)
used_declare_format = format_strings::declare_virtual;
auto ids = bank.getIDs(fn->beginning, c.name);
output += fmt::format(used_declare_format,
fmt::arg("class_name", c.name),
fmt::arg("unqualified_class_name", codegen::getUnqualifiedClassName(c.name)),
fmt::arg("const", str_if(" const ", fn->beginning.is_const)),
fmt::arg("convention", codegen::getConvention(f)),
fmt::arg("function_name", fn->beginning.name),
fmt::arg("index", f.field_id),
fmt::arg("meta_index", ids.meta),
fmt::arg("member_index", ids.member),
fmt::arg("ret_index", ids.ret),
fmt::arg("addr_index", f.field_id),
fmt::arg("parameters", codegen::getParameters(fn->beginning)),
fmt::arg("parameter_types", codegen::getParameterTypes(fn->beginning)),
fmt::arg("arguments", codegen::getParameterNames(fn->beginning)),

View file

@ -1,84 +1,95 @@
#include "Shared.hpp"
#include "TypeOpt.hpp"
#include <set>
namespace { namespace format_strings {
char const* declare_member_type = R"GEN(
using ret{index} = {return};
using func{index} = ret{index}(*)({const}{class_name}*{parameter_type_comma}{parameter_types});
using pure{index} = ret{index}({parameter_types});
using meta{index} = ret{index}({const}{class_name}*{parameter_type_comma}{parameter_types});
using member{index} = ret{index}({class_name}::*)({parameter_types}){const};
)GEN";
char const* declare_static_type = R"GEN(
using ret{index} = {return};
using func{index} = ret{index}(*)({parameter_types});
using pure{index} = ret{index}({parameter_types});
using meta{index} = ret{index}({parameter_types});
using member{index} = func{index};
)GEN";
char const* declare_structor_type = R"GEN(
using ret{index} = void;
using func{index} = ret{index}(*)({class_name}*{parameter_type_comma}{parameter_types});
using pure{index} = ret{index}({parameter_types});
using meta{index} = ret{index}({const}{class_name}*{parameter_type_comma}{parameter_types});
using member{index} = func{index};
)GEN";
}}
static std::string getReturn(FunctionBegin const& fn, std::string const& parent) {
if (fn.type != FunctionType::Normal)
return "void";
if (fn.ret.name == "auto") {
std::vector<std::string> declvals;
for (auto& [t, n] : fn.args) {
declvals.push_back(fmt::format("std::declval<{}>()", t.name));
}
return fmt::format(
fn.is_static ? "decltype({}::{}({}))" : "decltype(std::declval<{}>().{}({}))",
parent,
fn.name,
fmt::join(declvals, ", ")
);
}
return fn.ret.name;
}
std::string generateTypeHeader(Root& root) {
std::string output;
for (auto& c : root.classes) {
for (auto& f : c.fields) {
if (codegen::getStatus(f) == BindStatus::Unbindable)
continue;
auto fn = f.get_fn();
TypeBank bank;
bank.loadFrom(root);
char const* used_format = format_strings::declare_member_type;
std::map<std::string, int> used_returns;
std::map<std::string, int> used_funcs;
std::map<std::string, int> used_pures;
if (fn->type != FunctionType::Normal) {
used_format = format_strings::declare_structor_type;
}
int i = 0;
for (auto& f : bank.typeList()) {
if (fn->is_static) {
used_format = format_strings::declare_static_type;
}
char const* return_fmt = "using ret{index} = {return};";
char const* func_fmt;
char const* pure_fmt = "ret{ret_index}({parameter_types});";
char const* meta_fmt;
char const* member_fmt;
output += fmt::format(used_format,
fmt::arg("parameter_types", codegen::getParameterTypes(*fn)),
fmt::arg("parameter_type_comma", str_if(", ", !fn->args.empty())),
fmt::arg("class_name", c.name),
fmt::arg("const", str_if(" const ", fn->is_const)),
fmt::arg("index", f.field_id),
fmt::arg("return", getReturn(*fn, c.name))
);
switch (f.type) {
case FuncType::Member:
func_fmt = "ret{ret_index}(*)( {const}{class_name}*{parameter_type_comma}{parameter_types});";
meta_fmt = "ret{ret_index}({const}{class_name}*{parameter_type_comma}{parameter_types});";
member_fmt = "ret{ret_index}({class_name}::*)({parameter_types}){const};";
break;
case FuncType::Static:
func_fmt = "ret{ret_index}(*)({parameter_types});";
meta_fmt = "ret{ret_index}({parameter_types});";
member_fmt = "func{index};";
break;
case FuncType::Structor:
func_fmt = "ret{ret_index}(*)({class_name}*{parameter_type_comma}{parameter_types});";
meta_fmt = "ret{ret_index}({const}{class_name}*{parameter_type_comma}{parameter_types});";
member_fmt = "func{index};";
break;
}
if (used_returns.count(f.return_type) == 0) {
output += fmt::format(return_fmt,
fmt::arg("index", i),
fmt::arg("return", f.return_type)
) + "\n";
used_returns[f.return_type] = i;
}
int ret_index = used_returns[f.return_type];
std::string pure_val = fmt::format(pure_fmt,
fmt::arg("ret_index", ret_index),
fmt::arg("parameter_types", fmt::join(f.parameter_types, ", "))
);
if (used_pures.count(pure_val) == 0) {
output += fmt::format("using pure{} = {}\n", i, pure_val);
used_pures[pure_val] = i;
}
std::string func_val = fmt::format(func_fmt,
fmt::arg("ret_index", ret_index),
fmt::arg("parameter_types", fmt::join(f.parameter_types, ", ")),
fmt::arg("parameter_type_comma", str_if(", ", !f.parameter_types.empty())),
fmt::arg("class_name", f.class_name),
fmt::arg("const", str_if(" const ", f.is_const))
);
std::string meta_val = fmt::format(meta_fmt,
fmt::arg("ret_index", ret_index),
fmt::arg("parameter_types", fmt::join(f.parameter_types, ", ")),
fmt::arg("parameter_type_comma", str_if(", ", !f.parameter_types.empty())),
fmt::arg("class_name", f.class_name),
fmt::arg("const", str_if(" const ", f.is_const))
);
std::string member_val = fmt::format(member_fmt,
fmt::arg("ret_index", ret_index),
fmt::arg("parameter_types", fmt::join(f.parameter_types, ", ")),
fmt::arg("class_name", f.class_name),
fmt::arg("const", str_if(" const ", f.is_const)),
fmt::arg("index", i)
);
if (used_funcs.count(func_val) == 0) {
output += fmt::format("using func{index} = {func}\nusing meta{index} = {meta}\nusing member{index} = {member}\n",
fmt::arg("index", i),
fmt::arg("func", func_val),
fmt::arg("meta", meta_val),
fmt::arg("member", member_val)
);
used_funcs[func_val] = i;
}
++i;
}
return output;

180
codegen/src/TypeOpt.hpp Normal file
View file

@ -0,0 +1,180 @@
#include "Shared.hpp"
#include <set>
#include <algorithm>
namespace {
enum class FuncType : int {
Structor,
Static,
Member
};
struct Func {
std::string return_type;
bool is_const;
std::string class_name;
std::vector<std::string> parameter_types;
FuncType type;
std::string toStr() const {
return fmt::format("{}{}{}{}{}",
return_type,
class_name,
fmt::join(parameter_types, ","),
is_const ? " const " : "",
static_cast<int>(type)
);
}
bool operator<(Func const& f) const {
return toStr() < f.toStr();
}
bool operator==(Func const& f) const {
return (
return_type == f.return_type &&
is_const == f.is_const &&
class_name == f.class_name &&
parameter_types == f.parameter_types &&
type == f.type
);
}
};
struct Ids {
int ret = -1;
int func = -1;
int pure = -1;
int meta = -1;
int member = -1;
};
class TypeBank {
std::vector<Func> m_stuff;
public:
static std::string getReturn(FunctionBegin const& fn, std::string const& parent) {
if (fn.type != FunctionType::Normal)
return "void";
if (fn.ret.name == "auto") {
std::vector<std::string> declvals;
for (auto& [t, n] : fn.args) {
declvals.push_back(fmt::format("std::declval<{}>()", t.name));
}
return fmt::format(
fn.is_static ? "decltype({}::{}({}))" : "decltype(std::declval<{}>().{}({}))",
parent,
fn.name,
fmt::join(declvals, ", ")
);
}
return fn.ret.name;
}
static Func makeFunc(FunctionBegin const& fn, std::string const& parent) {
Func f;
f.return_type = TypeBank::getReturn(fn, parent);
f.is_const = fn.is_const;
f.class_name = parent;
for (auto& arg : fn.args) {
f.parameter_types.push_back(arg.first.name);
}
if (fn.is_static)
f.type = FuncType::Static;
else if (fn.type != FunctionType::Normal)
f.type = FuncType::Structor;
else
f.type = FuncType::Member;
return f;
}
void loadFrom(Root& root) {
for (auto& c : root.classes) {
for (auto& f : c.fields) {
if (codegen::getStatus(f) == BindStatus::Unbindable)
continue;
m_stuff.push_back(TypeBank::makeFunc(*f.get_fn(), c.name));
}
}
std::sort(m_stuff.begin(), m_stuff.end());
m_stuff.erase(std::unique(m_stuff.begin(), m_stuff.end()), m_stuff.end());
}
std::vector<Func> const& typeList() { return m_stuff; }
Ids getIDs(FunctionBegin const& fn, std::string const& parent) {
Ids out;
Func in_f = TypeBank::makeFunc(fn, parent);
int i = 0;
for (auto f : m_stuff) {
if (out.ret == -1 && f.return_type == in_f.return_type) {
out.ret = i;
}
if (out.func == -1) {
if (in_f.type == FuncType::Member) {
if (f == in_f) out.func = i;
} else if (in_f.type == FuncType::Structor) {
if (
f.return_type == in_f.return_type &&
f.class_name == in_f.class_name &&
f.is_const == in_f.is_const &&
f.parameter_types == in_f.parameter_types
) out.func = i;
} else {
if (
f.return_type == in_f.return_type &&
f.parameter_types == in_f.parameter_types &&
f.type == in_f.type
) out.func = i;
}
}
if (out.meta == -1 || out.member == -1) {
Func assume_member = f;
assume_member.type = FuncType::Member;
if (in_f == assume_member) {
out.meta = i;
} else if (out.func != -1) {
out.meta = out.func;
}
}
if (out.pure == -1 && f.return_type == in_f.return_type && f.parameter_types == in_f.parameter_types) {
out.pure = i;
}
if (out.ret != -1 && out.func != -1 && out.pure != -1)
break;
++i;
}
out.member = out.func;
return out;
}
int getPure(FunctionBegin const& fn, std::string const& parent) {
Func in_f = TypeBank::makeFunc(fn, parent);
int i = 0;
for (auto f : m_stuff) {
if (f.return_type == in_f.return_type && f.parameter_types == in_f.parameter_types) {
return i;
}
++i;
}
return -1;
}
};
}

View file

@ -122,7 +122,7 @@ target_precompile_headers(${PROJECT_NAME} PRIVATE
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/UI.hpp"
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Bindings.hpp"
# "${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/Modify.hpp"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/cocos2dx/include/cocos2d.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/include/cocos2d.h"
"${CMAKE_CURRENT_SOURCE_DIR}/include/Geode/cocos/extensions/cocos-ext.h"
)

View file

@ -5,6 +5,7 @@
#include <vector>
#include <iostream>
#include <variant> // for std::monostate
#include <algorithm>
#include <Geode/platform/platform.hpp>
//#include "../utils/platform.hpp"
@ -305,6 +306,14 @@ namespace gd {
}
}
vector(std::initializer_list<T> const& input) {
auto tmp = new T[input.size()];
m_start = tmp;
m_finish = m_start + input.size();
m_capacity_end = m_start + input.size();
std::copy(input.begin(), input.end(), tmp);
}
T& front() {
return *m_start;
}

View file

@ -28,8 +28,8 @@ THE SOFTWARE.
#define __CCCAMERA_H__
#include "cocoa/CCObject.h"
#include "ccMacros.h"
#include "kazmath/mat4.h"
#include "include/ccMacros.h"
#include "kazmath/include/kazmath/mat4.h"
#include <string>
NS_CC_BEGIN

View file

@ -27,7 +27,7 @@ THE SOFTWARE.
#define __CCCONFIGURATION_H__
#include "cocoa/CCObject.h"
#include "CCGL.h"
#include "platform/CCGL.h"
#include "cocoa/CCString.h"
#include <string>

View file

@ -29,13 +29,13 @@ THE SOFTWARE.
#include "platform/CCPlatformMacros.h"
#include "cocoa/CCObject.h"
#include "ccTypes.h"
#include "include/ccTypes.h"
#include "cocoa/CCGeometry.h"
#include "cocoa/CCArray.h"
#include "CCGL.h"
#include "kazmath/mat4.h"
#include "platform/CCGL.h"
#include "kazmath/include/kazmath/mat4.h"
#include "label_nodes/CCLabelAtlas.h"
#include "ccTypeInfo.h"
#include "include/ccTypeInfo.h"
NS_CC_BEGIN

View file

@ -5,12 +5,7 @@ project(cocos-headers CXX)
add_library(cocos2d INTERFACE)
target_include_directories(cocos2d INTERFACE
cocos2dx
cocos2dx/include
cocos2dx/kazmath/include
cocos2dx/platform/win32
cocos2dx/platform/third_party/win32
cocos2dx/platform/third_party/win32/OGLES
include
extensions
)

View file

@ -27,9 +27,9 @@ THE SOFTWARE.
#ifndef __ACTIONS_CCACTION_H__
#define __ACTIONS_CCACTION_H__
#include "cocoa/CCObject.h"
#include "cocoa/CCGeometry.h"
#include "platform/CCPlatformMacros.h"
#include "../cocoa/CCObject.h"
#include "../cocoa/CCGeometry.h"
#include "../platform/CCPlatformMacros.h"
NS_CC_BEGIN

View file

@ -40,8 +40,8 @@
#include <vector>
#include "CCActionInterval.h"
#include "base_nodes/CCNode.h"
#include "cocoa/CCGeometry.h"
#include "../base_nodes/CCNode.h"
#include "../cocoa/CCGeometry.h"
NS_CC_BEGIN;

View file

@ -28,7 +28,7 @@ THE SOFTWARE.
#define __CCINSTANT_ACTION_H__
#include <string>
#include "ccTypeInfo.h"
#include "../include/ccTypeInfo.h"
#include "CCAction.h"
NS_CC_BEGIN

View file

@ -27,11 +27,11 @@ THE SOFTWARE.
#ifndef __ACTION_CCINTERVAL_ACTION_H__
#define __ACTION_CCINTERVAL_ACTION_H__
#include "base_nodes/CCNode.h"
#include "../base_nodes/CCNode.h"
#include "CCAction.h"
#include "CCProtocols.h"
#include "sprite_nodes/CCSpriteFrame.h"
#include "sprite_nodes/CCAnimation.h"
#include "../include/CCProtocols.h"
#include "../sprite_nodes/CCSpriteFrame.h"
#include "../sprite_nodes/CCAnimation.h"
#include <vector>
NS_CC_BEGIN

View file

@ -29,8 +29,8 @@ THE SOFTWARE.
#define __ACTION_CCACTION_MANAGER_H__
#include "CCAction.h"
#include "cocoa/CCArray.h"
#include "cocoa/CCObject.h"
#include "../cocoa/CCArray.h"
#include "../cocoa/CCObject.h"
NS_CC_BEGIN

View file

@ -28,8 +28,8 @@ THE SOFTWARE.
#define __CCATLAS_NODE_H__
#include "CCNode.h"
#include "CCProtocols.h"
#include "ccTypes.h"
#include "../include/CCProtocols.h"
#include "../include/ccTypes.h"
NS_CC_BEGIN

View file

@ -24,7 +24,7 @@ THE SOFTWARE.
#ifndef __CC_GL_BUFFERED_NODE__
#define __CC_GL_BUFFERED_NODE__
#include <CCGL.h>
#include "../platform/CCGL.h"
class CCGLBufferedNode
{

View file

@ -28,15 +28,15 @@
#ifndef __PLATFORM_CCNODE_H__
#define __PLATFORM_CCNODE_H__
#include "ccMacros.h"
#include "cocoa/CCAffineTransform.h"
#include "cocoa/CCArray.h"
#include "CCGL.h"
#include "shaders/ccGLStateCache.h"
#include "shaders/CCGLProgram.h"
#include "kazmath/kazmath.h"
#include "script_support/CCScriptSupport.h"
#include "CCProtocols.h"
#include "../include/ccMacros.h"
#include "../cocoa/CCAffineTransform.h"
#include "../cocoa/CCArray.h"
#include "../platform/CCGL.h"
#include "../shaders/ccGLStateCache.h"
#include "../shaders/CCGLProgram.h"
#include "../kazmath/include/kazmath/kazmath.h"
#include "../script_support/CCScriptSupport.h"
#include "../include/CCProtocols.h"
#include "Layout.hpp"
NS_CC_BEGIN

View file

@ -26,7 +26,7 @@ THE SOFTWARE.
#define __COCOA_CGAFFINETRANSFORM_H__
#include "CCGeometry.h"
#include "platform/CCPlatformMacros.h"
#include "../platform/CCPlatformMacros.h"
NS_CC_BEGIN

View file

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CCARRAY_H__
#define __CCARRAY_H__
#include "support/data_support/ccCArray.h"
#include "../support/data_support/ccCArray.h"
/**
* @addtogroup data_structures

View file

@ -25,7 +25,7 @@
#ifndef __CCDATAVISITOR_H__
#define __CCDATAVISITOR_H__
#include "platform/CCPlatformMacros.h"
#include "../platform/CCPlatformMacros.h"
#include <string>
NS_CC_BEGIN

View file

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CCDICTIONARY_H__
#define __CCDICTIONARY_H__
#include "support/data_support/uthash.h"
#include "../support/data_support/uthash.h"
#include "CCObject.h"
#include "CCArray.h"
#include "CCString.h"

View file

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CCGEMETRY_H__
#define __CCGEMETRY_H__
#include "platform/CCPlatformMacros.h"
#include "../platform/CCPlatformMacros.h"
#include "CCObject.h"
#include <math.h>

View file

@ -26,11 +26,11 @@ THE SOFTWARE.
#define __CCOBJECT_H__
#include "CCDataVisitor.h"
#include "ccMacros.h"
#include "../include/ccMacros.h"
#include <unordered_map>
// Geode macros
#include <Geode/DefaultInclude.hpp>
#include "../../DefaultInclude.hpp"
#ifdef EMSCRIPTEN
#include <GLES2/gl2.h>

View file

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __CC_ZONE_H__
#define __CC_ZONE_H__
#include "platform/CCPlatformMacros.h"
#include "../platform/CCPlatformMacros.h"
#include <stdio.h>
NS_CC_BEGIN

View file

@ -1,328 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2012 cocos2d-x.org
Copyright (c) 2008-2010 Ricardo Quesada
Copyright (c) 2011 Zynga Inc.
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __COCOS2D_H__
#define __COCOS2D_H__
// 0x00 HI ME LO
// 00 02 01 00
#define COCOS2D_VERSION 0x00020100
// Geode macros
#include <Geode/DefaultInclude.hpp>
//
// all cocos2d include files
//
#include "ccConfig.h"
// actions
#include "actions/CCAction.h"
#include "actions/CCActionInterval.h"
#include "actions/CCActionCamera.h"
#include "actions/CCActionManager.h"
#include "actions/CCActionEase.h"
#include "actions/CCActionPageTurn3D.h"
#include "actions/CCActionGrid.h"
#include "actions/CCActionProgressTimer.h"
#include "actions/CCActionGrid3D.h"
#include "actions/CCActionTiledGrid.h"
#include "actions/CCActionInstant.h"
#include "actions/CCActionTween.h"
#include "actions/CCActionCatmullRom.h"
// base_nodes
#include "base_nodes/CCNode.h"
#include "base_nodes/CCAtlasNode.h"
// cocoa
#include "cocoa/CCAffineTransform.h"
#include "cocoa/CCDictionary.h"
#include "cocoa/CCObject.h"
#include "cocoa/CCArray.h"
#include "cocoa/CCGeometry.h"
#include "cocoa/CCSet.h"
#include "cocoa/CCAutoreleasePool.h"
#include "cocoa/CCInteger.h"
#include "cocoa/CCFloat.h"
#include "cocoa/CCDouble.h"
#include "cocoa/CCBool.h"
#include "cocoa/CCString.h"
#include "cocoa/CCNS.h"
#include "cocoa/CCZone.h"
// draw nodes
#include "draw_nodes/CCDrawingPrimitives.h"
#include "draw_nodes/CCDrawNode.h"
// effects
#include "effects/CCGrabber.h"
#include "effects/CCGrid.h"
// include
#include "CCEventType.h"
#include "CCProtocols.h"
#include "ccConfig.h"
#include "ccMacros.h"
#include "ccTypes.h"
// kazmath
#include "kazmath/include/kazmath/kazmath.h"
#include "kazmath/include/kazmath/GL/matrix.h"
// keypad_dispatcher
#include "keypad_dispatcher/CCKeypadDelegate.h"
#include "keypad_dispatcher/CCKeypadDispatcher.h"
// label_nodes
#include "label_nodes/CCLabelAtlas.h"
#include "label_nodes/CCLabelTTF.h"
#include "label_nodes/CCLabelBMFont.h"
// layers_scenes_transitions_nodes
#include "layers_scenes_transitions_nodes/CCLayer.h"
#include "layers_scenes_transitions_nodes/CCScene.h"
#include "layers_scenes_transitions_nodes/CCTransition.h"
#include "layers_scenes_transitions_nodes/CCTransitionPageTurn.h"
#include "layers_scenes_transitions_nodes/CCTransitionProgress.h"
// menu_nodes
#include "menu_nodes/CCMenu.h"
#include "menu_nodes/CCMenuItem.h"
// misc_nodes
#include "misc_nodes/CCClippingNode.h"
#include "misc_nodes/CCMotionStreak.h"
#include "misc_nodes/CCProgressTimer.h"
#include "misc_nodes/CCRenderTexture.h"
// particle_nodes
#include "particle_nodes/CCParticleBatchNode.h"
#include "particle_nodes/CCParticleSystem.h"
#include "particle_nodes/CCParticleExamples.h"
#include "particle_nodes/CCParticleSystemQuad.h"
// platform
#include "platform/CCDevice.h"
#include "platform/CCCommon.h"
#include "platform/CCFileUtils.h"
#include "platform/CCImage.h"
#include "platform/CCSAXParser.h"
#include "platform/CCThread.h"
#include "platform/platform.h"
#include "platform/CCPlatformConfig.h"
#include "platform/CCPlatformMacros.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "platform/ios/CCAccelerometer.h"
#include "platform/ios/CCApplication.h"
#include "platform/ios/CCEGLView.h"
#include "platform/ios/CCGL.h"
#include "platform/ios/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_IOS
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "platform/android/CCAccelerometer.h"
#include "platform/android/CCApplication.h"
#include "platform/android/CCEGLView.h"
#include "platform/android/CCGL.h"
#include "platform/android/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY)
#include "platform/blackberry/CCAccelerometer.h"
#include "platform/blackberry/CCApplication.h"
#include "platform/blackberry/CCEGLView.h"
#include "platform/blackberry/CCGL.h"
#include "platform/blackberry/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#include "platform/win32/CCAccelerometer.h"
#include "platform/win32/CCApplication.h"
#include "platform/win32/CCEGLView.h"
#include "platform/win32/CCGL.h"
#include "platform/win32/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#include "platform/winrt/CCApplication.h"
#include "platform/winrt/CCEGLView.h"
#include "platform/winrt/CCGL.h"
#include "platform/winrt/CCStdC.h"
#include "platform/winrt/CCAccelerometer.h"
#include "platform/winrt/CCPrecompiledShaders.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
#include "platform/winrt/CCApplication.h"
#include "platform/wp8/CCEGLView.h"
#include "platform/winrt/CCGL.h"
#include "platform/winrt/CCStdC.h"
#include "platform/winrt/CCAccelerometer.h"
#include "platform/winrt/CCPrecompiledShaders.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WP8
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#include "platform/mac/CCAccelerometer.h"
#include "platform/mac/CCApplication.h"
#include "platform/mac/CCEGLView.h"
#include "platform/mac/CCGL.h"
#include "platform/mac/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_MAC
#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#include "platform/linux/CCAccelerometer.h"
#include "platform/linux/CCApplication.h"
#include "platform/linux/CCEGLView.h"
#include "platform/linux/CCGL.h"
#include "platform/linux/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
// MARMALADE CHANGE
// Added for Marmalade support
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
#include "platform/Marmalade/CCAccelerometer.h"
#include "platform/Marmalade/CCApplication.h"
#include "platform/Marmalade/CCEGLView.h"
#include "platform/Marmalade/CCGL.h"
#include "platform/Marmalade/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
#if (CC_TARGET_PLATFORM == CC_PLATFORM_NACL)
#include "platform/nacl/CCAccelerometer.h"
#include "platform/nacl/CCApplication.h"
#include "platform/nacl/CCEGLView.h"
#include "platform/nacl/CCGL.h"
#include "platform/nacl/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
#if (CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN)
#include "platform/emscripten/CCAccelerometer.h"
#include "platform/emscripten/CCApplication.h"
#include "platform/emscripten/CCEGLView.h"
#include "platform/emscripten/CCGL.h"
#include "platform/emscripten/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_EMSCRIPTEN
#if (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN)
#include "platform/tizen/CCAccelerometer.h"
#include "platform/tizen/CCApplication.h"
#include "platform/tizen/CCEGLView.h"
#include "platform/tizen/CCGL.h"
#include "platform/tizen/CCStdC.h"
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN
// script_support
#include "script_support/CCScriptSupport.h"
// shaders
#include "shaders/CCGLProgram.h"
#include "shaders/ccGLStateCache.h"
#include "shaders/CCShaderCache.h"
#include "shaders/ccShaders.h"
// sprite_nodes
#include "sprite_nodes/CCAnimation.h"
#include "sprite_nodes/CCAnimationCache.h"
#include "sprite_nodes/CCSprite.h"
#include "sprite_nodes/CCSpriteBatchNode.h"
#include "sprite_nodes/CCSpriteFrame.h"
#include "sprite_nodes/CCSpriteFrameCache.h"
// support
#include "support/ccUTF8.h"
#include "support/CCNotificationCenter.h"
#include "support/CCPointExtension.h"
#include "support/CCProfiling.h"
#include "support/user_default/CCUserDefault.h"
#include "support/CCVertex.h"
#include "support/tinyxml2/tinyxml2.h"
#include "support/zip_support/ZipUtils.h"
// text_input_node
#include "text_input_node/CCIMEDelegate.h"
#include "text_input_node/CCIMEDispatcher.h"
#include "text_input_node/CCTextFieldTTF.h"
// textures
#include "textures/CCTexture2D.h"
#include "textures/CCTextureAtlas.h"
#include "textures/CCTextureCache.h"
#include "textures/CCTexturePVR.h"
// tilemap_parallax_nodes
#include "tilemap_parallax_nodes/CCParallaxNode.h"
#include "tilemap_parallax_nodes/CCTMXLayer.h"
#include "tilemap_parallax_nodes/CCTMXObjectGroup.h"
#include "tilemap_parallax_nodes/CCTMXTiledMap.h"
#include "tilemap_parallax_nodes/CCTMXXMLParser.h"
#include "tilemap_parallax_nodes/CCTileMapAtlas.h"
// touch_dispatcher
#include "touch_dispatcher/CCTouch.h"
#include "touch_dispatcher/CCTouchDelegateProtocol.h"
#include "touch_dispatcher/CCTouchDispatcher.h"
#include "touch_dispatcher/CCTouchHandler.h"
// root
#include "CCCamera.h"
#include "CCConfiguration.h"
#include "CCDirector.h"
#include "CCScheduler.h"
// component
#include "support/component/CCComponent.h"
#include "support/component/CCComponentContainer.h"
//robtop
#include "robtop/keyboard_dispatcher/CCKeyboardDelegate.h"
#include "robtop/keyboard_dispatcher/CCKeyboardDispatcher.h"
#include "robtop/mouse_dispatcher/CCMouseDelegate.h"
#include "robtop/mouse_dispatcher/CCMouseDispatcher.h"
#include "robtop/content/CCContentManager.h"
#include "robtop/scene_nodes/CCSceneTransitionDelegate.h"
#include "robtop/xml/DS_Dictionary.h"
// #include "robtop/glfw/glfw3.h"
NS_CC_BEGIN
CC_DLL const char* cocos2dVersion();
NS_CC_END
#endif // __COCOS2D_H__

View file

@ -1,50 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PLATFORM_WINRT_UIACCELEROMETER_H__
#define __PLATFORM_WINRT_UIACCELEROMETER_H__
#include "platform/CCAccelerometerDelegate.h"
NS_CC_BEGIN
class CC_DLL CCAccelerometer
{
GEODE_FRIEND_MODIFY
public:
CCAccelerometer();
~CCAccelerometer();
void setDelegate(CCAccelerometerDelegate* pDelegate);
void setAccelerometerInterval(float interval);
private:
CCAcceleration m_obAccelerationValue;
CCAccelerometerDelegate* m_pAccelDelegate;
Windows::Devices::Sensors::Accelerometer^ m_accelerometer;
};
NS_CC_END
#endif

View file

@ -1,97 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_APPLICATION_WINRT_H__
#define __CC_APPLICATION_WINRT_H__
#include "CCStdC.h"
#include "platform/CCCommon.h"
#include "platform/CCApplicationProtocol.h"
#include <string>
NS_CC_BEGIN
class CCRect;
class CC_DLL CCApplication : public CCApplicationProtocol
{
GEODE_FRIEND_MODIFY
public:
CCApplication();
virtual ~CCApplication();
/**
@brief Run the message loop.
*/
int run();
/**
@brief Get current applicaiton instance.
@return Current application instance pointer.
*/
static CCApplication* sharedApplication();
GEODE_ADD(
static CCApplication* get();
);
/* override functions */
virtual void setAnimationInterval(double interval);
virtual ccLanguageType getCurrentLanguage();
/**
@brief Get target platform
*/
virtual TargetPlatform getTargetPlatform();
/**
* Sets the Resource root path.
* @deprecated Please use CCFileUtils::sharedFileUtils()->setSearchPaths() instead.
*/
CC_DEPRECATED_ATTRIBUTE void setResourceRootPath(const gd::string& rootResDir);
/**
* Gets the Resource root path.
* @deprecated Please use CCFileUtils::sharedFileUtils()->getSearchPaths() instead.
*/
CC_DEPRECATED_ATTRIBUTE const gd::string& getResourceRootPath(void);
void setStartupScriptFilename(const gd::string& startupScriptFile);
const gd::string& getStartupScriptFilename(void)
{
return m_startupScriptFilename;
}
protected:
LARGE_INTEGER m_nAnimationInterval;
gd::string m_resourceRootPath;
gd::string m_startupScriptFilename;
static CCApplication * sm_pSharedApplication;
};
NS_CC_END
#endif // __CC_APPLICATION_WINRT_H__

View file

@ -1,158 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_EGLVIEW_WINRT_H__
#define __CC_EGLVIEW_WINRT_H__
#include "CCStdC.h"
#include "platform/CCCommon.h"
#include "cocoa/CCGeometry.h"
#include "platform/CCEGLViewProtocol.h"
#include <agile.h>
#include <wrl/client.h>
#include <agile.h>
#include <DirectXMath.h>
#include "esUtil.h"
NS_CC_BEGIN
class CCEGL;
class CCEGLView;
ref class WinRTWindow sealed
{
public:
WinRTWindow(Windows::UI::Core::CoreWindow^ window);
void Initialize(Windows::UI::Core::CoreWindow^ window, Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ panel);
void setIMEKeyboardState(bool bOpen);
void swapBuffers();
private:
CCPoint GetCCPoint(Windows::UI::Core::PointerEventArgs^ args);
void OnTextKeyDown(Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void OnTextKeyUp(Object^ sender, Windows::UI::Xaml::Input::KeyRoutedEventArgs^ e);
void OnPointerWheelChanged(Windows::UI::Core::CoreWindow^, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerMoved(Windows::UI::Core::CoreWindow^, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnPointerReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::PointerEventArgs^ args);
void OnWindowSizeChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::WindowSizeChangedEventArgs^ args);
void OnLogicalDpiChanged(Platform::Object^ sender);
void OnOrientationChanged(Platform::Object^ sender);
void OnDisplayContentsInvalidated(Platform::Object^ sender);
void OnRendering(Platform::Object^ sender, Platform::Object^ args);
void OnSuspending();
void ResizeWindow();
void ShowKeyboard(Windows::UI::ViewManagement::InputPane^ inputPane, Windows::UI::ViewManagement::InputPaneVisibilityEventArgs^ args);
void HideKeyboard(Windows::UI::ViewManagement::InputPane^ inputPane, Windows::UI::ViewManagement::InputPaneVisibilityEventArgs^ args);
Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
Windows::Foundation::Point m_lastPoint;
Windows::Foundation::EventRegistrationToken m_eventToken;
bool m_lastPointValid;
bool m_textInputEnabled;
Microsoft::WRL::ComPtr<IWinrtEglWindow> m_eglWindow;
ESContext m_esContext;
Windows::UI::Xaml::Controls::TextBox^ m_textBox;
Windows::UI::Xaml::Controls::Button^ m_dummy;
friend CCEGLView;
};
class CC_DLL CCEGLView : public CCEGLViewProtocol
{
GEODE_FRIEND_MODIFY
public:
CCEGLView();
virtual ~CCEGLView();
/* override functions */
virtual bool isOpenGLReady();
virtual void end();
virtual void swapBuffers();
virtual void setFrameSize(float width, float height);
virtual void setIMEKeyboardState(bool bOpen);
void ShowKeyboard(Windows::Foundation::Rect r);
void HideKeyboard(Windows::Foundation::Rect r);
virtual bool Create(Windows::UI::Core::CoreWindow^ window, Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ panel);
void UpdateForWindowSizeChange();
void OnRendering();
void OnSuspending();
private:
Windows::Foundation::EventRegistrationToken m_eventToken;
Windows::Foundation::Point m_lastPoint;
bool m_lastPointValid;
public:
// winrt platform functions
Windows::UI::Core::CoreWindow^ getWindow() { return m_window.Get(); };
int Run();
void resize(int width, int height);
/*
* Set zoom factor for frame. This method is for debugging big resolution (e.g.new ipad) app on desktop.
*/
void setFrameZoomFactor(float fZoomFactor);
float getFrameZoomFactor();
void centerWindow();
void showCursor(bool state);
// static function
/**
@brief get the shared main open gl window
*/
static CCEGLView* sharedOpenGLView();
GEODE_ADD(
static CCEGLView* get();
);
protected:
private:
Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
bool m_running;
bool m_initialized;
bool m_bSupportTouch;
float m_fFrameZoomFactor;
WinRTWindow^ m_winRTWindow;
Windows::Foundation::Rect m_keyboardRect;
};
NS_CC_END
#endif // end of __CC_EGLVIEW_WINRT_H__

View file

@ -1,65 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_FILEUTILS_WINRT_H__
#define __CC_FILEUTILS_WINRT_H__
#include "platform/CCFileUtils.h"
#include "platform/CCPlatformMacros.h"
#include "ccTypes.h"
#include "ccTypeInfo.h"
#include <string>
#include <vector>
NS_CC_BEGIN
/**
* @addtogroup platform
* @{
*/
//! @brief Helper class to handle file operations
class CC_DLL CCFileUtilsWinRT : public CCFileUtils
{
GEODE_FRIEND_MODIFY
friend class CCFileUtils;
CCFileUtilsWinRT();
public:
/* override funtions */
bool init();
virtual gd::string getWritablePath();
virtual bool isFileExist(const gd::string& strFilePath);
virtual bool isAbsolutePath(const gd::string& strPath);
static gd::string getAppPath();
};
// end of platform group
/// @}
NS_CC_END
#endif // __CC_FILEUTILS_WINRT_H__

View file

@ -1,140 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __PLATFORM_WINRT_FREETYPE_H__
#define __PLATFORM_WINRT_FREETYPE_H__
#include "platform/CCCommon.h"
#include "platform/CCImage.h"
#include <string>
#include <vector>
#include <memory>
#define generic GenericFromFreeTypeLibrary
#define internal InternalFromFreeTypeLibrary
#include <ft2build.h>
#include <freetype/freetype.h>
#include <freetype/ftglyph.h>
#include <freetype/ftoutln.h>
#include <freetype/fttrigon.h>
#undef generic
#undef internal
NS_CC_BEGIN
typedef struct TGlyph_
{
FT_UInt index; // glyph index
FT_Vector pos; // glyph origin on the baseline
FT_Glyph image; // glyph image
} TGlyph, *PGlyph;
typedef struct FontBufferInfo
{
unsigned char* pBuffer;
unsigned long size;
} FontBufferInfo;
typedef struct FTWordInfo
{
gd::vector<TGlyph> glyphs; // glyphs for the word
FT_BBox bbox; // bounding box containing all of the glyphs in the word
} FTWordInfo;
typedef struct FTLineInfo
{
gd::vector<TGlyph> glyphs; // glyphs for the line text
FT_BBox bbox; // bounding box containing all of the glyphs in the line
unsigned int width; // width of the line
FT_Vector pen; // current pen position
} FTLineInfo;
class CC_DLL CCFreeTypeFont
{
GEODE_FRIEND_MODIFY
public:
CCFreeTypeFont();
~CCFreeTypeFont();
bool initWithString(
const char* pText,
const char* pFontName,
int nSize,
int width,
int height
);
unsigned char* getBitmap(
CCImage::ETextAlign eAlignMask,
int* outWidth,
int* outHeight
);
private:
unsigned char* loadFont(const char *pFontName, unsigned long *size);
unsigned char* CCFreeTypeFont::loadSystemFont(const char *pFontName, unsigned long *size);
FT_Error CCFreeTypeFont::initGlyphs(const char* text);
FT_Error CCFreeTypeFont::initWordGlyphs(gd::vector<TGlyph>& glyphs, const gd::string& text, FT_Vector& pen);
void compute_bbox(gd::vector<TGlyph>& glyphs, FT_BBox *abbox);
void drawText(FTLineInfo* pInfo, unsigned char* pBuffer, FT_Vector *pen);
void draw_bitmap(unsigned char* pBuffer, FT_Bitmap* bitmap,FT_Int x,FT_Int y);
void initWords(const char* text);
FT_Vector getPenForAlignment(FTLineInfo* pInfo, CCImage::ETextAlign eAlignMask, int lineNumber, int totalLines);
FT_Error addWord(const gd::string& word);
void newLine();
void endLine();
const gd::string m_space;
gd::string m_text;
gd::string m_fontName;
FT_Face m_face;
gd::vector<FTLineInfo*> m_lines;
int m_inWidth; // requested width of text box
int m_inHeight; // requested height of text box
int m_width; // final bitMap width
int m_height; // final bitMap height
int m_textWidth; // width of text text after word wrapping and line breaks
int m_textHeight; // height of text text after word wrapping and line breaks
int m_lineHeight; // height of a line for the font size
int m_windowWidth; // the width of the window
FTLineInfo* m_currentLine; // the current line object to add words to.
};
NS_CC_END
#endif

View file

@ -1,31 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCGL_H__
#define __CCGL_H__
#include "CCGL_Angle.h"
#endif // __CCGL_H__

View file

@ -1,45 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCGL_ANGLE_H__
#define __CCGL_ANGLE_H__
#include "../third_party/winrt/angleproject/include/GLES2/gl2.h"
#include "../third_party/winrt/angleproject/include/GLES2/gl2ext.h"
#include "../third_party/winrt/angleproject/src/common/winrtangle.h"
#define GL_BGRA GL_BGRA_EXT
#define glClearDepth glClearDepthf
#define glDeleteVertexArrays glDeleteVertexArraysOES
#define glGenVertexArrays glGenVertexArraysOES
#define glBindVertexArray glBindVertexArrayOES
#define glMapBuffer glMapBufferOES
#define glUnmapBuffer glUnmapBufferOES
#define GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8_OES
#define GL_WRITE_ONLY GL_WRITE_ONLY_OES
#endif // __CCGL_ANGLE_H__

View file

@ -1,43 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCGL_GL2DX_H__
#define __CCGL_GL2DX_H__
#include "gl2dx.h"
#ifndef GLchar
typedef char GLchar;
#endif
#define CC_GL_DEPTH24_STENCIL8 GL_DEPTH24_STENCIL8
// These macros are only for making CCTexturePVR.cpp complied without errors since they are not included in GLEW.
#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
#endif // __CCGL_GL2DX_H__

View file

@ -1,57 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCPTHREADWINRT_H__
#define __CCPTHREADWINRT_H__
#include "platform/CCPlatformMacros.h"
#include <Windows.h>
NS_CC_BEGIN
typedef HANDLE pthread_t;
typedef HANDLE pthread_mutex_t;
typedef int pthread_cond_t;
#define pthread_cond_wait(x, y)
void pthread_mutex_init(pthread_mutex_t* m, void* attributes);
int pthread_mutex_lock(pthread_mutex_t* m);
int pthread_mutex_unlock(pthread_mutex_t* m);
void pthread_mutex_destroy(pthread_mutex_t* m);
#define pthread_cond_destroy(x)
#define pthread_cond_signal(x)
#define pthread_cond_init(x, y)
NS_CC_END
#endif // __CCPTHREADWINRT_H__

View file

@ -1,54 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCPLATFORMDEFINE_H__
#define __CCPLATFORMDEFINE_H__
#if defined(_USRDLL)
#define CC_DLL __declspec(dllexport)
#else /* use a DLL library */
#define CC_DLL __declspec(dllimport)
#endif
#include <assert.h>
#if CC_DISABLE_ASSERT > 0
#define CC_ASSERT(cond)
#else
#define CC_ASSERT(cond) assert(cond)
#endif
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
/* Define NULL pointer value */
#ifndef NULL
#ifdef __cplusplus
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#endif /* __CCPLATFORMDEFINE_H__*/

View file

@ -1,98 +0,0 @@
/****************************************************************************
Copyright (c) 2010-2013 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_PRECOMPILED_SHADERS_H__
#define __CC_PRECOMPILED_SHADERS_H__
#include "platform/CCCommon.h"
#include "CCGL.h"
#include <string>
#include <vector>
#include <map>
NS_CC_BEGIN
typedef struct _PrecompiledProgram
{
const char* key;
const unsigned char* program;
int length;
} PrecompiledProgram;
typedef struct _CompiledProgram
{
gd::string key;
gd::vector<unsigned char> program;
int length;
} CompiledProgram;
#if 0
const unsigned char gKey[] = "hello";
const unsigned char gProgram[] = "world";
PrecompiledShader gFoo = {gKey, gProgram, 100};
PrecompiledShader shaders[] = {gFoo, gFoo};
#endif
class CC_DLL CCPrecompiledShaders
{
GEODE_FRIEND_MODIFY
public:
CCPrecompiledShaders();
virtual ~CCPrecompiledShaders();
/**
@brief Get current precompiled shaders instance.
@return Current precompiled shaders instance pointer.
*/
static CCPrecompiledShaders* sharedPrecompiledShaders();
gd::string addShaders(const GLchar* vShaderByteArray, const GLchar* fShaderByteArray);
bool addProgram(GLuint program, const gd::string& id);
bool loadProgram(GLuint program, const GLchar* vShaderByteArray, const GLchar* fShaderByteArray);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
void savePrecompiledShaders();
#endif
protected:
void savePrecompiledPrograms(Windows::Storage::StorageFolder^ folder);
void loadPrecompiledPrograms();
void Init();
gd::map<gd::string, CompiledProgram*> m_programs;
gd::map<gd::string, PrecompiledProgram*> m_precompiledPrograms;
bool m_isDirty;
};
NS_CC_END
#endif // __CC_PRECOMPILED_SHADERS_H__

View file

@ -1,89 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CC_STD_C_H__
#define __CC_STD_C_H__
#include "platform/CCPlatformMacros.h"
#include <float.h>
// for math.h on win32 platform
#if !defined(_USE_MATH_DEFINES)
#define _USE_MATH_DEFINES // make M_PI can be use
#endif
#if !defined(isnan)
#define isnan _isnan
#endif
#ifndef snprintf
#define snprintf _snprintf
#endif
#include <math.h>
#include <string.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
// for MIN MAX and sys/time.h on win32 platform
#define MIN min
#define MAX max
#if _MSC_VER >= 1600
#include <stdint.h>
#else
#include "./compat/stdint.h"
#endif
#define _WINSOCKAPI_
// Structure timeval has define in winsock.h, include windows.h for it.
#if CC_TARGET_PLATFORM == CC_PLATFORM_WP8
#include <WinSock2.h>
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
#include <Windows.h>
//#include <WinSock2.h>
#undef timeval
struct timeval
{
long tv_sec; // seconds
long tv_usec; // microSeconds
};
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_WP8
struct timezone
{
int tz_minuteswest;
int tz_dsttime;
};
int CC_DLL gettimeofday(struct timeval *, struct timezone *);
#endif // __CC_STD_C_H__

View file

@ -1,55 +0,0 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) Microsoft Open Technologies, Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCWINRT_UTILS_H__
#define __CCWINRT_UTILS_H__
#include "platform/CCPlatformMacros.h"
#include "cocoa/CCDictionary.h"
#include <wrl/client.h>
#include <ppl.h>
#include <ppltasks.h>
#include <string>
NS_CC_BEGIN
std::wstring CC_DLL CCUtf8ToUnicode(const char * pszUtf8Str, unsigned len = -1);
gd::string CC_DLL CCUnicodeToUtf8(const wchar_t* pwszStr);
gd::string PlatformStringToString(Platform::String^ s);
// Method to convert a length in device-independent pixels (DIPs) to a length in physical pixels.
float ConvertDipsToPixels(float dips);
float getScaledDPIValue(float v);
Concurrency::task<Platform::Array<byte>^> ReadDataAsync(Platform::String^ path);
NS_CC_END
#endif // __CCWINRT_UTILS_H__

View file

@ -1,78 +0,0 @@
//-----------------------------------------------------------------------------------------------
// Copyright (c) 2012 Andrew Garrison
//-----------------------------------------------------------------------------------------------
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//-----------------------------------------------------------------------------------------------
#pragma once
#include <wrl/client.h>
#include <d3d11_1.h>
#include <d2d1_1.h>
#include <d2d1effects.h>
#include <dwrite_1.h>
#include <wincodec.h>
#include <agile.h>
#include <DirectXMath.h>
#include "DirectXHelper.h"
#pragma warning (disable: 4449)
using namespace Windows::UI::ViewManagement;
// Helper class that initializes DirectX APIs
ref class DirectXBase abstract
{
internal:
DirectXBase();
public:
virtual void Initialize(Windows::UI::Core::CoreWindow^ window, Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ panel, float dpi);
virtual void CreateDeviceIndependentResources();
virtual void CreateDeviceResources();
virtual void SetDpi(float dpi);
virtual void CreateWindowSizeDependentResources();
virtual void UpdateForWindowSizeChange();
virtual void Present();
virtual float ConvertDipsToPixels(float dips);
protected private:
Platform::Agile<Windows::UI::Core::CoreWindow> m_window;
Windows::UI::Xaml::Controls::SwapChainBackgroundPanel^ m_panel;
// Direct2D Objects
Microsoft::WRL::ComPtr<ID2D1Factory1> m_d2dFactory;
Microsoft::WRL::ComPtr<ID2D1Device> m_d2dDevice;
Microsoft::WRL::ComPtr<ID2D1DeviceContext> m_d2dContext;
Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_d2dTargetBitmap;
// DirectWrite & Windows Imaging Component Objects
Microsoft::WRL::ComPtr<IDWriteFactory1> m_dwriteFactory;
Microsoft::WRL::ComPtr<IWICImagingFactory2> m_wicFactory;
// Direct3D Objects
Microsoft::WRL::ComPtr<ID3D11Device1> m_d3dDevice;
Microsoft::WRL::ComPtr<ID3D11DeviceContext1> m_d3dContext;
Microsoft::WRL::ComPtr<IDXGISwapChain1> m_swapChain;
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> m_renderTargetView;
Microsoft::WRL::ComPtr<ID3D11DepthStencilView> m_depthStencilView;
D3D_FEATURE_LEVEL m_featureLevel;
Windows::Foundation::Size m_renderTargetSize;
Windows::Foundation::Rect m_windowBounds;
float m_dpi;
};
#pragma warning (default: 4449)

View file

@ -1,32 +0,0 @@
//-----------------------------------------------------------------------------------------------
// Copyright (c) 2012 Andrew Garrison
//-----------------------------------------------------------------------------------------------
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software
// and associated documentation files (the "Software"), to deal in the Software without
// restriction, including without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or
// substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
// BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//-----------------------------------------------------------------------------------------------
#pragma once
// Helper utilities to make Win32 APIs work with exceptions.
namespace DX
{
inline void ThrowIfFailed(HRESULT hr)
{
if (FAILED(hr))
{
// Set a breakpoint on this line to catch Win32 API errors.
throw Platform::Exception::CreateException(hr);
}
}
}

View file

@ -1,247 +0,0 @@
// ISO C9x compliant stdint.h for Microsoft Visual Studio
// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
//
// Copyright (c) 2006-2008 Alexander Chemeris
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// 3. The name of the author may be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef _MSC_VER // [
#error "Use this header only with Microsoft Visual C++ compilers!"
#endif // _MSC_VER ]
#ifndef _MSC_STDINT_H_ // [
#define _MSC_STDINT_H_
#if _MSC_VER > 1000
#pragma once
#endif
#include <limits.h>
// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
// or compiler give many errors like this:
// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
#ifdef __cplusplus
extern "C" {
#endif
# include <wchar.h>
#ifdef __cplusplus
}
#endif
// Define _W64 macros to mark types changing their size, like intptr_t.
#ifndef _W64
# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
# define _W64 __w64
# else
# define _W64
# endif
#endif
// 7.18.1 Integer types
// 7.18.1.1 Exact-width integer types
// Visual Studio 6 and Embedded Visual C++ 4 doesn't
// realize that, e.g. char has the same size as __int8
// so we give up on __intX for them.
#if (_MSC_VER < 1300)
typedef signed char int8_t;
typedef signed short int16_t;
typedef signed int int32_t;
typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;
#else
typedef signed __int8 int8_t;
typedef signed __int16 int16_t;
typedef signed __int32 int32_t;
typedef unsigned __int8 uint8_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
#endif
typedef signed __int64 int64_t;
typedef unsigned __int64 uint64_t;
// 7.18.1.2 Minimum-width integer types
typedef int8_t int_least8_t;
typedef int16_t int_least16_t;
typedef int32_t int_least32_t;
typedef int64_t int_least64_t;
typedef uint8_t uint_least8_t;
typedef uint16_t uint_least16_t;
typedef uint32_t uint_least32_t;
typedef uint64_t uint_least64_t;
// 7.18.1.3 Fastest minimum-width integer types
typedef int8_t int_fast8_t;
typedef int16_t int_fast16_t;
typedef int32_t int_fast32_t;
typedef int64_t int_fast64_t;
typedef uint8_t uint_fast8_t;
typedef uint16_t uint_fast16_t;
typedef uint32_t uint_fast32_t;
typedef uint64_t uint_fast64_t;
// 7.18.1.4 Integer types capable of holding object pointers
#ifdef _WIN64 // [
typedef signed __int64 intptr_t;
typedef unsigned __int64 uintptr_t;
#else // _WIN64 ][
typedef _W64 signed int intptr_t;
typedef _W64 unsigned int uintptr_t;
#endif // _WIN64 ]
// 7.18.1.5 Greatest-width integer types
typedef int64_t intmax_t;
typedef uint64_t uintmax_t;
// 7.18.2 Limits of specified-width integer types
#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
// 7.18.2.1 Limits of exact-width integer types
#define INT8_MIN ((int8_t)_I8_MIN)
#define INT8_MAX _I8_MAX
#define INT16_MIN ((int16_t)_I16_MIN)
#define INT16_MAX _I16_MAX
#define INT32_MIN ((int32_t)_I32_MIN)
#define INT32_MAX _I32_MAX
#define INT64_MIN ((int64_t)_I64_MIN)
#define INT64_MAX _I64_MAX
#define UINT8_MAX _UI8_MAX
#define UINT16_MAX _UI16_MAX
#define UINT32_MAX _UI32_MAX
#define UINT64_MAX _UI64_MAX
// 7.18.2.2 Limits of minimum-width integer types
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
// 7.18.2.3 Limits of fastest minimum-width integer types
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
// 7.18.2.4 Limits of integer types capable of holding object pointers
#ifdef _WIN64 // [
# define INTPTR_MIN INT64_MIN
# define INTPTR_MAX INT64_MAX
# define UINTPTR_MAX UINT64_MAX
#else // _WIN64 ][
# define INTPTR_MIN INT32_MIN
# define INTPTR_MAX INT32_MAX
# define UINTPTR_MAX UINT32_MAX
#endif // _WIN64 ]
// 7.18.2.5 Limits of greatest-width integer types
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
// 7.18.3 Limits of other integer types
#ifdef _WIN64 // [
# define PTRDIFF_MIN _I64_MIN
# define PTRDIFF_MAX _I64_MAX
#else // _WIN64 ][
# define PTRDIFF_MIN _I32_MIN
# define PTRDIFF_MAX _I32_MAX
#endif // _WIN64 ]
#define SIG_ATOMIC_MIN INT_MIN
#define SIG_ATOMIC_MAX INT_MAX
#ifndef SIZE_MAX // [
# ifdef _WIN64 // [
# define SIZE_MAX _UI64_MAX
# else // _WIN64 ][
# define SIZE_MAX _UI32_MAX
# endif // _WIN64 ]
#endif // SIZE_MAX ]
// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
#ifndef WCHAR_MIN // [
# define WCHAR_MIN 0
#endif // WCHAR_MIN ]
#ifndef WCHAR_MAX // [
# define WCHAR_MAX _UI16_MAX
#endif // WCHAR_MAX ]
#define WINT_MIN 0
#define WINT_MAX _UI16_MAX
#endif // __STDC_LIMIT_MACROS ]
// 7.18.4 Limits of other integer types
#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
// 7.18.4.1 Macros for minimum-width integer constants
#define INT8_C(val) val##i8
#define INT16_C(val) val##i16
#define INT32_C(val) val##i32
#define INT64_C(val) val##i64
#define UINT8_C(val) val##ui8
#define UINT16_C(val) val##ui16
#define UINT32_C(val) val##ui32
#define UINT64_C(val) val##ui64
// 7.18.4.2 Macros for greatest-width integer constants
#define INTMAX_C INT64_C
#define UINTMAX_C UINT64_C
#endif // __STDC_CONSTANT_MACROS ]
#endif // _MSC_STDINT_H_ ]

View file

@ -1,93 +0,0 @@
/*
* sha1.h
* Copyright (C) The Internet Society (2001). All Rights Reserved.
* This document and translations of it may be copied and furnished to others,
* and derivative works that comment on or otherwise explain it or assist in its
* implementation may be prepared, copied, published and distributed, in whole or in part,
* without restriction of any kind, provided that the above copyright notice and this paragraph
* are included on all such copies and derivative works. However, this document itself may not
* be modified in any way, such as by removing the copyright notice or references to the Internet Society
* or other Internet organizations, except as needed for the purpose of developing Internet standards in
* which case the procedures for copyrights defined in the Internet Standards process must be followed,
* or as required to translate it into languages other than English.
*
* The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.
*
* This document and the information contained herein is provided on an "AS IS" basis and
* THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS
* OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
*
*
* Description:
* This is the header file for code which implements the Secure
* Hashing Algorithm 1 as defined in FIPS PUB 180-1 published
* April 17, 1995.
*
* Many of the variable names in this code, especially the
* single character names, were used because those were the names
* used in the publication.
*
* Please read the file sha1.c for more information.
*
*/
#ifndef _SHA1_H_
#define _SHA1_H_
#include <stdint.h>
/*
* If you do not have the ISO standard stdint.h header file, then you
* must typdef the following:
* name meaning
* uint32_t unsigned 32 bit integer
* uint8_t unsigned 8 bit integer (i.e., unsigned char)
* int_least16_t integer of >= 16 bits
*
*/
#ifndef _SHA_enum_
#define _SHA_enum_
enum
{
shaSuccess = 0,
shaNull, /* Null pointer parameter */
shaInputTooLong, /* input data too long */
shaStateError /* called Input after Result */
};
#endif
#define SHA1HashSize 20
/*
* This structure will hold context information for the SHA-1
* hashing operation
*/
typedef struct SHA1Context
{
uint32_t Intermediate_Hash[SHA1HashSize/4]; /* Message Digest */
uint32_t Length_Low; /* Message length in bits */
uint32_t Length_High; /* Message length in bits */
/* Index into message block array */
int_least16_t Message_Block_Index;
uint8_t Message_Block[64]; /* 512-bit message blocks */
int Computed; /* Is the digest computed? */
int Corrupted; /* Is the message digest corrupted? */
} SHA1Context;
/*
* Function Prototypes
*/
int SHA1Reset( SHA1Context *);
int SHA1Input( SHA1Context *,
const uint8_t *,
unsigned int);
int SHA1Result( SHA1Context *,
uint8_t Message_Digest[SHA1HashSize]);
void SHA1ConvertMessageToString(uint8_t *hash_binary, char* hash_string);
#endif

View file

@ -30,8 +30,8 @@
#ifndef __CCDRAWNODES_CCDRAW_NODE_H__
#define __CCDRAWNODES_CCDRAW_NODE_H__
#include "base_nodes/CCNode.h"
#include "ccTypes.h"
#include "../base_nodes/CCNode.h"
#include "../include/ccTypes.h"
NS_CC_BEGIN

View file

@ -40,9 +40,9 @@ THE SOFTWARE.
#define __CCDRAWING_PRIMITIVES__
#include "ccTypes.h"
#include "ccMacros.h"
#include "cocoa/CCGeometry.h" // for CCPoint
#include "../include/ccTypes.h"
#include "../include/ccMacros.h"
#include "../cocoa/CCGeometry.h" // for CCPoint
/**
@file

View file

@ -25,9 +25,9 @@ THE SOFTWARE.
#ifndef __EFFECTS_CCGRABBER_H__
#define __EFFECTS_CCGRABBER_H__
#include "CCConfiguration.h"
#include "cocoa/CCObject.h"
#include "CCGL.h"
#include "../CCConfiguration.h"
#include "../cocoa/CCObject.h"
#include "../platform/CCGL.h"
NS_CC_BEGIN

View file

@ -25,15 +25,15 @@ THE SOFTWARE.
#ifndef __EFFECTS_CCGRID_H__
#define __EFFECTS_CCGRID_H__
#include "cocoa/CCObject.h"
#include "base_nodes/CCNode.h"
#include "CCCamera.h"
#include "ccTypes.h"
#include "textures/CCTexture2D.h"
#include "CCDirector.h"
#include "kazmath/mat4.h"
#include "../cocoa/CCObject.h"
#include "../base_nodes/CCNode.h"
#include "../CCCamera.h"
#include "../include/ccTypes.h"
#include "../textures/CCTexture2D.h"
#include "../CCDirector.h"
#include "../kazmath/include/kazmath/mat4.h"
#ifdef EMSCRIPTEN
#include "base_nodes/CCGLBufferedNode.h"
#include "../base_nodes/CCGLBufferedNode.h"
#endif // EMSCRIPTEN
NS_CC_BEGIN

View file

@ -26,13 +26,13 @@
#ifndef __AssetsManager__
#define __AssetsManager__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../include/cocos2d.h"
#include "../ExtensionMacros.h"
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WINRT) && (CC_TARGET_PLATFORM != CC_PLATFORM_WP8)
#include <string>
#include <curl/curl.h>
#include <pthread.h>
#include "../../platform/IncludeCurl.h"
#include "../../platform/IncludePThread.h"
NS_CC_EXT_BEGIN

View file

@ -32,7 +32,7 @@
#include "CCInvocation.h"
#include "CCControlUtils.h"
#include "cocos2d.h"
#include "../../../include/cocos2d.h"
NS_CC_EXT_BEGIN

View file

@ -34,7 +34,7 @@
#ifndef __CCCONTROL_UTILS_H__
#define __CCCONTROL_UTILS_H__
#include "sprite_nodes/CCSprite.h"
#include "../../../sprite_nodes/CCSprite.h"
#include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN

View file

@ -30,7 +30,7 @@
#ifndef __CCINVOCATION_H__
#define __CCINVOCATION_H__
#include "cocoa/CCObject.h"
#include "../../../cocoa/CCObject.h"
#include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN

View file

@ -28,7 +28,7 @@ THE SOFTWARE.
#ifndef __CCScale9Sprite_H__
#define __CCScale9Sprite_H__
#include "cocos2d.h"
#include "../../../include/cocos2d.h"
#include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN

View file

@ -26,8 +26,8 @@
#ifndef __CCEDITTEXT_H__
#define __CCEDITTEXT_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../../include/cocos2d.h"
#include "../../ExtensionMacros.h"
#include "../CCControlExtension/CCControlExtensions.h"
NS_CC_EXT_BEGIN

View file

@ -26,8 +26,8 @@
#ifndef __CCEditBoxIMPL_H__
#define __CCEditBoxIMPL_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../../include/cocos2d.h"
#include "../../ExtensionMacros.h"
#include "CCEditBox.h"
NS_CC_EXT_BEGIN

View file

@ -26,11 +26,11 @@
#ifndef __CCEDITBOXIMPLANDROID_H__
#define __CCEDITBOXIMPLANDROID_H__
#include "cocos2d.h"
#include "../../../include/cocos2d.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include "ExtensionMacros.h"
#include "../../ExtensionMacros.h"
#include "CCEditBoxImpl.h"
NS_CC_EXT_BEGIN

View file

@ -26,11 +26,11 @@
#ifndef __CCEditBoxIMPLIOS_H__
#define __CCEditBoxIMPLIOS_H__
#include "cocos2d.h"
#include "../../../include/cocos2d.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
#include "ExtensionMacros.h"
#include "../../ExtensionMacros.h"
#include "CCEditBoxImpl.h"
#import <Foundation/Foundation.h>

View file

@ -26,14 +26,14 @@
#ifndef __CCEditBoxIMPLMAC_H__
#define __CCEditBoxIMPLMAC_H__
#include "cocos2d.h"
#include "../../../include/cocos2d.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
#include "ExtensionMacros.h"
#include "../../ExtensionMacros.h"
#include "CCEditBoxImpl.h"
@interface CustomNSTextField : NSTextField

View file

@ -27,11 +27,11 @@
#ifndef __CCEDITBOXIMPLTIZEN_H__
#define __CCEDITBOXIMPLTIZEN_H__
#include "cocos2d.h"
#include "../../../include/cocos2d.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN)
#include "ExtensionMacros.h"
#include "../../ExtensionMacros.h"
#include "CCEditBoxImpl.h"
NS_CC_EXT_BEGIN

View file

@ -26,11 +26,11 @@
#ifndef __CCEditBoxIMPLWIN_H__
#define __CCEditBoxIMPLWIN_H__
#include "cocos2d.h"
#include "../../../include/cocos2d.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
#include "ExtensionMacros.h"
#include "../../ExtensionMacros.h"
#include "CCEditBoxImpl.h"
NS_CC_EXT_BEGIN

View file

@ -24,7 +24,7 @@ THE SOFTWARE.
#ifndef __CCEditBoxIMPLWP8_H__
#define __CCEditBoxIMPLWP8_H__
#include "ExtensionMacros.h"
#include "../../ExtensionMacros.h"
#include "CCEditBoxImpl.h"
NS_CC_EXT_BEGIN

View file

@ -26,8 +26,8 @@
#ifndef __CCSCROLLVIEW_H__
#define __CCSCROLLVIEW_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../../include/cocos2d.h"
#include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN

View file

@ -26,8 +26,8 @@
#ifndef __CCSORTING_H__
#define __CCSORTING_H__
#include "cocoa/CCArray.h"
#include "ExtensionMacros.h"
#include "../../../cocoa/CCArray.h"
#include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN
/**

View file

@ -26,7 +26,7 @@
#ifndef __CCTABLEVIEWCELL_H__
#define __CCTABLEVIEWCELL_H__
#include "base_nodes/CCNode.h"
#include "../../../base_nodes/CCNode.h"
#include "CCSorting.h"
NS_CC_EXT_BEGIN

View file

@ -2,7 +2,7 @@
#define __COCOS2D_EXT_H__
#include "ExtensionMacros.h"
#include "ccMacros.h"
#include "../include/ccMacros.h"
#include "GUI/CCControlExtension/CCControlExtensions.h"
#include "GUI/CCScrollView/CCScrollView.h"

View file

@ -26,8 +26,8 @@
#ifndef __CCHTTPREQUEST_H__
#define __CCHTTPREQUEST_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../include/cocos2d.h"
#include "../ExtensionMacros.h"
#include "HttpRequest.h"
#include "HttpResponse.h"

View file

@ -25,8 +25,8 @@
#ifndef __HTTP_REQUEST_H__
#define __HTTP_REQUEST_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../include/cocos2d.h"
#include "../ExtensionMacros.h"
NS_CC_EXT_BEGIN

View file

@ -25,8 +25,8 @@
#ifndef __HTTP_RESPONSE__
#define __HTTP_RESPONSE__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../include/cocos2d.h"
#include "../ExtensionMacros.h"
#include "HttpRequest.h"
NS_CC_EXT_BEGIN

View file

@ -30,9 +30,9 @@
#ifndef __CC_WEBSOCKET_H__
#define __CC_WEBSOCKET_H__
#include "ExtensionMacros.h"
#include "cocos2d.h"
#include "libwebsockets.h"
#include "../ExtensionMacros.h"
#include "../../include/cocos2d.h"
#include <libwebsockets.h>
#include <list>
NS_CC_EXT_BEGIN

View file

@ -23,8 +23,8 @@
#ifndef __PHYSICSNODES_DEBUGNODE_H__
#define __PHYSICSNODES_DEBUGNODE_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../include/cocos2d.h"
#include "../ExtensionMacros.h"
#if CC_ENABLE_CHIPMUNK_INTEGRATION

View file

@ -22,8 +22,8 @@
#ifndef __PHYSICSNODES_CCPHYSICSSPRITE_H__
#define __PHYSICSNODES_CCPHYSICSSPRITE_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "../../include/cocos2d.h"
#include "../ExtensionMacros.h"
#if CC_ENABLE_CHIPMUNK_INTEGRATION
#include "chipmunk.h"

View file

@ -26,7 +26,7 @@
#ifndef SPINE_ANIMATIONSTATE_H_
#define SPINE_ANIMATIONSTATE_H_
#include <spine/AnimationStateData.h>
#include "AnimationStateData.h"
namespace cocos2d { namespace extension {

Some files were not shown because too many files have changed in this diff Show more