Skip to content

Commit

Permalink
use microlog instead PrintDebug
Browse files Browse the repository at this point in the history
it compile bu not working(page fault before main)
created operators << for classes
updated microlog
  • Loading branch information
Egor00f committed Oct 20, 2024
1 parent e9f7f63 commit 35e4522
Show file tree
Hide file tree
Showing 36 changed files with 198 additions and 204 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,5 @@
build/
/Docs/html/
.vscode/c_cpp_properties.json
/.vscode
.vscode/kits.json
.vscode/tasks.json
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-themes",
"ms-vscode.cpptools"
]
}
5 changes: 3 additions & 2 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@
"kolibri_msgbox.h": "c",
"stdlib.h": "c",
"bitset": "cpp",
"include_ksys.h": "c"
"include_ksys.h": "c",
"iomanip": "cpp"
},
"editor.insertSpaces": false,
"C_Cpp.default.compilerPath": "/home/autobuild/tools/win32/bin/kos32-g++",
Expand Down Expand Up @@ -138,7 +139,7 @@
"libimg",
"microlog",
"msgbox",
"rasterwoks",
"rasterwoks"

],
}
39 changes: 23 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)


add_subdirectory(microlog)


set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
Expand Down Expand Up @@ -62,10 +62,6 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Wctor-dtor-privacy -Wnon-virt
set(CMAKE_C_FLAGS_RELEASE "-O2")
set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE})

# CONFIGURED C_Layer ASM
set(C_Layer_Path ${KOLIBRIOS_REPO}/contrib/C_Layer)
set(C_Layer_SRC_PATH ${C_Layer_Path}/ASM)

# PATH TO KOLIBRILIB SOURCES
set(KolibriLib_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/include)
SET(SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/src/KolibriLib)
Expand Down Expand Up @@ -116,39 +112,50 @@ SET(SOURCES
${SRC_PATH}/C_Layer/msgbox.cpp
)

#LOADERS THAT LOAD SHARED C_LAYER LIBS
ADD_LIBRARY(C_LAYER_LOADERS OBJECT
# CONFIGURED C_Layer ASM
set(C_Layer_Path ${KOLIBRIOS_REPO}/contrib/C_Layer)
set(C_Layer_SRC_PATH ${C_Layer_Path}/ASM)

#LOADERS THAT LOAD SHARED LIBS
ADD_LIBRARY(
C_LAYER_LOADERS STATIC
${C_Layer_SRC_PATH}/loadlibimg.asm
${C_Layer_SRC_PATH}/loadrasterworks.asm
${C_Layer_SRC_PATH}/loadbuf2d.asm
${C_Layer_SRC_PATH}/loadproclib.asm
)

target_include_directories(C_LAYER_LOADERS PRIVATE ${KOLIBRIOS_REPO}/programs)
target_include_directories(
C_LAYER_LOADERS
PRIVATE ${KOLIBRIOS_REPO}/programs
)



# ТА САМАЯ ЛИБА ИЗ_ЗА КОТОРОЙ ВСЁ ЭТО
ADD_LIBRARY(KolibriLib STATIC ${SOURCES})
target_link_libraries(
KolibriLib
PUBLIC C_LAYER_LOADERS
PUBLIC microlog
ADD_LIBRARY(KolibriLib STATIC
${SOURCES}
$<TARGET_OBJECTS:C_LAYER_LOADERS>
$<TARGET_OBJECTS:microlog>
)

target_compile_options(KolibriLib
target_compile_options(
KolibriLib
PRIVATE -D__MakeStaticLib__
PUBLIC -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32
)

target_include_directories(KolibriLib
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
target_include_directories(
KolibriLib
PUBLIC ${LIBSTDCPP_DIR}/include
PUBLIC ${LIBC_DIR}/include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
PUBLIC ${KOLIBRIOS_REPO}/contrib/sdk/sources/freetype/include
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/microlog/include
)



#GENERATE DOXYGEN ONLY THIS PROJECT ISNT SUBPROECT
if(KolibriLib_BUILD_DOCS)
message("-- Build KolibriLib Docs")
Expand Down
14 changes: 7 additions & 7 deletions examples/CheckBox/Checkbox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ using namespace KolibriLib;

int main()
{
Window wndw("Checbox example");
Window window("Checkbox example");

auto frame = wndw.AddElement(UIElement(
auto frame = window.AddElement(UIElement(
UDim(0.2f, 0.2f),
UDim(0.6f, 0.4f)));
frame->SetColor(Globals::SystemColors.work_area);

auto checkbox = wndw.AddElement(CheckBox(
auto checkbox = window.AddElement(CheckBox(
UDim(0.1f, 0.25f),
UDim(0.2f, 0.5f)
));
checkbox->SetParent(frame);

auto textlabel = wndw.AddElement(TextLabel(
auto textLabel = window.AddElement(TextLabel(
UDim(0.3f, 0.0f),
UDim(0.7f, 1.0f),
"<- checkbox"
));
textlabel->SetParent(frame);
textLabel->SetParent(frame);

wndw.RenderAllElements();
window.RenderAllElements();

bool exit = false;
while (!exit)
{
switch (wndw.Handler())
switch (window.Handler())
{
case Event::Exit:
exit = true;
Expand Down
3 changes: 2 additions & 1 deletion examples/ProgressBar/ProgressBar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ int main()
}

break;
}
default:
break;
}

}

return 0;
Expand Down
3 changes: 1 addition & 2 deletions include/C_Layer/README
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ C Layer

Изменения в основном это:
- Изменения имён некоторых структур
- Почти полностью сросся c этой библиотекой
- He использектся kos32sys.h
- He используется kos32sys.h
- Верезана большая часть всего
- cpoщeнн c KolibriLib
- добавленные hpp файлы автоматически загружют либы
Expand Down
28 changes: 14 additions & 14 deletions include/C_Layer/buf2d.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace buf2d
{
/**
* @brief Загрузщик либы
* @brief Загрузчик либы
* @details Автоматически загружет билиотеку
*/
class Loader final
Expand Down Expand Up @@ -60,11 +60,11 @@ namespace buf2d
};

/**
* @brief Создать буффер
* @brief Создать буфер
* @param size размеры буфера
* @param color цвет
* @param bpp бит на пиксель
* @return указатель на созданный буффер
* @return указатель на созданный буфер
*/
inline buf2d_struct* Create(const KolibriLib::Size& size, KolibriLib::Colors::Color color, BPP bpp)
{
Expand All @@ -76,19 +76,19 @@ namespace buf2d
}

/**
* @brief Создать буффер
* @brief Создать буфер
* @param size размеры буфера
* @param color цвет
* @param bpp бит на пиксель
* @return указатель на созданный буффер
* @return указатель на созданный буфер
*/
inline void Create(buf2d_struct* buff, const KolibriLib::Size& size, KolibriLib::Colors::Color color, BPP bpp)
{
buff = Create(size, color, bpp);
}

/**
* @brief Удалить буффер
* @brief Удалить буфер
* @param buff
*/
inline void Delete(buf2d_struct* buff)
Expand All @@ -97,8 +97,8 @@ namespace buf2d
}

/**
* @brief Очистить буффер цветом
* @param buff буффер
* @brief Очистить буфер цветом
* @param buff буфер
* @param color цвет
*/
inline void Clear(buf2d_struct* buff, KolibriLib::Colors::Color color)
Expand Down Expand Up @@ -131,7 +131,7 @@ namespace buf2d

/**
* @brief Получить пиксель
* @param buff буффер
* @param buff буфер
* @param coord координаты пикселя
* @return цвет пикселя
*/
Expand All @@ -141,7 +141,7 @@ namespace buf2d
}

/**
* @brief Изменить размер буффера
* @brief Изменить размер буфера
* @param buff буфер
* @param NewSize новый размер
* @param scale растягивать ли изображение
Expand All @@ -153,7 +153,7 @@ namespace buf2d

/**
* @brief Нарисовать прямоугольник (линии)
* @param buff буффер в котором рисуктся прямоугольник
* @param buff буфер в котором рисуются прямоугольник
* @param coord Координаты левого верхнего угла прямоугольника
* @param size размер прямоугольника
* @param color цвет
Expand All @@ -171,7 +171,7 @@ namespace buf2d

/**
* @brief Нарисовать прямоугольник (закрашенный)
* @param buff буффер в котором рисуктся прямоугольник
* @param buff буфер в котором рисуются прямоугольник
* @param coord Координаты левого верхнего угла прямоугольника
* @param size размер прямоугольника
* @param color цвет
Expand All @@ -192,10 +192,10 @@ namespace buf2d
* @param dst Буфер на котором рисуется (RGB)
* @param src буфер с прозрачностью
* @param coord Координаты src на dst. Координаты для вывода изображения, определяют положение рисуемой картинки в buf_0
* @details рабоает так же как и BitBlt, но эта применяет прозрачность.
* @details работает так же как и BitBlt, но эта применяет прозрачность.
* Для расчета прозрачности используются координаты src
*/
inline void ApplyTrasparency(buf2d_struct* dst, const buf2d_struct* src, const KolibriLib::Coord& coord = {0,0})
inline void ApplyTransparency(buf2d_struct* dst, const buf2d_struct* src, const KolibriLib::Coord& coord = {0,0})
{
assert(src->color_bit == static_cast<uint8_t>(BPP::RGBA) && dst->color_bit == static_cast<uint8_t>(BPP::RGB));

Expand Down
2 changes: 1 addition & 1 deletion include/C_Layer/msgbox.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class msgBox

using Callback = msgbox_callback;

/// @brief Констуктор
/// @brief Конструктор
/// @param title заголовок
/// @param text текст
/// @param ButtonsText текст для кнопок
Expand Down
4 changes: 2 additions & 2 deletions include/C_Layer/rasterworks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern rasterwoksLib rasterworksLibv;
/// @param FontColor цвет текста
/// @param flags флаги
/// @param encoding кодировка тектса
/// @return буффер
/// @return буфер
inline void *drawTextToBuff(const void *canvas, const KolibriLib::Coord &coord, const KolibriLib::Size &size, const std::string &text, const KolibriLib::Size &CharSize, const KolibriLib::Colors::Color &FontColor, const std::uint8_t &flags, const std::uint8_t encoding = RasterworksEncoding::Rasterworks_UTF8)
{
return drawTextToBuff(
Expand All @@ -45,7 +45,7 @@ inline void *drawTextToBuff(const void *canvas, const KolibriLib::Coord &coord,

/// @brief тоже что и drawTextToBuff, но сразу выводится текст
/// @param coord Координаты
/// @param size размеры буффера
/// @param size размеры буфера
/// @param text текст
/// @param CharSize
/// @param FontColor
Expand Down
8 changes: 7 additions & 1 deletion include/kolibriLib/UI/UI.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,14 @@ namespace KolibriLib
void DeleteChildren(const UIElement* child) const;
};
}
}

void PrintDebug(const UI::UIElement &out);
inline std::ostream &operator<<(std::ostream &os, const KolibriLib::UI::UIElement& element)
{
return os << "UIElement" << std::endl \
<< "Coord: " << element.GetCoord() << std::endl \
<< "Size: " << element.GetSize() << std::endl \
<< "MainColor" << element.GetColor() << std::endl;
}

#endif // __UI_HPP__
5 changes: 5 additions & 0 deletions include/kolibriLib/UI/buttons/baseButton.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,9 @@ namespace KolibriLib
} // namespace KolibriLib


inline std::ostream &operator<<(std::ostream &os, const KolibriLib::UI::buttons::BaseButton& element)
{
return os << "BaseButton" << std::endl << "ID: " << element.GetId();
}

#endif // __BUTTON_HPP__
7 changes: 5 additions & 2 deletions include/kolibriLib/UI/buttons/button.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,12 @@ namespace KolibriLib
private:
};
} // namespace buttons

} // namespace UI

} // namespace KolibriLib

inline std::ostream &operator<<(std::ostream &os, const KolibriLib::UI::buttons::Button& element)
{
return os << static_cast<KolibriLib::UI::buttons::BaseButton>(element) << std::endl << static_cast<KolibriLib::UI::UIElement>(element);
}

#endif // __BUTTON_HPP__
Loading

0 comments on commit 35e4522

Please sign in to comment.