summaryrefslogtreecommitdiff
path: root/source/modules/asura-core
diff options
context:
space:
mode:
Diffstat (limited to 'source/modules/asura-core')
-rw-r--r--source/modules/asura-core/application.cpp2
-rw-r--r--source/modules/asura-core/core_module.cpp3
-rw-r--r--source/modules/asura-core/core_module.h2
-rw-r--r--source/modules/asura-core/font/string.cpp752
-rw-r--r--source/modules/asura-core/font/string.hpp1189
-rw-r--r--source/modules/asura-core/graphics/binding/_canvas.cpp3
-rw-r--r--source/modules/asura-core/graphics/binding/_color32.cpp6
-rw-r--r--source/modules/asura-core/graphics/binding/_shader.cpp18
-rw-r--r--source/modules/asura-core/graphics/canvas.cpp13
-rw-r--r--source/modules/asura-core/graphics/color.cpp15
-rw-r--r--source/modules/asura-core/graphics/gl.cpp17
-rw-r--r--source/modules/asura-core/graphics/gl.h19
-rw-r--r--source/modules/asura-core/graphics/image.cpp15
-rw-r--r--source/modules/asura-core/graphics/image.h8
-rw-r--r--source/modules/asura-core/graphics/mesh2d.h2
-rw-r--r--source/modules/asura-core/graphics/render_target.h2
-rw-r--r--source/modules/asura-core/graphics/shader.cpp11
-rw-r--r--source/modules/asura-core/graphics/sprite_batch.h2
-rw-r--r--source/modules/asura-core/graphics/texture.cpp19
-rw-r--r--source/modules/asura-core/graphics/texture.h18
-rw-r--r--source/modules/asura-core/image/binding/_image_data.cpp (renamed from source/modules/asura-core/graphics/binding/_image_data.cpp)0
-rw-r--r--source/modules/asura-core/image/binding/_image_decode_task.cpp (renamed from source/modules/asura-core/graphics/binding/_image_decode_task.cpp)0
-rw-r--r--source/modules/asura-core/image/image_data.cpp (renamed from source/modules/asura-core/graphics/image_data.cpp)7
-rw-r--r--source/modules/asura-core/image/image_data.h (renamed from source/modules/asura-core/graphics/image_data.h)4
-rw-r--r--source/modules/asura-core/image/image_decode_task.cpp (renamed from source/modules/asura-core/graphics/image_decode_task.cpp)0
-rw-r--r--source/modules/asura-core/image/image_decode_task.h (renamed from source/modules/asura-core/graphics/image_decode_task.h)4
-rw-r--r--source/modules/asura-core/image/image_decoder.h (renamed from source/modules/asura-core/graphics/image_decoder.h)6
-rw-r--r--source/modules/asura-core/image/png_decoder.cpp (renamed from source/modules/asura-core/graphics/png_decoder.cpp)0
-rw-r--r--source/modules/asura-core/image/png_decoder.h (renamed from source/modules/asura-core/graphics/png_decoder.h)0
-rw-r--r--source/modules/asura-core/image/stb_decoder.cpp (renamed from source/modules/asura-core/graphics/stb_decoder.cpp)9
-rw-r--r--source/modules/asura-core/image/stb_decoder.h (renamed from source/modules/asura-core/graphics/stb_decoder.h)0
-rw-r--r--source/modules/asura-core/mesh/mesh2d_data.cpp (renamed from source/modules/asura-core/graphics/mesh2d_data.cpp)0
-rw-r--r--source/modules/asura-core/mesh/mesh2d_data.h (renamed from source/modules/asura-core/graphics/mesh2d_data.h)0
-rw-r--r--source/modules/asura-core/threading/thread_ex.cpp1
-rw-r--r--source/modules/asura-core/window/binding/_window.cpp (renamed from source/modules/asura-core/wnd/binding/_window.cpp)4
-rw-r--r--source/modules/asura-core/window/window.cpp (renamed from source/modules/asura-core/wnd/window.cpp)24
-rw-r--r--source/modules/asura-core/window/window.h (renamed from source/modules/asura-core/wnd/window.h)38
-rw-r--r--source/modules/asura-core/window/window_impl_glew.cpp (renamed from source/modules/asura-core/wnd/window_impl_glew.cpp)0
-rw-r--r--source/modules/asura-core/window/window_impl_glew.h (renamed from source/modules/asura-core/wnd/window_impl_glew.h)0
-rw-r--r--source/modules/asura-core/window/window_impl_glut.cpp (renamed from source/modules/asura-core/wnd/window_impl_glut.cpp)0
-rw-r--r--source/modules/asura-core/window/window_impl_glut.h (renamed from source/modules/asura-core/wnd/window_impl_glut.h)0
-rw-r--r--source/modules/asura-core/window/window_impl_sdl.cpp (renamed from source/modules/asura-core/wnd/window_impl_sdl.cpp)49
-rw-r--r--source/modules/asura-core/window/window_impl_sdl.h (renamed from source/modules/asura-core/wnd/window_impl_sdl.h)6
43 files changed, 1179 insertions, 1089 deletions
diff --git a/source/modules/asura-core/application.cpp b/source/modules/asura-core/application.cpp
index 1ef9414..a630d4c 100644
--- a/source/modules/asura-core/application.cpp
+++ b/source/modules/asura-core/application.cpp
@@ -17,7 +17,7 @@ namespace AsuraEngine
bool Application::InitSubModules(uint flag)
{
-
+ return false;
}
} \ No newline at end of file
diff --git a/source/modules/asura-core/core_module.cpp b/source/modules/asura-core/core_module.cpp
index e6b0dac..989ec3e 100644
--- a/source/modules/asura-core/core_module.cpp
+++ b/source/modules/asura-core/core_module.cpp
@@ -2,7 +2,6 @@
using namespace AEThreading;
using namespace AEGraphics;
-using namespace AEWnd;
namespace AsuraEngine
{
@@ -13,7 +12,7 @@ namespace AsuraEngine
LUAX_REGISTER_ABSTRACT_FACTORY(state, Texture);
LUAX_REGISTER_FACTORY(state, Image);
// Wnd
- LUAX_REGISTER_SINGLETON(state, Window);
+ LUAX_REGISTER_SINGLETON(state, AEWindow::Window);
// Threading
//LUAX_REGISTER_FACTORY(state, ThreadEx);
}
diff --git a/source/modules/asura-core/core_module.h b/source/modules/asura-core/core_module.h
index 613a806..443aea4 100644
--- a/source/modules/asura-core/core_module.h
+++ b/source/modules/asura-core/core_module.h
@@ -6,7 +6,7 @@
#include "graphics/image.h"
#include "graphics/texture.h"
-#include "wnd/window.h"
+#include "window/window.h"
#include "threading/thread_ex.h"
diff --git a/source/modules/asura-core/font/string.cpp b/source/modules/asura-core/font/string.cpp
index 8c9c55a..72acaa6 100644
--- a/source/modules/asura-core/font/string.cpp
+++ b/source/modules/asura-core/font/string.cpp
@@ -1,376 +1,376 @@
-#include "String.hpp"
-#include "Utf.hpp"
-
-namespace AsuraEngine
-{
- namespace Text
- {
-
-
- ////////////////////////////////////////////////////////////
- const std::size_t String::InvalidPos = std::basic_string<uint32>::npos;
-
-
- ////////////////////////////////////////////////////////////
- String::String()
- {
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(char ansiChar, const std::locale& locale)
- {
- mString += Utf32::DecodeAnsi(ansiChar, locale);
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(wchar_t wideChar)
- {
- mString += Utf32::DecodeWide(wideChar);
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(uint32 utf32Char)
- {
- mString += utf32Char;
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(const char* ansiString, const std::locale& locale)
- {
- if (ansiString)
- {
- std::size_t length = strlen(ansiString);
- if (length > 0)
- {
- mString.reserve(length + 1);
- Utf32::FromAnsi(ansiString, ansiString + length, std::back_inserter(mString), locale);
- }
- }
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(const std::string& ansiString, const std::locale& locale)
- {
- mString.reserve(ansiString.length() + 1);
- Utf32::FromAnsi(ansiString.begin(), ansiString.end(), std::back_inserter(mString), locale);
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(const wchar_t* wideString)
- {
- if (wideString)
- {
- std::size_t length = std::wcslen(wideString);
- if (length > 0)
- {
- mString.reserve(length + 1);
- Utf32::FromWide(wideString, wideString + length, std::back_inserter(mString));
- }
- }
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(const std::wstring& wideString)
- {
- mString.reserve(wideString.length() + 1);
- Utf32::FromWide(wideString.begin(), wideString.end(), std::back_inserter(mString));
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(const uint32* utf32String)
- {
- if (utf32String)
- mString = utf32String;
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(const std::basic_string<uint32>& utf32String) :
- mString(utf32String)
- {
- }
-
-
- ////////////////////////////////////////////////////////////
- String::String(const String& copy) :
- mString(copy.mString)
- {
- }
-
-
- ////////////////////////////////////////////////////////////
- String::operator std::string() const
- {
- return ToAnsiString();
- }
-
-
- ////////////////////////////////////////////////////////////
- String::operator std::wstring() const
- {
- return ToWideString();
- }
-
-
- ////////////////////////////////////////////////////////////
- std::string String::ToAnsiString(const std::locale& locale) const
- {
- // Prepare the output string
- std::string output;
- output.reserve(mString.length() + 1);
-
- // Convert
- Utf32::ToAnsi(mString.begin(), mString.end(), std::back_inserter(output), 0, locale);
-
- return output;
- }
-
-
- ////////////////////////////////////////////////////////////
- std::wstring String::ToWideString() const
- {
- // Prepare the output string
- std::wstring output;
- output.reserve(mString.length() + 1);
-
- // Convert
- Utf32::ToWide(mString.begin(), mString.end(), std::back_inserter(output), 0);
-
- return output;
- }
-
-
- ////////////////////////////////////////////////////////////
- std::basic_string<uint8> String::ToUtf8() const
- {
- // Prepare the output string
- std::basic_string<uint8> output;
- output.reserve(mString.length());
-
- // Convert
- Utf32::ToUtf8(mString.begin(), mString.end(), std::back_inserter(output));
-
- return output;
- }
-
-
- ////////////////////////////////////////////////////////////
- std::basic_string<uint16> String::ToUtf16() const
- {
- // Prepare the output string
- std::basic_string<uint16> output;
- output.reserve(mString.length());
-
- // Convert
- Utf32::ToUtf16(mString.begin(), mString.end(), std::back_inserter(output));
-
- return output;
- }
-
-
- ////////////////////////////////////////////////////////////
- std::basic_string<uint32> String::ToUtf32() const
- {
- return mString;
- }
-
-
- ////////////////////////////////////////////////////////////
- String& String::operator =(const String& right)
- {
- mString = right.mString;
- return *this;
- }
-
-
- ////////////////////////////////////////////////////////////
- String& String::operator +=(const String& right)
- {
- mString += right.mString;
- return *this;
- }
-
-
- ////////////////////////////////////////////////////////////
- uint32 String::operator [](std::size_t index) const
- {
- return mString[index];
- }
-
-
- ////////////////////////////////////////////////////////////
- uint32& String::operator [](std::size_t index)
- {
- return mString[index];
- }
-
-
- ////////////////////////////////////////////////////////////
- void String::Clear()
- {
- mString.clear();
- }
-
-
- ////////////////////////////////////////////////////////////
- std::size_t String::GetSize() const
- {
- return mString.size();
- }
-
-
- ////////////////////////////////////////////////////////////
- bool String::IsEmpty() const
- {
- return mString.empty();
- }
-
-
- ////////////////////////////////////////////////////////////
- void String::Erase(std::size_t position, std::size_t count)
- {
- mString.erase(position, count);
- }
-
-
- ////////////////////////////////////////////////////////////
- void String::Insert(std::size_t position, const String& str)
- {
- mString.insert(position, str.mString);
- }
-
-
- ////////////////////////////////////////////////////////////
- std::size_t String::Find(const String& str, std::size_t start) const
- {
- return mString.find(str.mString, start);
- }
-
-
- ////////////////////////////////////////////////////////////
- void String::Replace(std::size_t position, std::size_t length, const String& replaceWith)
- {
- mString.replace(position, length, replaceWith.mString);
- }
-
-
- ////////////////////////////////////////////////////////////
- void String::Replace(const String& searchFor, const String& replaceWith)
- {
- std::size_t step = replaceWith.GetSize();
- std::size_t len = searchFor.GetSize();
- std::size_t pos = Find(searchFor);
-
- // Replace each occurrence of search
- while (pos != InvalidPos)
- {
- Replace(pos, len, replaceWith);
- pos = Find(searchFor, pos + step);
- }
- }
-
-
- ////////////////////////////////////////////////////////////
- String String::Substring(std::size_t position, std::size_t length) const
- {
- return mString.substr(position, length);
- }
-
-
- ////////////////////////////////////////////////////////////
- const uint32* String::GetData() const
- {
- return mString.c_str();
- }
-
-
- ////////////////////////////////////////////////////////////
- String::Iterator String::Begin()
- {
- return mString.begin();
- }
-
-
- ////////////////////////////////////////////////////////////
- String::ConstIterator String::Begin() const
- {
- return mString.begin();
- }
-
-
- ////////////////////////////////////////////////////////////
- String::Iterator String::End()
- {
- return mString.end();
- }
-
-
- ////////////////////////////////////////////////////////////
- String::ConstIterator String::End() const
- {
- return mString.end();
- }
-
-
- ////////////////////////////////////////////////////////////
- bool operator ==(const String& left, const String& right)
- {
- return left.mString == right.mString;
- }
-
-
- ////////////////////////////////////////////////////////////
- bool operator !=(const String& left, const String& right)
- {
- return !(left == right);
- }
-
-
- ////////////////////////////////////////////////////////////
- bool operator <(const String& left, const String& right)
- {
- return left.mString < right.mString;
- }
-
-
- ////////////////////////////////////////////////////////////
- bool operator >(const String& left, const String& right)
- {
- return right < left;
- }
-
-
- ////////////////////////////////////////////////////////////
- bool operator <=(const String& left, const String& right)
- {
- return !(right < left);
- }
-
-
- ////////////////////////////////////////////////////////////
- bool operator >=(const String& left, const String& right)
- {
- return !(left < right);
- }
-
-
- ////////////////////////////////////////////////////////////
- String operator +(const String& left, const String& right)
- {
- String string = left;
- string += right;
-
- return string;
- }
-
-
- }
-}
+//#include "String.hpp"
+//#include "Utf.hpp"
+//
+//namespace AsuraEngine
+//{
+// namespace Text
+// {
+//
+//
+// ////////////////////////////////////////////////////////////
+// const std::size_t String::InvalidPos = std::basic_string<uint32>::npos;
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String()
+// {
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(char ansiChar, const std::locale& locale)
+// {
+// mString += Utf32::DecodeAnsi(ansiChar, locale);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(wchar_t wideChar)
+// {
+// mString += Utf32::DecodeWide(wideChar);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(uint32 utf32Char)
+// {
+// mString += utf32Char;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const char* ansiString, const std::locale& locale)
+// {
+// if (ansiString)
+// {
+// std::size_t length = strlen(ansiString);
+// if (length > 0)
+// {
+// mString.reserve(length + 1);
+// Utf32::FromAnsi(ansiString, ansiString + length, std::back_inserter(mString), locale);
+// }
+// }
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const std::string& ansiString, const std::locale& locale)
+// {
+// mString.reserve(ansiString.length() + 1);
+// Utf32::FromAnsi(ansiString.begin(), ansiString.end(), std::back_inserter(mString), locale);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const wchar_t* wideString)
+// {
+// if (wideString)
+// {
+// std::size_t length = std::wcslen(wideString);
+// if (length > 0)
+// {
+// mString.reserve(length + 1);
+// Utf32::FromWide(wideString, wideString + length, std::back_inserter(mString));
+// }
+// }
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const std::wstring& wideString)
+// {
+// mString.reserve(wideString.length() + 1);
+// Utf32::FromWide(wideString.begin(), wideString.end(), std::back_inserter(mString));
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const uint32* utf32String)
+// {
+// if (utf32String)
+// mString = utf32String;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const std::basic_string<uint32>& utf32String) :
+// mString(utf32String)
+// {
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::String(const String& copy) :
+// mString(copy.mString)
+// {
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::operator std::string() const
+// {
+// return ToAnsiString();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::operator std::wstring() const
+// {
+// return ToWideString();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::string String::ToAnsiString(const std::locale& locale) const
+// {
+// // Prepare the output string
+// std::string output;
+// output.reserve(mString.length() + 1);
+//
+// // Convert
+// Utf32::ToAnsi(mString.begin(), mString.end(), std::back_inserter(output), 0, locale);
+//
+// return output;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::wstring String::ToWideString() const
+// {
+// // Prepare the output string
+// std::wstring output;
+// output.reserve(mString.length() + 1);
+//
+// // Convert
+// Utf32::ToWide(mString.begin(), mString.end(), std::back_inserter(output), 0);
+//
+// return output;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint8> String::ToUtf8() const
+// {
+// // Prepare the output string
+// std::basic_string<uint8> output;
+// output.reserve(mString.length());
+//
+// // Convert
+// Utf32::ToUtf8(mString.begin(), mString.end(), std::back_inserter(output));
+//
+// return output;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint16> String::ToUtf16() const
+// {
+// // Prepare the output string
+// std::basic_string<uint16> output;
+// output.reserve(mString.length());
+//
+// // Convert
+// Utf32::ToUtf16(mString.begin(), mString.end(), std::back_inserter(output));
+//
+// return output;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint32> String::ToUtf32() const
+// {
+// return mString;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String& String::operator =(const String& right)
+// {
+// mString = right.mString;
+// return *this;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String& String::operator +=(const String& right)
+// {
+// mString += right.mString;
+// return *this;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// uint32 String::operator [](std::size_t index) const
+// {
+// return mString[index];
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// uint32& String::operator [](std::size_t index)
+// {
+// return mString[index];
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Clear()
+// {
+// mString.clear();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::size_t String::GetSize() const
+// {
+// return mString.size();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool String::IsEmpty() const
+// {
+// return mString.empty();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Erase(std::size_t position, std::size_t count)
+// {
+// mString.erase(position, count);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Insert(std::size_t position, const String& str)
+// {
+// mString.insert(position, str.mString);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// std::size_t String::Find(const String& str, std::size_t start) const
+// {
+// return mString.find(str.mString, start);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Replace(std::size_t position, std::size_t length, const String& replaceWith)
+// {
+// mString.replace(position, length, replaceWith.mString);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// void String::Replace(const String& searchFor, const String& replaceWith)
+// {
+// std::size_t step = replaceWith.GetSize();
+// std::size_t len = searchFor.GetSize();
+// std::size_t pos = Find(searchFor);
+//
+// // Replace each occurrence of search
+// while (pos != InvalidPos)
+// {
+// Replace(pos, len, replaceWith);
+// pos = Find(searchFor, pos + step);
+// }
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String String::Substring(std::size_t position, std::size_t length) const
+// {
+// return mString.substr(position, length);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// const uint32* String::GetData() const
+// {
+// return mString.c_str();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::Iterator String::Begin()
+// {
+// return mString.begin();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::ConstIterator String::Begin() const
+// {
+// return mString.begin();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::Iterator String::End()
+// {
+// return mString.end();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String::ConstIterator String::End() const
+// {
+// return mString.end();
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator ==(const String& left, const String& right)
+// {
+// return left.mString == right.mString;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator !=(const String& left, const String& right)
+// {
+// return !(left == right);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator <(const String& left, const String& right)
+// {
+// return left.mString < right.mString;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator >(const String& left, const String& right)
+// {
+// return right < left;
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator <=(const String& left, const String& right)
+// {
+// return !(right < left);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// bool operator >=(const String& left, const String& right)
+// {
+// return !(left < right);
+// }
+//
+//
+// ////////////////////////////////////////////////////////////
+// String operator +(const String& left, const String& right)
+// {
+// String string = left;
+// string += right;
+//
+// return string;
+// }
+//
+//
+// }
+//}
diff --git a/source/modules/asura-core/font/string.hpp b/source/modules/asura-core/font/string.hpp
index 226735b..5a48eb7 100644
--- a/source/modules/asura-core/font/string.hpp
+++ b/source/modules/asura-core/font/string.hpp
@@ -1,594 +1,595 @@
-#ifndef __ASURA_ENGINE_STRING_H__
-#define __ASURA_ENGINE_STRING_H__
-
-#include "Config.h"
-#include <iterator>
-#include <locale>
-#include <string>
-
-namespace AsuraEngine
-{
- namespace Text
- {
-
-
- ////////////////////////////////////////////////////////////
- /// \brief Utility string class that automatically handles
- /// conversions between types and encodings
- ///
- ////////////////////////////////////////////////////////////
- class String
- {
- public:
-
- ////////////////////////////////////////////////////////////
- // Types
- ////////////////////////////////////////////////////////////
- typedef std::basic_string<uint32>::iterator Iterator; ///< Iterator type
- typedef std::basic_string<uint32>::const_iterator ConstIterator; ///< Read-only iterator type
-
- ////////////////////////////////////////////////////////////
- // Static member data
- ////////////////////////////////////////////////////////////
- static const std::size_t InvalidPos; ///< Represents an invalid position in the string
-
- ////////////////////////////////////////////////////////////
- /// \brief Default constructor
- ///
- /// This constructor creates an empty string.
- ///
- ////////////////////////////////////////////////////////////
- String();
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from a single ANSI character and a locale
- ///
- /// The source character is converted to UTF-32 according
- /// to the given locale.
- ///
- /// \param ansiChar ANSI character to convert
- /// \param locale Locale to use for conversion
- ///
- ////////////////////////////////////////////////////////////
- String(char ansiChar, const std::locale& locale = std::locale());
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from single wide character
- ///
- /// \param wideChar Wide character to convert
- ///
- ////////////////////////////////////////////////////////////
- String(wchar_t wideChar);
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from single UTF-32 character
- ///
- /// \param utf32Char UTF-32 character to convert
- ///
- ////////////////////////////////////////////////////////////
- String(uint utf32Char);
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from a null-terminated C-style ANSI string and a locale
- ///
- /// The source string is converted to UTF-32 according
- /// to the given locale.
- ///
- /// \param ansiString ANSI string to convert
- /// \param locale Locale to use for conversion
- ///
- ////////////////////////////////////////////////////////////
- String(const char* ansiString, const std::locale& locale = std::locale());
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from an ANSI string and a locale
- ///
- /// The source string is converted to UTF-32 according
- /// to the given locale.
- ///
- /// \param ansiString ANSI string to convert
- /// \param locale Locale to use for conversion
- ///
- ////////////////////////////////////////////////////////////
- String(const std::string& ansiString, const std::locale& locale = std::locale());
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from null-terminated C-style wide string
- ///
- /// \param wideString Wide string to convert
- ///
- ////////////////////////////////////////////////////////////
- String(const wchar_t* wideString);
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from a wide string
- ///
- /// \param wideString Wide string to convert
- ///
- ////////////////////////////////////////////////////////////
- String(const std::wstring& wideString);
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from a null-terminated C-style UTF-32 string
- ///
- /// \param utf32String UTF-32 string to assign
- ///
- ////////////////////////////////////////////////////////////
- String(const uint* utf32String);
-
- ////////////////////////////////////////////////////////////
- /// \brief Construct from an UTF-32 string
- ///
- /// \param utf32String UTF-32 string to assign
- ///
- ////////////////////////////////////////////////////////////
- String(const std::basic_string<uint>& utf32String);
-
- ////////////////////////////////////////////////////////////
- /// \brief Copy constructor
- ///
- /// \param copy Instance to copy
- ///
- ////////////////////////////////////////////////////////////
- String(const String& copy);
-
- ////////////////////////////////////////////////////////////
- /// \brief Create a new sf::String from a UTF-8 encoded string
- ///
- /// \param begin Forward iterator to the beginning of the UTF-8 sequence
- /// \param end Forward iterator to the end of the UTF-8 sequence
- ///
- /// \return A sf::String containing the source string
- ///
- /// \see fromUtf16, fromUtf32
- ///
- ////////////////////////////////////////////////////////////
- template <typename T>
- static String FromUtf8(T begin, T end);
-
- ////////////////////////////////////////////////////////////
- /// \brief Create a new sf::String from a UTF-16 encoded string
- ///
- /// \param begin Forward iterator to the beginning of the UTF-16 sequence
- /// \param end Forward iterator to the end of the UTF-16 sequence
- ///
- /// \return A sf::String containing the source string
- ///
- /// \see fromUtf8, fromUtf32
- ///
- ////////////////////////////////////////////////////////////
- template <typename T>
- static String FromUtf16(T begin, T end);
-
- ////////////////////////////////////////////////////////////
- /// \brief Create a new sf::String from a UTF-32 encoded string
- ///
- /// This function is provided for consistency, it is equivalent to
- /// using the constructors that takes a const sf::uint* or
- /// a std::basic_string<sf::uint>.
- ///
- /// \param begin Forward iterator to the beginning of the UTF-32 sequence
- /// \param end Forward iterator to the end of the UTF-32 sequence
- ///
- /// \return A sf::String containing the source string
- ///
- /// \see fromUtf8, fromUtf16
- ///
- ////////////////////////////////////////////////////////////
- template <typename T>
- static String FromUtf32(T begin, T end);
-
- ////////////////////////////////////////////////////////////
- /// \brief Implicit conversion operator to std::string (ANSI string)
- ///
- /// The current global locale is used for conversion. If you
- /// want to explicitly specify a locale, see toAnsiString.
- /// Characters that do not fit in the target encoding are
- /// discarded from the returned string.
- /// This operator is defined for convenience, and is equivalent
- /// to calling toAnsiString().
- ///
- /// \return Converted ANSI string
- ///
- /// \see toAnsiString, operator std::wstring
- ///
- ////////////////////////////////////////////////////////////
- operator std::string() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Implicit conversion operator to std::wstring (wide string)
- ///
- /// Characters that do not fit in the target encoding are
- /// discarded from the returned string.
- /// This operator is defined for convenience, and is equivalent
- /// to calling toWideString().
- ///
- /// \return Converted wide string
- ///
- /// \see toWideString, operator std::string
- ///
- ////////////////////////////////////////////////////////////
- operator std::wstring() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Convert the Unicode string to an ANSI string
- ///
- /// The UTF-32 string is converted to an ANSI string in
- /// the encoding defined by \a locale.
- /// Characters that do not fit in the target encoding are
- /// discarded from the returned string.
- ///
- /// \param locale Locale to use for conversion
- ///
- /// \return Converted ANSI string
- ///
- /// \see toWideString, operator std::string
- ///
- ////////////////////////////////////////////////////////////
- std::string ToAnsiString(const std::locale& locale = std::locale()) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Convert the Unicode string to a wide string
- ///
- /// Characters that do not fit in the target encoding are
- /// discarded from the returned string.
- ///
- /// \return Converted wide string
- ///
- /// \see toAnsiString, operator std::wstring
- ///
- ////////////////////////////////////////////////////////////
- std::wstring ToWideString() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Convert the Unicode string to a UTF-8 string
- ///
- /// \return Converted UTF-8 string
- ///
- /// \see toUtf16, toUtf32
- ///
- ////////////////////////////////////////////////////////////
- std::basic_string<uint8> ToUtf8() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Convert the Unicode string to a UTF-16 string
- ///
- /// \return Converted UTF-16 string
- ///
- /// \see toUtf8, toUtf32
- ///
- ////////////////////////////////////////////////////////////
- std::basic_string<uint16> ToUtf16() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Convert the Unicode string to a UTF-32 string
- ///
- /// This function doesn't perform any conversion, since the
- /// string is already stored as UTF-32 internally.
- ///
- /// \return Converted UTF-32 string
- ///
- /// \see toUtf8, toUtf16
- ///
- ////////////////////////////////////////////////////////////
- std::basic_string<uint> ToUtf32() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Overload of assignment operator
- ///
- /// \param right Instance to assign
- ///
- /// \return Reference to self
- ///
- ////////////////////////////////////////////////////////////
- String& operator =(const String& right);
-
- ////////////////////////////////////////////////////////////
- /// \brief Overload of += operator to append an UTF-32 string
- ///
- /// \param right String to append
- ///
- /// \return Reference to self
- ///
- ////////////////////////////////////////////////////////////
- String& operator +=(const String& right);
-
- ////////////////////////////////////////////////////////////
- /// \brief Overload of [] operator to access a character by its position
- ///
- /// This function provides read-only access to characters.
- /// Note: the behavior is undefined if \a index is out of range.
- ///
- /// \param index Index of the character to get
- ///
- /// \return Character at position \a index
- ///
- ////////////////////////////////////////////////////////////
- uint operator [](std::size_t index) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Overload of [] operator to access a character by its position
- ///
- /// This function provides read and write access to characters.
- /// Note: the behavior is undefined if \a index is out of range.
- ///
- /// \param index Index of the character to get
- ///
- /// \return Reference to the character at position \a index
- ///
- ////////////////////////////////////////////////////////////
- uint& operator [](std::size_t index);
-
- ////////////////////////////////////////////////////////////
- /// \brief Clear the string
- ///
- /// This function removes all the characters from the string.
- ///
- /// \see isEmpty, erase
- ///
- ////////////////////////////////////////////////////////////
- void Clear();
-
- ////////////////////////////////////////////////////////////
- /// \brief Get the size of the string
- ///
- /// \return Number of characters in the string
- ///
- /// \see isEmpty
- ///
- ////////////////////////////////////////////////////////////
- std::size_t GetSize() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Check whether the string is empty or not
- ///
- /// \return True if the string is empty (i.e. contains no character)
- ///
- /// \see clear, getSize
- ///
- ////////////////////////////////////////////////////////////
- bool IsEmpty() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Erase one or more characters from the string
- ///
- /// This function removes a sequence of \a count characters
- /// starting from \a position.
- ///
- /// \param position Position of the first character to erase
- /// \param count Number of characters to erase
- ///
- ////////////////////////////////////////////////////////////
- void Erase(std::size_t position, std::size_t count = 1);
-
- ////////////////////////////////////////////////////////////
- /// \brief Insert one or more characters into the string
- ///
- /// This function inserts the characters of \a str
- /// into the string, starting from \a position.
- ///
- /// \param position Position of insertion
- /// \param str Characters to insert
- ///
- ////////////////////////////////////////////////////////////
- void Insert(std::size_t position, const String& str);
-
- ////////////////////////////////////////////////////////////
- /// \brief Find a sequence of one or more characters in the string
- ///
- /// This function searches for the characters of \a str
- /// in the string, starting from \a start.
- ///
- /// \param str Characters to find
- /// \param start Where to begin searching
- ///
- /// \return Position of \a str in the string, or String::InvalidPos if not found
- ///
- ////////////////////////////////////////////////////////////
- std::size_t Find(const String& str, std::size_t start = 0) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Replace a substring with another string
- ///
- /// This function replaces the substring that starts at index \a position
- /// and spans \a length characters with the string \a replaceWith.
- ///
- /// \param position Index of the first character to be replaced
- /// \param length Number of characters to replace. You can pass InvalidPos to
- /// replace all characters until the end of the string.
- /// \param replaceWith String that replaces the given substring.
- ///
- ////////////////////////////////////////////////////////////
- void Replace(std::size_t position, std::size_t length, const String& replaceWith);
-
- ////////////////////////////////////////////////////////////
- /// \brief Replace all occurrences of a substring with a replacement string
- ///
- /// This function replaces all occurrences of \a searchFor in this string
- /// with the string \a replaceWith.
- ///
- /// \param searchFor The value being searched for
- /// \param replaceWith The value that replaces found \a searchFor values
- ///
- ////////////////////////////////////////////////////////////
- void Replace(const String& searchFor, const String& replaceWith);
-
- ////////////////////////////////////////////////////////////
- /// \brief Return a part of the string
- ///
- /// This function returns the substring that starts at index \a position
- /// and spans \a length characters.
- ///
- /// \param position Index of the first character
- /// \param length Number of characters to include in the substring (if
- /// the string is shorter, as many characters as possible
- /// are included). \ref InvalidPos can be used to include all
- /// characters until the end of the string.
- ///
- /// \return String object containing a substring of this object
- ///
- ////////////////////////////////////////////////////////////
- String Substring(std::size_t position, std::size_t length = InvalidPos) const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Get a pointer to the C-style array of characters
- ///
- /// This functions provides a read-only access to a
- /// null-terminated C-style representation of the string.
- /// The returned pointer is temporary and is meant only for
- /// immediate use, thus it is not recommended to store it.
- ///
- /// \return Read-only pointer to the array of characters
- ///
- ////////////////////////////////////////////////////////////
- const uint* GetData() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Return an iterator to the beginning of the string
- ///
- /// \return Read-write iterator to the beginning of the string characters
- ///
- /// \see end
- ///
- ////////////////////////////////////////////////////////////
- Iterator Begin();
-
- ////////////////////////////////////////////////////////////
- /// \brief Return an iterator to the beginning of the string
- ///
- /// \return Read-only iterator to the beginning of the string characters
- ///
- /// \see end
- ///
- ////////////////////////////////////////////////////////////
- ConstIterator Begin() const;
-
- ////////////////////////////////////////////////////////////
- /// \brief Return an iterator to the end of the string
- ///
- /// The end iterator refers to 1 position past the last character;
- /// thus it represents an invalid character and should never be
- /// accessed.
- ///
- /// \return Read-write iterator to the end of the string characters
- ///
- /// \see begin
- ///
- ////////////////////////////////////////////////////////////
- Iterator End();
-
- ////////////////////////////////////////////////////////////
- /// \brief Return an iterator to the end of the string
- ///
- /// The end iterator refers to 1 position past the last character;
- /// thus it represents an invalid character and should never be
- /// accessed.
- ///
- /// \return Read-only iterator to the end of the string characters
- ///
- /// \see begin
- ///
- ////////////////////////////////////////////////////////////
- ConstIterator End() const;
-
- private:
-
- friend bool operator ==(const String& left, const String& right);
- friend bool operator <(const String& left, const String& right);
-
- ////////////////////////////////////////////////////////////
- // Member data
- ////////////////////////////////////////////////////////////
- std::basic_string<uint> mString; ///< Internal string of UTF-32 characters
- };
-
- ////////////////////////////////////////////////////////////
- /// \relates String
- /// \brief Overload of == operator to compare two UTF-32 strings
- ///
- /// \param left Left operand (a string)
- /// \param right Right operand (a string)
- ///
- /// \return True if both strings are equal
- ///
- ////////////////////////////////////////////////////////////
- bool operator ==(const String& left, const String& right);
-
- ////////////////////////////////////////////////////////////
- /// \relates String
- /// \brief Overload of != operator to compare two UTF-32 strings
- ///
- /// \param left Left operand (a string)
- /// \param right Right operand (a string)
- ///
- /// \return True if both strings are different
- ///
- ////////////////////////////////////////////////////////////
- bool operator !=(const String& left, const String& right);
-
- ////////////////////////////////////////////////////////////
- /// \relates String
- /// \brief Overload of < operator to compare two UTF-32 strings
- ///
- /// \param left Left operand (a string)
- /// \param right Right operand (a string)
- ///
- /// \return True if \a left is lexicographically before \a right
- ///
- ////////////////////////////////////////////////////////////
- bool operator <(const String& left, const String& right);
-
- ////////////////////////////////////////////////////////////
- /// \relates String
- /// \brief Overload of > operator to compare two UTF-32 strings
- ///
- /// \param left Left operand (a string)
- /// \param right Right operand (a string)
- ///
- /// \return True if \a left is lexicographically after \a right
- ///
- ////////////////////////////////////////////////////////////
- bool operator >(const String& left, const String& right);
-
- ////////////////////////////////////////////////////////////
- /// \relates String
- /// \brief Overload of <= operator to compare two UTF-32 strings
- ///
- /// \param left Left operand (a string)
- /// \param right Right operand (a string)
- ///
- /// \return True if \a left is lexicographically before or equivalent to \a right
- ///
- ////////////////////////////////////////////////////////////
- bool operator <=(const String& left, const String& right);
-
- ////////////////////////////////////////////////////////////
- /// \relates String
- /// \brief Overload of >= operator to compare two UTF-32 strings
- ///
- /// \param left Left operand (a string)
- /// \param right Right operand (a string)
- ///
- /// \return True if \a left is lexicographically after or equivalent to \a right
- ///
- ////////////////////////////////////////////////////////////
- bool operator >=(const String& left, const String& right);
-
- ////////////////////////////////////////////////////////////
- /// \relates String
- /// \brief Overload of binary + operator to concatenate two strings
- ///
- /// \param left Left operand (a string)
- /// \param right Right operand (a string)
- ///
- /// \return Concatenated string
- ///
- ////////////////////////////////////////////////////////////
- String operator +(const String& left, const String& right);
-
- #include "String.inl"
-
- }
-}
-
-#endif \ No newline at end of file
+//#ifndef __ASURA_ENGINE_STRING_H__
+//#define __ASURA_ENGINE_STRING_H__
+//
+//#include <asura-utils/type.h>
+//
+//#include <iterator>
+//#include <locale>
+//#include <string>
+//
+//namespace AsuraEngine
+//{
+// namespace Text
+// {
+//
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Utility string class that automatically handles
+// /// conversions between types and encodings
+// ///
+// ////////////////////////////////////////////////////////////
+// class String
+// {
+// public:
+//
+// ////////////////////////////////////////////////////////////
+// // Types
+// ////////////////////////////////////////////////////////////
+// typedef std::basic_string<uint32>::iterator Iterator; ///< Iterator type
+// typedef std::basic_string<uint32>::const_iterator ConstIterator; ///< Read-only iterator type
+//
+// ////////////////////////////////////////////////////////////
+// // Static member data
+// ////////////////////////////////////////////////////////////
+// static const std::size_t InvalidPos; ///< Represents an invalid position in the string
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Default constructor
+// ///
+// /// This constructor creates an empty string.
+// ///
+// ////////////////////////////////////////////////////////////
+// String();
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from a single ANSI character and a locale
+// ///
+// /// The source character is converted to UTF-32 according
+// /// to the given locale.
+// ///
+// /// \param ansiChar ANSI character to convert
+// /// \param locale Locale to use for conversion
+// ///
+// ////////////////////////////////////////////////////////////
+// String(char ansiChar, const std::locale& locale = std::locale());
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from single wide character
+// ///
+// /// \param wideChar Wide character to convert
+// ///
+// ////////////////////////////////////////////////////////////
+// String(wchar_t wideChar);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from single UTF-32 character
+// ///
+// /// \param utf32Char UTF-32 character to convert
+// ///
+// ////////////////////////////////////////////////////////////
+// String(uint utf32Char);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from a null-terminated C-style ANSI string and a locale
+// ///
+// /// The source string is converted to UTF-32 according
+// /// to the given locale.
+// ///
+// /// \param ansiString ANSI string to convert
+// /// \param locale Locale to use for conversion
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const char* ansiString, const std::locale& locale = std::locale());
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from an ANSI string and a locale
+// ///
+// /// The source string is converted to UTF-32 according
+// /// to the given locale.
+// ///
+// /// \param ansiString ANSI string to convert
+// /// \param locale Locale to use for conversion
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const std::string& ansiString, const std::locale& locale = std::locale());
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from null-terminated C-style wide string
+// ///
+// /// \param wideString Wide string to convert
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const wchar_t* wideString);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from a wide string
+// ///
+// /// \param wideString Wide string to convert
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const std::wstring& wideString);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from a null-terminated C-style UTF-32 string
+// ///
+// /// \param utf32String UTF-32 string to assign
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const uint* utf32String);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Construct from an UTF-32 string
+// ///
+// /// \param utf32String UTF-32 string to assign
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const std::basic_string<uint>& utf32String);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Copy constructor
+// ///
+// /// \param copy Instance to copy
+// ///
+// ////////////////////////////////////////////////////////////
+// String(const String& copy);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Create a new sf::String from a UTF-8 encoded string
+// ///
+// /// \param begin Forward iterator to the beginning of the UTF-8 sequence
+// /// \param end Forward iterator to the end of the UTF-8 sequence
+// ///
+// /// \return A sf::String containing the source string
+// ///
+// /// \see fromUtf16, fromUtf32
+// ///
+// ////////////////////////////////////////////////////////////
+// template <typename T>
+// static String FromUtf8(T begin, T end);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Create a new sf::String from a UTF-16 encoded string
+// ///
+// /// \param begin Forward iterator to the beginning of the UTF-16 sequence
+// /// \param end Forward iterator to the end of the UTF-16 sequence
+// ///
+// /// \return A sf::String containing the source string
+// ///
+// /// \see fromUtf8, fromUtf32
+// ///
+// ////////////////////////////////////////////////////////////
+// template <typename T>
+// static String FromUtf16(T begin, T end);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Create a new sf::String from a UTF-32 encoded string
+// ///
+// /// This function is provided for consistency, it is equivalent to
+// /// using the constructors that takes a const sf::uint* or
+// /// a std::basic_string<sf::uint>.
+// ///
+// /// \param begin Forward iterator to the beginning of the UTF-32 sequence
+// /// \param end Forward iterator to the end of the UTF-32 sequence
+// ///
+// /// \return A sf::String containing the source string
+// ///
+// /// \see fromUtf8, fromUtf16
+// ///
+// ////////////////////////////////////////////////////////////
+// template <typename T>
+// static String FromUtf32(T begin, T end);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Implicit conversion operator to std::string (ANSI string)
+// ///
+// /// The current global locale is used for conversion. If you
+// /// want to explicitly specify a locale, see toAnsiString.
+// /// Characters that do not fit in the target encoding are
+// /// discarded from the returned string.
+// /// This operator is defined for convenience, and is equivalent
+// /// to calling toAnsiString().
+// ///
+// /// \return Converted ANSI string
+// ///
+// /// \see toAnsiString, operator std::wstring
+// ///
+// ////////////////////////////////////////////////////////////
+// operator std::string() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Implicit conversion operator to std::wstring (wide string)
+// ///
+// /// Characters that do not fit in the target encoding are
+// /// discarded from the returned string.
+// /// This operator is defined for convenience, and is equivalent
+// /// to calling toWideString().
+// ///
+// /// \return Converted wide string
+// ///
+// /// \see toWideString, operator std::string
+// ///
+// ////////////////////////////////////////////////////////////
+// operator std::wstring() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to an ANSI string
+// ///
+// /// The UTF-32 string is converted to an ANSI string in
+// /// the encoding defined by \a locale.
+// /// Characters that do not fit in the target encoding are
+// /// discarded from the returned string.
+// ///
+// /// \param locale Locale to use for conversion
+// ///
+// /// \return Converted ANSI string
+// ///
+// /// \see toWideString, operator std::string
+// ///
+// ////////////////////////////////////////////////////////////
+// std::string ToAnsiString(const std::locale& locale = std::locale()) const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to a wide string
+// ///
+// /// Characters that do not fit in the target encoding are
+// /// discarded from the returned string.
+// ///
+// /// \return Converted wide string
+// ///
+// /// \see toAnsiString, operator std::wstring
+// ///
+// ////////////////////////////////////////////////////////////
+// std::wstring ToWideString() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to a UTF-8 string
+// ///
+// /// \return Converted UTF-8 string
+// ///
+// /// \see toUtf16, toUtf32
+// ///
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint8> ToUtf8() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to a UTF-16 string
+// ///
+// /// \return Converted UTF-16 string
+// ///
+// /// \see toUtf8, toUtf32
+// ///
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint16> ToUtf16() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Convert the Unicode string to a UTF-32 string
+// ///
+// /// This function doesn't perform any conversion, since the
+// /// string is already stored as UTF-32 internally.
+// ///
+// /// \return Converted UTF-32 string
+// ///
+// /// \see toUtf8, toUtf16
+// ///
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint> ToUtf32() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Overload of assignment operator
+// ///
+// /// \param right Instance to assign
+// ///
+// /// \return Reference to self
+// ///
+// ////////////////////////////////////////////////////////////
+// String& operator =(const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Overload of += operator to append an UTF-32 string
+// ///
+// /// \param right String to append
+// ///
+// /// \return Reference to self
+// ///
+// ////////////////////////////////////////////////////////////
+// String& operator +=(const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Overload of [] operator to access a character by its position
+// ///
+// /// This function provides read-only access to characters.
+// /// Note: the behavior is undefined if \a index is out of range.
+// ///
+// /// \param index Index of the character to get
+// ///
+// /// \return Character at position \a index
+// ///
+// ////////////////////////////////////////////////////////////
+// uint operator [](std::size_t index) const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Overload of [] operator to access a character by its position
+// ///
+// /// This function provides read and write access to characters.
+// /// Note: the behavior is undefined if \a index is out of range.
+// ///
+// /// \param index Index of the character to get
+// ///
+// /// \return Reference to the character at position \a index
+// ///
+// ////////////////////////////////////////////////////////////
+// uint& operator [](std::size_t index);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Clear the string
+// ///
+// /// This function removes all the characters from the string.
+// ///
+// /// \see isEmpty, erase
+// ///
+// ////////////////////////////////////////////////////////////
+// void Clear();
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Get the size of the string
+// ///
+// /// \return Number of characters in the string
+// ///
+// /// \see isEmpty
+// ///
+// ////////////////////////////////////////////////////////////
+// std::size_t GetSize() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Check whether the string is empty or not
+// ///
+// /// \return True if the string is empty (i.e. contains no character)
+// ///
+// /// \see clear, getSize
+// ///
+// ////////////////////////////////////////////////////////////
+// bool IsEmpty() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Erase one or more characters from the string
+// ///
+// /// This function removes a sequence of \a count characters
+// /// starting from \a position.
+// ///
+// /// \param position Position of the first character to erase
+// /// \param count Number of characters to erase
+// ///
+// ////////////////////////////////////////////////////////////
+// void Erase(std::size_t position, std::size_t count = 1);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Insert one or more characters into the string
+// ///
+// /// This function inserts the characters of \a str
+// /// into the string, starting from \a position.
+// ///
+// /// \param position Position of insertion
+// /// \param str Characters to insert
+// ///
+// ////////////////////////////////////////////////////////////
+// void Insert(std::size_t position, const String& str);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Find a sequence of one or more characters in the string
+// ///
+// /// This function searches for the characters of \a str
+// /// in the string, starting from \a start.
+// ///
+// /// \param str Characters to find
+// /// \param start Where to begin searching
+// ///
+// /// \return Position of \a str in the string, or String::InvalidPos if not found
+// ///
+// ////////////////////////////////////////////////////////////
+// std::size_t Find(const String& str, std::size_t start = 0) const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Replace a substring with another string
+// ///
+// /// This function replaces the substring that starts at index \a position
+// /// and spans \a length characters with the string \a replaceWith.
+// ///
+// /// \param position Index of the first character to be replaced
+// /// \param length Number of characters to replace. You can pass InvalidPos to
+// /// replace all characters until the end of the string.
+// /// \param replaceWith String that replaces the given substring.
+// ///
+// ////////////////////////////////////////////////////////////
+// void Replace(std::size_t position, std::size_t length, const String& replaceWith);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Replace all occurrences of a substring with a replacement string
+// ///
+// /// This function replaces all occurrences of \a searchFor in this string
+// /// with the string \a replaceWith.
+// ///
+// /// \param searchFor The value being searched for
+// /// \param replaceWith The value that replaces found \a searchFor values
+// ///
+// ////////////////////////////////////////////////////////////
+// void Replace(const String& searchFor, const String& replaceWith);
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return a part of the string
+// ///
+// /// This function returns the substring that starts at index \a position
+// /// and spans \a length characters.
+// ///
+// /// \param position Index of the first character
+// /// \param length Number of characters to include in the substring (if
+// /// the string is shorter, as many characters as possible
+// /// are included). \ref InvalidPos can be used to include all
+// /// characters until the end of the string.
+// ///
+// /// \return String object containing a substring of this object
+// ///
+// ////////////////////////////////////////////////////////////
+// String Substring(std::size_t position, std::size_t length = InvalidPos) const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Get a pointer to the C-style array of characters
+// ///
+// /// This functions provides a read-only access to a
+// /// null-terminated C-style representation of the string.
+// /// The returned pointer is temporary and is meant only for
+// /// immediate use, thus it is not recommended to store it.
+// ///
+// /// \return Read-only pointer to the array of characters
+// ///
+// ////////////////////////////////////////////////////////////
+// const uint* GetData() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return an iterator to the beginning of the string
+// ///
+// /// \return Read-write iterator to the beginning of the string characters
+// ///
+// /// \see end
+// ///
+// ////////////////////////////////////////////////////////////
+// Iterator Begin();
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return an iterator to the beginning of the string
+// ///
+// /// \return Read-only iterator to the beginning of the string characters
+// ///
+// /// \see end
+// ///
+// ////////////////////////////////////////////////////////////
+// ConstIterator Begin() const;
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return an iterator to the end of the string
+// ///
+// /// The end iterator refers to 1 position past the last character;
+// /// thus it represents an invalid character and should never be
+// /// accessed.
+// ///
+// /// \return Read-write iterator to the end of the string characters
+// ///
+// /// \see begin
+// ///
+// ////////////////////////////////////////////////////////////
+// Iterator End();
+//
+// ////////////////////////////////////////////////////////////
+// /// \brief Return an iterator to the end of the string
+// ///
+// /// The end iterator refers to 1 position past the last character;
+// /// thus it represents an invalid character and should never be
+// /// accessed.
+// ///
+// /// \return Read-only iterator to the end of the string characters
+// ///
+// /// \see begin
+// ///
+// ////////////////////////////////////////////////////////////
+// ConstIterator End() const;
+//
+// private:
+//
+// friend bool operator ==(const String& left, const String& right);
+// friend bool operator <(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// // Member data
+// ////////////////////////////////////////////////////////////
+// std::basic_string<uint> mString; ///< Internal string of UTF-32 characters
+// };
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of == operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if both strings are equal
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator ==(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of != operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if both strings are different
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator !=(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of < operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if \a left is lexicographically before \a right
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator <(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of > operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if \a left is lexicographically after \a right
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator >(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of <= operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if \a left is lexicographically before or equivalent to \a right
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator <=(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of >= operator to compare two UTF-32 strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return True if \a left is lexicographically after or equivalent to \a right
+// ///
+// ////////////////////////////////////////////////////////////
+// bool operator >=(const String& left, const String& right);
+//
+// ////////////////////////////////////////////////////////////
+// /// \relates String
+// /// \brief Overload of binary + operator to concatenate two strings
+// ///
+// /// \param left Left operand (a string)
+// /// \param right Right operand (a string)
+// ///
+// /// \return Concatenated string
+// ///
+// ////////////////////////////////////////////////////////////
+// String operator +(const String& left, const String& right);
+//
+// #include "String.inl"
+//
+// }
+//}
+//
+//#endif \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/binding/_canvas.cpp b/source/modules/asura-core/graphics/binding/_canvas.cpp
index 7927995..6728ff3 100644
--- a/source/modules/asura-core/graphics/binding/_canvas.cpp
+++ b/source/modules/asura-core/graphics/binding/_canvas.cpp
@@ -25,6 +25,7 @@ namespace AsuraEngine
LUAX_IMPL_METHOD(Canvas, _SetSize)
{
LUAX_PREPARE(L, Canvas);
+ return 0;
}
@@ -33,12 +34,14 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Canvas);
+ return 0;
}
// canvas:Unbind()
LUAX_IMPL_METHOD(Canvas, _Unbind)
{
LUAX_PREPARE(L, Canvas);
+ return 0;
}
diff --git a/source/modules/asura-core/graphics/binding/_color32.cpp b/source/modules/asura-core/graphics/binding/_color32.cpp
index ad7dad5..f2f716a 100644
--- a/source/modules/asura-core/graphics/binding/_color32.cpp
+++ b/source/modules/asura-core/graphics/binding/_color32.cpp
@@ -27,6 +27,7 @@ namespace AsuraEngine
LUAX_IMPL_METHOD(Color32, _ToColor)
{
LUAX_PREPARE(L, Color32);
+ return 0;
}
@@ -34,7 +35,7 @@ namespace AsuraEngine
LUAX_IMPL_METHOD(Color32, _GetRed)
{
LUAX_PREPARE(L, Color32);
-
+ return 0;
}
// color32:GetGreen()
@@ -42,6 +43,7 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Color32);
+ return 0;
}
// color32:GetBlue()
@@ -49,6 +51,7 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Color32);
+ return 0;
}
// color32:GetAlpha()
@@ -56,6 +59,7 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Color32);
+ return 0;
}
}
diff --git a/source/modules/asura-core/graphics/binding/_shader.cpp b/source/modules/asura-core/graphics/binding/_shader.cpp
index a06e54b..af6e981 100644
--- a/source/modules/asura-core/graphics/binding/_shader.cpp
+++ b/source/modules/asura-core/graphics/binding/_shader.cpp
@@ -36,12 +36,14 @@ namespace AsuraEngine
{
LUAX_STATE(L);
+ return 0;
}
// shader:Use()
LUAX_IMPL_METHOD(Shader, _Use)
{
LUAX_PREPARE(L, Shader);
+ return 0;
}
@@ -49,6 +51,7 @@ namespace AsuraEngine
LUAX_IMPL_METHOD(Shader, _Unuse)
{
LUAX_PREPARE(L, Shader);
+ return 0;
}
@@ -57,6 +60,7 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Shader);
+ return 0;
}
// shader:HasUniform()
@@ -64,6 +68,7 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Shader);
+ return 0;
}
// shader:GetUniformLocation()
@@ -71,6 +76,7 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Shader);
+ return 0;
}
// shader:SetBuiltInUniforms()
@@ -78,6 +84,7 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Shader);
+ return 0;
}
// shader:SetUniformFloat()
@@ -85,41 +92,42 @@ namespace AsuraEngine
{
LUAX_PREPARE(L, Shader);
+ return 0;
}
// shader:SetUniformTexture()
LUAX_IMPL_METHOD(Shader, _SetUniformTexture)
{
LUAX_PREPARE(L, Shader);
-
+ return 0;
}
// shader:SetUniformVector2()
LUAX_IMPL_METHOD(Shader, _SetUniformVector2)
{
LUAX_PREPARE(L, Shader);
-
+ return 0;
}
// shader:SetUniformVector3()
LUAX_IMPL_METHOD(Shader, _SetUniformVector3)
{
LUAX_PREPARE(L, Shader);
-
+ return 0;
}
// shader:SetUniformVector4()
LUAX_IMPL_METHOD(Shader, _SetUniformVector4)
{
LUAX_PREPARE(L, Shader);
-
+ return 0;
}
// shader:SetUniformColor()
LUAX_IMPL_METHOD(Shader, _SetUniformColor)
{
LUAX_PREPARE(L, Shader);
-
+ return 0;
}
}
diff --git a/source/modules/asura-core/graphics/canvas.cpp b/source/modules/asura-core/graphics/canvas.cpp
index 8b556d9..89be45c 100644
--- a/source/modules/asura-core/graphics/canvas.cpp
+++ b/source/modules/asura-core/graphics/canvas.cpp
@@ -6,8 +6,7 @@ namespace AsuraEngine
{
Canvas::Canvas()
- : Texture()
- , mWidth(0)
+ : mWidth(0)
, mHeight(0)
{
glGenFramebuffers(1, &mFBO);
@@ -27,15 +26,5 @@ namespace AsuraEngine
glBindTexture(GL_TEXTURE_2D, current_tex);
}
- void Canvas::Bind()
- {
-
- }
-
- void Canvas::Unbind()
- {
-
- }
-
}
} \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/color.cpp b/source/modules/asura-core/graphics/color.cpp
index 4d3691e..9343939 100644
--- a/source/modules/asura-core/graphics/color.cpp
+++ b/source/modules/asura-core/graphics/color.cpp
@@ -35,13 +35,18 @@ namespace AsuraEngine
a = c.a / 255.f;
}
- Color Color::operator *(const Color& c)
+ Color::~Color()
{
- r *= c.r;
- g *= c.g;
- b *= c.b;
- a *= c.a;
}
+ //Color Color::operator *(const Color& c)
+ //{
+ // r *= c.r;
+ // g *= c.g;
+ // b *= c.b;
+ // a *= c.a;
+
+ //}
+
}
} \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/gl.cpp b/source/modules/asura-core/graphics/gl.cpp
index 41d43a3..9ffe010 100644
--- a/source/modules/asura-core/graphics/gl.cpp
+++ b/source/modules/asura-core/graphics/gl.cpp
@@ -3,6 +3,8 @@
#include "../core_config.h"
#include "gl.h"
+using namespace AEMath;
+
namespace AsuraEngine
{
namespace Graphics
@@ -23,5 +25,20 @@ namespace AsuraEngine
{
}
+ //------------------------------------------------------------------------------//
+
+ void OpenGL::SetViewport(const Recti v)
+ {
+ glViewport(v.x, v.y, v.w, v.h);
+ state.viewport = v;
+ }
+
+ Recti OpenGL::GetViewport()
+ {
+ return state.viewport;
+ }
+
+
+
}
} \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/gl.h b/source/modules/asura-core/graphics/gl.h
index bfc60ea..4d21a5a 100644
--- a/source/modules/asura-core/graphics/gl.h
+++ b/source/modules/asura-core/graphics/gl.h
@@ -1,7 +1,9 @@
#ifndef __ASURA_ENGINE_OPENGL_H__
#define __ASURA_ENGINE_OPENGL_H__
-#include "glad/glad.h"
+#include <asura-utils/math/rect.hpp>
+
+#include <glad/glad.h>
namespace AsuraEngine
{
@@ -11,7 +13,9 @@ namespace AsuraEngine
class Profiler;
///
- /// һЩopengl״̬׷١
+ /// һЩopengl״̬׷١ڱ༭രڻ£һڶӦһhwndһhdcԼ
+ /// opengl contextʹwglMakeCurrent(hdc, glc)ָǰ̶߳Ⱦhdc
+ /// openglglcglм¼ľһ̵߳һڵһopenglĵ״̬
///
class OpenGL
{
@@ -19,6 +23,9 @@ namespace AsuraEngine
OpenGL();
~OpenGL();
+ void SetViewport(const AEMath::Recti viewport);
+ AEMath::Recti GetViewport();
+
private:
friend class Profiler;
@@ -28,6 +35,14 @@ namespace AsuraEngine
///
static bool instantiated;
+ ///
+ /// ¼opengl״̬
+ ///
+ struct
+ {
+ AEMath::Recti viewport;
+ } state;
+
};
///
diff --git a/source/modules/asura-core/graphics/image.cpp b/source/modules/asura-core/graphics/image.cpp
index bdd8c3d..2b274c2 100644
--- a/source/modules/asura-core/graphics/image.cpp
+++ b/source/modules/asura-core/graphics/image.cpp
@@ -18,7 +18,6 @@ namespace AsuraEngine
{
}
- //\Ϣ
bool Image::Refresh(DecodedData* data)
{
ASSERT(data);
@@ -27,14 +26,22 @@ namespace AsuraEngine
ASSERT(imgData);
glBindTexture(GL_TEXTURE_2D, mTex);
-
imgData->Lock();
int width = imgData->width;
int height = imgData->height;
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, imgData->pixels);
+ TextureFormat tf = ConvertColorFormat(imgData->format);
+ glTexImage2D(
+ GL_TEXTURE_2D
+ , 0
+ , tf.internalformat
+ , width, height
+ , 0
+ , tf.externalformat
+ , tf.type
+ , imgData->pixels
+ );
mImageData = imgData;
imgData->Unlock();
-
glBindTexture(GL_TEXTURE_2D, 0);
return true;
diff --git a/source/modules/asura-core/graphics/image.h b/source/modules/asura-core/graphics/image.h
index 30df8c0..7795c08 100644
--- a/source/modules/asura-core/graphics/image.h
+++ b/source/modules/asura-core/graphics/image.h
@@ -8,10 +8,11 @@
#include <asura-utils/stringmap.hpp>
#include <asura-utils/manager.hpp>
+#include "../image/image_data.h"
+
#include "texture.h"
#include "color.h"
#include "color32.h"
-#include "image_data.h"
#include "render_state.h"
namespace AsuraEngine
@@ -50,9 +51,8 @@ namespace AsuraEngine
uint GetHeight();
Color32 GetPixel(uint x, uint y);
- void Render(const RenderTarget* rt, const RenderState& state) override;
-
- void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) override;
+ void Render(const RenderTarget* rt, const RenderState& state) override {};
+ void Render(const RenderTarget* rt, const Math::Rectf& quad, const RenderState& state) override {};
private:
diff --git a/source/modules/asura-core/graphics/mesh2d.h b/source/modules/asura-core/graphics/mesh2d.h
index 31d3629..226b9f6 100644
--- a/source/modules/asura-core/graphics/mesh2d.h
+++ b/source/modules/asura-core/graphics/mesh2d.h
@@ -16,6 +16,8 @@ namespace AsuraEngine
{
public:
+ LUAX_DECL_FACTORY(Mesh2D);
+
Mesh2D();
~Mesh2D();
diff --git a/source/modules/asura-core/graphics/render_target.h b/source/modules/asura-core/graphics/render_target.h
index b1a695a..0749cab 100644
--- a/source/modules/asura-core/graphics/render_target.h
+++ b/source/modules/asura-core/graphics/render_target.h
@@ -13,8 +13,6 @@ namespace AsuraEngine
namespace Graphics
{
- class Drawable;
-
///
/// ɱΪȾĿ࣬
/// Canvas(RenderTexture)
diff --git a/source/modules/asura-core/graphics/shader.cpp b/source/modules/asura-core/graphics/shader.cpp
index c0c6f75..f33fd1a 100644
--- a/source/modules/asura-core/graphics/shader.cpp
+++ b/source/modules/asura-core/graphics/shader.cpp
@@ -15,14 +15,14 @@ namespace AsuraEngine
}
- bool Shader::Load(const std::string& vertexShader, const std::string& fragmentShader)
+ bool Shader::Refresh(AEIO::DecodedData* db)
{
-
+ return false;
}
uint Shader::GetUniformLocation(const std::string& uniform)
{
-
+ return 0;
}
GLuint Shader::GetGLProgramHandle()
@@ -45,11 +45,6 @@ namespace AsuraEngine
}
- void Shader::SetUniformFloat(uint loc, float value)
- {
-
- }
-
void Shader::SetUniformTexture(uint loc, const Texture& texture)
{
diff --git a/source/modules/asura-core/graphics/sprite_batch.h b/source/modules/asura-core/graphics/sprite_batch.h
index 3143f73..eb1c89c 100644
--- a/source/modules/asura-core/graphics/sprite_batch.h
+++ b/source/modules/asura-core/graphics/sprite_batch.h
@@ -16,6 +16,8 @@ namespace AsuraEngine
{
public:
+ LUAX_DECL_FACTORY(SpriteBatch);
+
SpriteBatch();
~SpriteBatch();
diff --git a/source/modules/asura-core/graphics/texture.cpp b/source/modules/asura-core/graphics/texture.cpp
index c260ce9..4db6ad3 100644
--- a/source/modules/asura-core/graphics/texture.cpp
+++ b/source/modules/asura-core/graphics/texture.cpp
@@ -22,5 +22,24 @@ namespace AsuraEngine
return mTex;
}
+ TextureFormat Texture::ConvertColorFormat(const ColorFormat& colorformat)
+ {
+ TextureFormat t;
+ switch (colorformat)
+ {
+ case COLOR_FORMAT_RGBA8:
+ t.internalformat = GL_RGBA8;
+ t.externalformat = GL_RGBA;
+ t.type = GL_UNSIGNED_BYTE;
+ break;
+ case COLOR_FORMAT_RGBA32F:
+ t.internalformat = GL_RGBA32F;
+ t.externalformat = GL_RGBA;
+ t.type = GL_FLOAT;
+ break;
+ }
+ return t;
+ }
+
}
} \ No newline at end of file
diff --git a/source/modules/asura-core/graphics/texture.h b/source/modules/asura-core/graphics/texture.h
index 02d3407..f19f3a7 100644
--- a/source/modules/asura-core/graphics/texture.h
+++ b/source/modules/asura-core/graphics/texture.h
@@ -42,6 +42,17 @@ namespace AsuraEngine
};
///
+ /// ʽGPUڲCPUⲿʽ
+ ///
+ struct TextureFormat
+ {
+ GLenum internalformat; // GPUڲʽ
+
+ GLenum externalformat; // CPUⲿʽ
+ GLenum type; // ⲿʽÿchannelֵ
+ };
+
+ ///
/// 2D࣬2d meshrender targetбʹáTextureȾԭϽǣϷ
/// ϲԵѿϵΪ׼EditorҲϽΪԭ㣬Ϊ
/// 㡣
@@ -94,6 +105,13 @@ namespace AsuraEngine
//----------------------------------------------------------------------------//
+ ///
+ /// תcolor formatΪtexture format
+ ///
+ TextureFormat ConvertColorFormat(const ColorFormat& colorformat);
+
+ //----------------------------------------------------------------------------//
+
GLuint mTex;
FilterMode mMinFilter;
diff --git a/source/modules/asura-core/graphics/binding/_image_data.cpp b/source/modules/asura-core/image/binding/_image_data.cpp
index ac9473b..ac9473b 100644
--- a/source/modules/asura-core/graphics/binding/_image_data.cpp
+++ b/source/modules/asura-core/image/binding/_image_data.cpp
diff --git a/source/modules/asura-core/graphics/binding/_image_decode_task.cpp b/source/modules/asura-core/image/binding/_image_decode_task.cpp
index 76b544b..76b544b 100644
--- a/source/modules/asura-core/graphics/binding/_image_decode_task.cpp
+++ b/source/modules/asura-core/image/binding/_image_decode_task.cpp
diff --git a/source/modules/asura-core/graphics/image_data.cpp b/source/modules/asura-core/image/image_data.cpp
index 64f83a8..1a6d3a2 100644
--- a/source/modules/asura-core/graphics/image_data.cpp
+++ b/source/modules/asura-core/image/image_data.cpp
@@ -31,11 +31,6 @@ namespace AsuraEngine
delete[] pixels;
}
- ImageData::operator bool()
- {
- return size > 0;
- }
-
void ImageData::Decode(IO::DataBuffer& buffer)
{
for (ImageDecoder* decoder : ImageDecoders)
@@ -50,7 +45,7 @@ namespace AsuraEngine
Color ImageData::GetPixel(uint x, uint y)
{
-
+ return Color();
}
void ImageData::Lock()
diff --git a/source/modules/asura-core/graphics/image_data.h b/source/modules/asura-core/image/image_data.h
index b9d656c..d9427d3 100644
--- a/source/modules/asura-core/graphics/image_data.h
+++ b/source/modules/asura-core/image/image_data.h
@@ -9,8 +9,8 @@
#include <asura-utils/threading/thread.h>
#include <asura-utils/threading/mutex.h>
-#include "texture.h"
-#include "color.h"
+#include "../graphics/texture.h"
+#include "../graphics/color.h"
namespace AsuraEngine
{
diff --git a/source/modules/asura-core/graphics/image_decode_task.cpp b/source/modules/asura-core/image/image_decode_task.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/graphics/image_decode_task.cpp
+++ b/source/modules/asura-core/image/image_decode_task.cpp
diff --git a/source/modules/asura-core/graphics/image_decode_task.h b/source/modules/asura-core/image/image_decode_task.h
index ec5ed49..15b0837 100644
--- a/source/modules/asura-core/graphics/image_decode_task.h
+++ b/source/modules/asura-core/image/image_decode_task.h
@@ -1,7 +1,7 @@
#ifndef __ASURA_IMAGE_DECODE_TASK_H__
#define __ASURA_IMAGE_DECODE_TASK_H__
-#include <asura-utils/threading/thread_task.h>
+#include <asura-utils/threading/task.h>
#include <asura-utils/scripting/portable.hpp>
namespace AsuraEngine
@@ -11,7 +11,7 @@ namespace AsuraEngine
class ImageDecodeTask
: public AEScripting::Portable<ImageDecodeTask>
- , public AEThreading::ThreadTask
+ , public AEThreading::Task
{
public:
diff --git a/source/modules/asura-core/graphics/image_decoder.h b/source/modules/asura-core/image/image_decoder.h
index 869c82a..8b82d2b 100644
--- a/source/modules/asura-core/graphics/image_decoder.h
+++ b/source/modules/asura-core/image/image_decoder.h
@@ -10,12 +10,12 @@ namespace AsuraEngine
namespace Graphics
{
- class ImageDecoder
+ ASURA_ABSTRACT class ImageDecoder
{
public:
- ImageDecoder();
- virtual ~ImageDecoder();
+ ImageDecoder() {};
+ virtual ~ImageDecoder() {};
///
/// жڴǷñdecoderѹ
diff --git a/source/modules/asura-core/graphics/png_decoder.cpp b/source/modules/asura-core/image/png_decoder.cpp
index 80463d5..80463d5 100644
--- a/source/modules/asura-core/graphics/png_decoder.cpp
+++ b/source/modules/asura-core/image/png_decoder.cpp
diff --git a/source/modules/asura-core/graphics/png_decoder.h b/source/modules/asura-core/image/png_decoder.h
index 6377940..6377940 100644
--- a/source/modules/asura-core/graphics/png_decoder.h
+++ b/source/modules/asura-core/image/png_decoder.h
diff --git a/source/modules/asura-core/graphics/stb_decoder.cpp b/source/modules/asura-core/image/stb_decoder.cpp
index 9a14141..b19f28b 100644
--- a/source/modules/asura-core/graphics/stb_decoder.cpp
+++ b/source/modules/asura-core/image/stb_decoder.cpp
@@ -1,7 +1,9 @@
#include <asura-utils/exceptions/exception.h>
#include "stb_decoder.h"
-#include "stb/stb_image.h"
+
+#define STB_IMAGE_IMPLEMENTATION
+#include <stb/stb_image.h>
namespace AsuraEngine
{
@@ -49,11 +51,12 @@ namespace AsuraEngine
imageData.Lock();
if (imageData.pixels)
- delete[] imageData.pixels;
+ free(imageData.pixels);
imageData.pixels = (byte*)data;
imageData.format = format;
- imageData.width = width;
+ imageData.width = width;
imageData.height = height;
+ imageData.size = size;
imageData.Unlock();
}
diff --git a/source/modules/asura-core/graphics/stb_decoder.h b/source/modules/asura-core/image/stb_decoder.h
index 76e70c3..76e70c3 100644
--- a/source/modules/asura-core/graphics/stb_decoder.h
+++ b/source/modules/asura-core/image/stb_decoder.h
diff --git a/source/modules/asura-core/graphics/mesh2d_data.cpp b/source/modules/asura-core/mesh/mesh2d_data.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/graphics/mesh2d_data.cpp
+++ b/source/modules/asura-core/mesh/mesh2d_data.cpp
diff --git a/source/modules/asura-core/graphics/mesh2d_data.h b/source/modules/asura-core/mesh/mesh2d_data.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/graphics/mesh2d_data.h
+++ b/source/modules/asura-core/mesh/mesh2d_data.h
diff --git a/source/modules/asura-core/threading/thread_ex.cpp b/source/modules/asura-core/threading/thread_ex.cpp
index 334e58b..4883f90 100644
--- a/source/modules/asura-core/threading/thread_ex.cpp
+++ b/source/modules/asura-core/threading/thread_ex.cpp
@@ -8,6 +8,7 @@ namespace AsuraEngine
int ThreadEx::Process()
{
+ return 0;
}
void ThreadEx::RegisterModules()
diff --git a/source/modules/asura-core/wnd/binding/_window.cpp b/source/modules/asura-core/window/binding/_window.cpp
index eb92de8..e477408 100644
--- a/source/modules/asura-core/wnd/binding/_window.cpp
+++ b/source/modules/asura-core/window/binding/_window.cpp
@@ -1,4 +1,4 @@
-#include "../../graphics/image_data.h"
+#include "../../image/image_data.h"
#include "../window.h"
@@ -7,7 +7,7 @@ using namespace AEGraphics;
namespace AsuraEngine
{
- namespace Wnd
+ namespace Window
{
LUAX_REGISTRY(Window)
diff --git a/source/modules/asura-core/wnd/window.cpp b/source/modules/asura-core/window/window.cpp
index 174d04e..99433d5 100644
--- a/source/modules/asura-core/wnd/window.cpp
+++ b/source/modules/asura-core/window/window.cpp
@@ -8,7 +8,7 @@
namespace AsuraEngine
{
- namespace Wnd
+ namespace Window
{
Window::Window()
@@ -23,17 +23,15 @@ namespace AsuraEngine
}
#define try_init_window(impl) \
- if (!mImpl) \
- { \
- try \
+ if (!mImpl) \
{ \
- mImpl = new impl(config); \
- } \
- catch (Exception& e) \
- { \
- mImpl = nullptr; \
- } \
- }
+ mImpl = new impl(); \
+ if (!mImpl->Init(config)) \
+ { \
+ delete mImpl; \
+ mImpl = nullptr; \
+ } \
+ }
bool Window::Init(const WindowConfig& config)
{
@@ -41,7 +39,7 @@ namespace AsuraEngine
#if ASURA_WINDOW_SDL
try_init_window(WindowImplSDL);
#endif
- ASSERT(mImpl);
+ return mImpl != nullptr;
}
void Window::Exit()
@@ -83,7 +81,7 @@ namespace AsuraEngine
void Window::Clear(const AEGraphics::Color& col /*= AEGraphics::Color::Black*/)
{
ASSERT(mImpl);
-
+ glClearColor(col.r, col.g, col.b, col.a);
}
void Window::Clear(const Math::Recti& quad, const AEGraphics::Color& col /*= AEGraphics::Color::Black*/)
diff --git a/source/modules/asura-core/wnd/window.h b/source/modules/asura-core/window/window.h
index eb8a574..8ce0e64 100644
--- a/source/modules/asura-core/wnd/window.h
+++ b/source/modules/asura-core/window/window.h
@@ -11,7 +11,7 @@
namespace AsuraEngine
{
- namespace Wnd
+ namespace Window
{
class WindowImpl;
@@ -21,22 +21,22 @@ namespace AsuraEngine
///
enum WindowFlag
{
- WINDOW_FULLSCREEN = 1 << 1, /**< fullscreen window */
- WINDOW_OPENGL = 1 << 2, /**< window usable with OpenGL context */
- WINDOW_SHOWN = 1 << 3, /**< window is visible */
- WINDOW_HIDDEN = 1 << 4, /**< window is not visible */
- WINDOW_BORDERLESS = 1 << 5, /**< no window decoration */
- WINDOW_RESIZABLE = 1 << 6, /**< window can be resized */
- WINDOW_MINIMIZED = 1 << 7, /**< window is minimized */
- WINDOW_MAXIMIZED = 1 << 8, /**< window is maximized */
- WINDOW_INPUT_GRABBED = 1 << 9, /**< window has grabbed input focus */
- WINDOW_INPUT_FOCUS = 1 << 10, /**< window has input focus */
- WINDOW_MOUSE_FOCUS = 1 << 11, /**< window has mouse focus */
- WINDOW_ALLOW_HIGHDPI = 1 << 12, /**< window should be created in high-DPI mode if supported.
- On macOS NSHighResolutionCapable must be set true in the
- application's Info.plist for this to have any effect. */
- WINDOW_MOUSE_CAPTURE = 1 << 13, /**< window has mouse captured (unrelated to INPUT_GRABBED) */
- WINDOW_ALWAYS_ON_TOP = 1 << 14, /**< window should always be above others */
+ WINDOW_FULLSCREEN = 1 << 1, ///< fullscreen window
+ WINDOW_OPENGL = 1 << 2, ///< window usable with OpenGL context
+ WINDOW_SHOWN = 1 << 3, ///< window is visible
+ WINDOW_HIDDEN = 1 << 4, ///< window is not visible
+ WINDOW_BORDERLESS = 1 << 5, ///< no window decoration
+ WINDOW_RESIZABLE = 1 << 6, ///< window can be resized
+ WINDOW_MINIMIZED = 1 << 7, ///< window is minimized
+ WINDOW_MAXIMIZED = 1 << 8, ///< window is maximized
+ WINDOW_INPUT_GRABBED = 1 << 9, ///< window has grabbed input focus
+ WINDOW_INPUT_FOCUS = 1 << 10, ///< window has input focus
+ WINDOW_MOUSE_FOCUS = 1 << 11, ///< window has mouse focus
+ WINDOW_ALLOW_HIGHDPI = 1 << 12, ///< window should be created in high-DPI mode if supported.
+ ///< On macOS NSHighResolutionCapable must be set true in the
+ ///< application's Info.plist for this to have any effect.
+ WINDOW_MOUSE_CAPTURE = 1 << 13, ///< window has mouse captured (unrelated to INPUT_GRABBED)
+ WINDOW_ALWAYS_ON_TOP = 1 << 14, ///< window should always be above others
};
///
@@ -130,6 +130,8 @@ namespace AsuraEngine
WindowImpl() {};
virtual ~WindowImpl() {};
+ virtual bool Init(const WindowConfig& config);
+
virtual void SetSize(uint width, uint height) = 0;
virtual void SetPosition(int x, int y) = 0;
virtual void SetTitils(const std::string& title) = 0;
@@ -144,6 +146,6 @@ namespace AsuraEngine
}
}
-namespace AEWnd = AsuraEngine::Wnd;
+namespace AEWindow = AsuraEngine::Window;
#endif \ No newline at end of file
diff --git a/source/modules/asura-core/wnd/window_impl_glew.cpp b/source/modules/asura-core/window/window_impl_glew.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/wnd/window_impl_glew.cpp
+++ b/source/modules/asura-core/window/window_impl_glew.cpp
diff --git a/source/modules/asura-core/wnd/window_impl_glew.h b/source/modules/asura-core/window/window_impl_glew.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/wnd/window_impl_glew.h
+++ b/source/modules/asura-core/window/window_impl_glew.h
diff --git a/source/modules/asura-core/wnd/window_impl_glut.cpp b/source/modules/asura-core/window/window_impl_glut.cpp
index e69de29..e69de29 100644
--- a/source/modules/asura-core/wnd/window_impl_glut.cpp
+++ b/source/modules/asura-core/window/window_impl_glut.cpp
diff --git a/source/modules/asura-core/wnd/window_impl_glut.h b/source/modules/asura-core/window/window_impl_glut.h
index e69de29..e69de29 100644
--- a/source/modules/asura-core/wnd/window_impl_glut.h
+++ b/source/modules/asura-core/window/window_impl_glut.h
diff --git a/source/modules/asura-core/wnd/window_impl_sdl.cpp b/source/modules/asura-core/window/window_impl_sdl.cpp
index e608b8b..9554e37 100644
--- a/source/modules/asura-core/wnd/window_impl_sdl.cpp
+++ b/source/modules/asura-core/window/window_impl_sdl.cpp
@@ -12,21 +12,32 @@ using namespace AEGraphics;
namespace AsuraEngine
{
- namespace Wnd
+ namespace Window
{
#define asura_flag_to_sdl_flag(flag, _flag, _sdl_flag) \
if ((flag & _flag) != 0) \
flag |= _sdl_flag
- WindowImplSDL::WindowImplSDL(const WindowConfig& config)
+ WindowImplSDL::WindowImplSDL()
: mWnd(nullptr)
, mGLContext(0)
{
+ }
+
+ WindowImplSDL::~WindowImplSDL()
+ {
+ SDL_GL_DeleteContext(mGLContext);
+ SDL_DestroyWindow(mWnd);
+ SDL_FlushEvent(SDL_WINDOWEVENT);
+ }
+
+ bool WindowImplSDL::Init(const WindowConfig& config)
+ {
if (SDL_Init(SDL_INIT_VIDEO) < 0)
- throw Exception("Cant init sdl video.");
+ return false;
- int flag = 0x0;
+ int flag = 0;
asura_flag_to_sdl_flag(flag, WINDOW_FULLSCREEN, SDL_WINDOW_FULLSCREEN);
asura_flag_to_sdl_flag(flag, WINDOW_OPENGL, SDL_WINDOW_OPENGL);
asura_flag_to_sdl_flag(flag, WINDOW_SHOWN, SDL_WINDOW_SHOWN);
@@ -56,8 +67,8 @@ namespace AsuraEngine
mWnd = SDL_CreateWindow(config.title.c_str(), config.x, config.y, config.width, config.height, flag);
if (!mWnd)
- throw Exception("Cant create SDL window.");
-
+ return false;
+
// ͼ
try
{
@@ -72,13 +83,13 @@ namespace AsuraEngine
int w = img->width, h = img->height;
surface = SDL_CreateRGBSurfaceFrom(
- img->pixels,
- w, h,
- 32,
- w * 4,
- Color32::RMASK,
- Color32::GMASK,
- Color32::BMASK,
+ img->pixels,
+ w, h,
+ 32,
+ w * 4,
+ Color32::RMASK,
+ Color32::GMASK,
+ Color32::BMASK,
Color32::AMASK
);
@@ -88,7 +99,8 @@ namespace AsuraEngine
SDL_FreeSurface(surface);
}
}
- } catch (...)
+ }
+ catch (...)
{
}
@@ -97,18 +109,13 @@ namespace AsuraEngine
if (!mGLContext)
{
SDL_DestroyWindow(mWnd);
- throw Exception("Cant create SDL GL Context.");
+ return false;
}
SDL_GL_MakeCurrent(mWnd, mGLContext);
SDL_GL_SetSwapInterval(config.vsync ? 1 : 0);
- }
- WindowImplSDL::~WindowImplSDL()
- {
- SDL_GL_DeleteContext(mGLContext);
- SDL_DestroyWindow(mWnd);
- SDL_FlushEvent(SDL_WINDOWEVENT);
+ return true;
}
void WindowImplSDL::SetSize(uint width, uint height)
diff --git a/source/modules/asura-core/wnd/window_impl_sdl.h b/source/modules/asura-core/window/window_impl_sdl.h
index 0e81c0a..de4cafb 100644
--- a/source/modules/asura-core/wnd/window_impl_sdl.h
+++ b/source/modules/asura-core/window/window_impl_sdl.h
@@ -11,16 +11,18 @@
namespace AsuraEngine
{
- namespace Wnd
+ namespace Window
{
class WindowImplSDL ASURA_FINAL : public WindowImpl
{
public:
- WindowImplSDL(const WindowConfig& config);
+ WindowImplSDL();
~WindowImplSDL();
+ bool Init(const WindowConfig& config);
+
void SetSize(uint width, uint height) override;
void SetPosition(int x, int y) override;
void SetTitils(const std::string& title) override;