add current day

add and use new italic_bold font for highlighting

#11
This commit is contained in:
Ammerhai 2025-11-21 12:33:18 +01:00
parent 910b238763
commit 414e9bb330
4 changed files with 4690 additions and 4 deletions

4665
src/inter-bold.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -5,19 +5,33 @@
#include <stdint.h> #include <stdint.h>
#include "inter.h" #include "inter.h"
#include "inter-bold.h"
extern bool should_exit; extern bool should_exit;
extern bool show_demo_window; extern bool show_demo_window;
//standard year //standard year
int year = 2025; static int year = 2025;
static int current_year = 2025;
static int current_month = 1;
static int current_day = 1;
//fonts
static ImFont *inter_regular;
static ImFont *inter_bold;
int get_current_year(){ int get_current_year(){
time_t t = time(NULL); time_t t = time(NULL);
struct tm tm = *localtime(&t); struct tm tm = *localtime(&t);
current_year = tm.tm_year + 1900;
current_month = tm.tm_mon + 1;
current_day = tm.tm_mday;
// tm_year is years since 1900 // tm_year is years since 1900
return year = tm.tm_year + 1900; return year = current_year;
} }
bool is_leap_year(int year) { bool is_leap_year(int year) {
@ -50,7 +64,8 @@ int days_per_month(int year, int month){
void init(){ void init(){
ImGuiIO &io = ImGui::GetIO(); ImGuiIO &io = ImGui::GetIO();
io.Fonts->AddFontFromMemoryCompressedTTF(inter_compressed_data, inter_compressed_size); inter_regular = io.Fonts->AddFontFromMemoryCompressedTTF(inter_compressed_data, inter_compressed_size);
inter_bold = io.Fonts->AddFontFromMemoryCompressedTTF(inter_bold_compressed_data, inter_bold_compressed_size);
year = get_current_year(); year = get_current_year();
} }
@ -360,7 +375,13 @@ void per_frame(){
ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ImU32(color)); ImGui::TableSetBgColor(ImGuiTableBgTarget_CellBg, ImU32(color));
} }
if(current_year == year && current_month == month && current_day == day ) {
ImGui::PushFont(inter_bold);
ImGui::TextAligned(0.5, -FLT_MIN, "%d", day); ImGui::TextAligned(0.5, -FLT_MIN, "%d", day);
ImGui::PopFont();
} else {
ImGui::TextAligned(0.5, -FLT_MIN, "%d", day);
}
if(ImGui::IsItemHovered()){ if(ImGui::IsItemHovered()){
if(selected_category != -1) { if(selected_category != -1) {

BIN
tools/Inter-Bold.ttf Normal file

Binary file not shown.

Binary file not shown.