parent
519124b8cf
commit
392bee77a7
BIN
libs/imgui/misc/fonts/Inter-Light.ttf
Normal file
BIN
libs/imgui/misc/fonts/Inter-Light.ttf
Normal file
Binary file not shown.
BIN
libs/imgui/misc/fonts/Inter-Regular.ttf
Normal file
BIN
libs/imgui/misc/fonts/Inter-Regular.ttf
Normal file
Binary file not shown.
4546
libs/imgui/misc/fonts/inter.h
Normal file
4546
libs/imgui/misc/fonts/inter.h
Normal file
File diff suppressed because it is too large
Load Diff
4546
src/inter.h
Normal file
4546
src/inter.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -110,6 +110,8 @@ int main(int, char**)
|
||||
bool show_another_window = false;
|
||||
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
|
||||
|
||||
init();
|
||||
|
||||
// Main loop
|
||||
bool done = false;
|
||||
while (!done)
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
#include <imgui.h>
|
||||
#include <imgui_internal.h>
|
||||
|
||||
#include "inter.h"
|
||||
|
||||
|
||||
bool is_leap_year(int year) {
|
||||
@ -29,6 +32,11 @@ int days_per_month(int year, int month){
|
||||
return days_in_month[month - 1];
|
||||
}
|
||||
|
||||
void init(){
|
||||
ImGuiIO &io = ImGui::GetIO();
|
||||
io.Fonts->AddFontFromMemoryCompressedTTF(inter_compressed_data, inter_compressed_size);
|
||||
}
|
||||
|
||||
void per_frame(){
|
||||
static bool use_work_area = true;
|
||||
static ImGuiWindowFlags flags = ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings;
|
||||
@ -38,45 +46,105 @@ void per_frame(){
|
||||
ImGui::SetNextWindowPos(use_work_area ? viewport->WorkPos : viewport->Pos);
|
||||
ImGui::SetNextWindowSize(use_work_area ? viewport->WorkSize : viewport->Size);
|
||||
|
||||
//Begin
|
||||
ImGuiStyle& style = ImGui::GetStyle();
|
||||
auto default_item_spacing = style.ItemSpacing;
|
||||
|
||||
const char* month_names[] = {"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"};
|
||||
|
||||
//
|
||||
ImGui::Begin("Work Calendar", 0, flags);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_TableHeaderBg, {0,0,0,0});
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderHovered, {0,0,0,0});
|
||||
ImGui::PushStyleColor(ImGuiCol_HeaderActive, {0,0,0,0});
|
||||
|
||||
for (int month = 1; month <= 12; month++) {
|
||||
ImGui::PushID(month);
|
||||
//month
|
||||
if(ImGui::BeginTable("Month", 8, ImGuiTableFlags_SizingFixedSame | ImGuiTableFlags_NoHostExtendX)) {
|
||||
ImGui::TableSetupColumn("KW");
|
||||
ImGui::TableSetupColumn("Mo");
|
||||
ImGui::TableSetupColumn("Di");
|
||||
ImGui::TableSetupColumn("Mi");
|
||||
ImGui::TableSetupColumn("Do");
|
||||
ImGui::TableSetupColumn("Fr");
|
||||
ImGui::TableSetupColumn("Sa");
|
||||
ImGui::TableSetupColumn("So");
|
||||
ImGui::TableHeadersRow();
|
||||
ImGui::PushStyleColor(ImGuiCol_TableBorderStrong, {0,0,0,0});
|
||||
ImGui::PushStyleColor(ImGuiCol_TableBorderLight, {0,0,0,0});
|
||||
|
||||
int offset = weekday_from_day(2025, month, 1);
|
||||
//tage
|
||||
for (int day = 1; day <= days_per_month(2025, month); day++) {
|
||||
int weekday = weekday_from_day(2025, month, day);
|
||||
if(ImGui::BeginTable("Month", 1, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoHostExtendX)) {
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::TextAligned(0.5, -FLT_MIN, month_names[month - 1]);
|
||||
|
||||
if(weekday == 0 || day == 1){
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::Text("%d", calendar_week_from_day(2025, month, day));
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
|
||||
//calendar week table
|
||||
if(ImGui::BeginTable("CalendarWeek", 1, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_Borders)){
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::TextAligned(0.5, -FLT_MIN, "KW");
|
||||
|
||||
for (int day = 1; day <= days_per_month(2025, month); day++) {
|
||||
int weekday = weekday_from_day(2025, month, day);
|
||||
|
||||
if(weekday == 0 || day == 1){
|
||||
ImGui::TableNextRow();
|
||||
ImGui::TableSetColumnIndex(0);
|
||||
ImGui::TextAligned(0.5, -FLT_MIN, "%d", calendar_week_from_day(2025, month, day));
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(weekday + 1);
|
||||
ImGui::Text("%d", day);
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::SameLine(0, 0);
|
||||
|
||||
ImGui::BeginGroup();
|
||||
ImGui::PushStyleVarY(ImGuiStyleVar_ItemSpacing, 0);
|
||||
|
||||
if(ImGui::BeginTable("Weekdays", 7, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_Borders)){
|
||||
|
||||
ImGui::TableSetupColumn("Mo");
|
||||
ImGui::TableSetupColumn("Di");
|
||||
ImGui::TableSetupColumn("Mi");
|
||||
ImGui::TableSetupColumn("Do");
|
||||
ImGui::TableSetupColumn("Fr");
|
||||
ImGui::TableSetupColumn("Sa");
|
||||
ImGui::TableSetupColumn("So");
|
||||
ImGui::TableHeadersRow();
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleColor(2);
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_TableBorderStrong, {119/255.0f,119/255.0f,119/255.0f,83/255.0f});
|
||||
ImGui::PushStyleColor(ImGuiCol_TableBorderLight, {119/255.0f,119/255.0f,119/255.0f,83/255.0f});
|
||||
|
||||
//days of month table
|
||||
if(ImGui::BeginTable("Weekdays", 7, ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_Borders)) {
|
||||
int offset = weekday_from_day(2025, month, 1);
|
||||
//tage
|
||||
for (int day = 1; day <= days_per_month(2025, month); day++) {
|
||||
int weekday = weekday_from_day(2025, month, day);
|
||||
|
||||
if(weekday == 0 || day == 1){
|
||||
ImGui::TableNextRow();
|
||||
}
|
||||
|
||||
ImGui::TableSetColumnIndex(weekday);
|
||||
ImGui::TextAligned(0.5, -FLT_MIN, "%d", day);
|
||||
}
|
||||
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleColor(2);
|
||||
ImGui::PopStyleVar();
|
||||
//weekday header table + days of month table
|
||||
ImGui::EndGroup();
|
||||
//month table
|
||||
ImGui::EndTable();
|
||||
if ((month % 4) != 0)
|
||||
ImGui::SameLine();
|
||||
}
|
||||
|
||||
if ((month % 4) != 0)
|
||||
ImGui::SameLine();
|
||||
|
||||
ImGui::PopID();
|
||||
}
|
||||
|
||||
ImGui::PopStyleColor(3);
|
||||
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user