aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/comfy.odin17
-rw-r--r--src/main.odin15
2 files changed, 30 insertions, 2 deletions
diff --git a/src/comfy.odin b/src/comfy.odin
new file mode 100644
index 0000000..e7ef23c
--- /dev/null
+++ b/src/comfy.odin
@@ -0,0 +1,17 @@
+package main
+
+import "core:strings"
+import "core:strconv"
+
+f64_to_cstring :: proc(f: f64) -> cstring {
+ buf: [20]byte
+ result := strconv.ftoa(buf[:], f, 'f', 2, 64)
+
+ if f > 0 {
+ result = string(buf[1:])
+ }
+
+ output : cstring = strings.clone_to_cstring(string(result))
+
+ return output
+} \ No newline at end of file
diff --git a/src/main.odin b/src/main.odin
index 7884f28..8199e65 100644
--- a/src/main.odin
+++ b/src/main.odin
@@ -13,8 +13,10 @@ main :: proc() {
// for cache reasons, and to simplify the process of
// adding new Workdays to the array.
+ dayrate : f64 = 3500
workdays : [dynamic]Workday
//resize(&workdays, 3)
+ the_big_sum : f64 = 0
{ // No need to keep this array in memory forever
c, _ := importICS("res/test.ics")
@@ -25,9 +27,13 @@ main :: proc() {
thing.start,
thing.end,
thing.end))
+ for each_block in workdays[i].blocks {
+ the_big_sum += f64(each_block.value) * (dayrate/7.5) * f64(hourcount(each_block))
+ }
}
}
+
//if true do return
/*workday0: = new_workday({10, 22, 3, 5, 2023},
@@ -64,8 +70,13 @@ main :: proc() {
defer delete(date_text)
wrap_text[len(wrap_text)-1] = 0
- total_sum: cstring = "3500 NOK + 26%"
- inc_soc: cstring = "4276 NOK"
+
+ total_sum: cstring = f64_to_cstring(the_big_sum)
+ defer delete(total_sum)
+
+ inc_soc: cstring = f64_to_cstring(the_big_sum*1.26)
+ defer delete(inc_soc)
+
text_height: f32