Skip to content

Commit

Permalink
v0.82.0 | 2024/06/07 16:25 | Removed magic numbers and added enums fo…
Browse files Browse the repository at this point in the history
…r Colors, GameModes, FontSizes, and a few other things. Partially implemeneted the cursor graphic in the Windows version, and did other bug fixes, optimizations and improvements to other parts of the code. I still need to figure out how correctly configure the calculator to run in 240x320 Column Major mode.
  • Loading branch information
ZERICO2005 committed Jun 7, 2024
1 parent e87b767 commit f0d994f
Show file tree
Hide file tree
Showing 17 changed files with 1,246 additions and 675 deletions.
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ set(CMAKE_CXX_STANDARD 17)

# Packages
find_package(SDL2 REQUIRED)
# find_package(glfw3 3.0 REQUIRED)
# find_package(OpenGL REQUIRED)

file(GLOB SRC_FILES "${SRC_DIR}/*.c" "${SRC_LCD_DIR}/*.c")
# file(GLOB IMGUI_FILES "${IMGUI_DIR}/*.c" "${IMGUI_DIR}/*.cpp")
Expand All @@ -34,5 +36,7 @@ add_executable(${PROJECT_NAME} ${SRC_FILES} ${IMGUI_FILES})
target_include_directories(${PROJECT_NAME} PUBLIC ${SRC_LCD_DIR} ${IMGUI_DIR})
# Compiler Flags Debug(-g -O0) Release(-O3)
set(OPT_FLAG -g -O3)
target_compile_options(${PROJECT_NAME} PUBLIC ${OPT_FLAG} -Wall -Wextra -Wno-unused-parameter -Wno-unused-variable)
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2 SDL2main)
target_compile_options(${PROJECT_NAME} PUBLIC ${OPT_FLAG} -Wall -Wextra -Wshadow)

# target_link_libraries(${PROJECT_NAME} PUBLIC -l:libglfw3.a -lgdi32 OpenGL::GL -lglew32 SDL2 SDL2main)
target_link_libraries(${PROJECT_NAME} PUBLIC SDL2 SDL2main)
6 changes: 3 additions & 3 deletions src-lcd/x86_Common_Def.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
fp64 getDecimalTime() {
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) == 0) {
uint64_t nanoTime = tp.tv_sec * 1000000000 + tp.tv_nsec;
nano64_t nanoTime = tp.tv_sec * 1000000000 + tp.tv_nsec;
return (fp64)nanoTime / 1.0e9;
} else {
perror("clock_gettime");
return 0.0;
}
}

int64_t getNanoTime() {
nano64_t getNanoTime() {
struct timespec tp;
if (clock_gettime(CLOCK_REALTIME, &tp) == 0) {
int64_t nanoTime = tp.tv_sec * 1000000000 + tp.tv_nsec;
nano64_t nanoTime = tp.tv_sec * 1000000000 + tp.tv_nsec;
return nanoTime;
} else {
perror("clock_gettime");
Expand Down
12 changes: 11 additions & 1 deletion src-lcd/x86_Common_Def.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ typedef unsigned _BitInt(24) uint24_t;
typedef float fp32;
typedef double fp64;

typedef int64_t nano64_t;

/* Constants */

#define PI 3.1415926535897932384626433832795
Expand Down Expand Up @@ -61,7 +63,15 @@ typedef double fp64;

/* Time */

int64_t getNanoTime();
nano64_t getNanoTime();

#define NANO_TO_SECONDS(t) ((fp64)(t) / 1.0e9)
#define NANO_TO_FRAMERATE(t) (1.0e9 / (fp64)(t))
#define SECONDS_TO_NANO(s) ((nano64_t)((s) * 1.0e9))
#define SECONDS_TO_FRAMERATE(s) (1.0 / (s))
#define FRAMERATE_TO_NANO(f) ((nano64_t)(1.0e9 / (f)))
#define FRAMERATE_TO_SECONDS(f) (1.0 / (f))

fp64 getDecimalTime();

#endif /* X86_COMMON_DEF_H */
Loading

0 comments on commit f0d994f

Please sign in to comment.