diff --git a/kratom b/kratom index 390f355..c291bb5 100755 Binary files a/kratom and b/kratom differ diff --git a/kratom.db b/kratom.db index 18ed1aa..ba9d2c6 100644 Binary files a/kratom.db and b/kratom.db differ diff --git a/kratom.pb b/kratom.pb index bdf62fb..d28ea06 100644 --- a/kratom.pb +++ b/kratom.pb @@ -4,8 +4,24 @@ UseSQLiteDatabase() XIncludeFile "kratomfrm1.pbf" +XIncludeFile "splash.pbf" Declare updatelist() ; declare forward procedure +; A little positioning work + +desktop = ExamineDesktops() +screenWidth = DesktopWidth(0) +screenHeight = DesktopHeight(0) + +; Define the window dimensions +windowWidth = 1140 +windowHeight = 630 + +; Calculate the center position +xPos = (screenWidth - windowWidth) / 2 +yPos = (screenHeight - windowHeight) / 2 + +Opensplash();xPos,yPos) ; init code @@ -21,7 +37,7 @@ Openkrt1() Procedure btn0click (EventType) ;MessageRequester("INFO", "ADD CLICKED") - DatabaseUpdate(0,"INSERT into kratom (name, type) Values ('"+Trim(GetGadgetText(String_0))+"', '"+Trim(GetGadgetText(String_1))+"' );") + DatabaseUpdate(0,"INSERT into kratom (name, type, weight) Values ('"+Trim(GetGadgetText(String_0))+"', '"+Trim(GetGadgetText(String_1))+"','"+GetGadgetText(String_2)+"');") updatelist() EndProcedure @@ -55,8 +71,8 @@ Procedure dellist(EventType) EndProcedure Procedure burn(EventType) - - If DatabaseQuery(0, "SELECT * FROM kratom ORDER BY RANDOM() LIMIT 1") + ; TODO ADD BLACK MAGIC + If DatabaseQuery(0, "SELECT * FROM kratom ORDER BY RANDOM() * weight DESC LIMIT 1") While NextDatabaseRow(0) ; Loop for each records ;AddGadgetItem (ListView_0, -1, "Name " + GetDatabaseString(0,1) + " Type " + GetDatabaseString(0,2)) MessageRequester("Burn you should","Today you get to burn "+GetDatabaseString(0,1)) @@ -71,7 +87,8 @@ EndProcedure updatelist() ;AddGadgetItem (ListView_0, -1, "Item " + Str(a) + " of the Listview") - +Delay(2500) +HideWindow(splash,#True) HideWindow(krt1,#False) ;AddGadgetItem (0, -1, "Item " + Str(a) + " of the Listview") @@ -89,9 +106,8 @@ Repeat EndSelect Until Event = #PB_Event_CloseWindow ; Quit on any window close -; IDE Options = PureBasic 6.12 LTS (Windows - x64) -; CursorPosition = 61 -; FirstLine = 36 +; IDE Options = PureBasic 6.12 LTS (Linux - x64) +; CursorPosition = 23 ; Folding = - ; EnableXP ; DPIAware diff --git a/kratom.png b/kratom.png new file mode 100644 index 0000000..e963633 Binary files /dev/null and b/kratom.png differ diff --git a/kratom.xcf b/kratom.xcf new file mode 100644 index 0000000..85f7c45 Binary files /dev/null and b/kratom.xcf differ diff --git a/kratomfrm1.pbf b/kratomfrm1.pbf index 77e5c1c..1b464c3 100644 --- a/kratomfrm1.pbf +++ b/kratomfrm1.pbf @@ -9,25 +9,27 @@ Global krt1 -Global Container_0, ListView_0, Text_0, Text_1, String_0, Button_0, Button_1, Button_2, String_1, Text_2 +Global Container_0, ListView_0, Text_0, Text_1, String_0, Button_0, Button_1, Button_2, String_1, Text_2, Text_3, String_2 Declare burn(EventType) Declare dellist(EventType) Declare btn0click(EventType) Procedure Openkrt1(x = 0, y = 0, width = 920, height = 600) - krt1 = OpenWindow(#PB_Any, x, y, width, height, "Kratom Picker GUI", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget) + krt1 = OpenWindow(#PB_Any, x, y, width, height, "Kratom Picker GUI", #PB_Window_SystemMenu | #PB_Window_Invisible) HideWindow(krt1, 1) Container_0 = ContainerGadget(#PB_Any, 10, 10, 900, 580) - ListView_0 = ListViewGadget(#PB_Any, 0, 60, 300, 470) - Text_0 = TextGadget(#PB_Any, 70, 20, 130, 30, "Kratom Stock") - Text_1 = TextGadget(#PB_Any, 310, 20, 170, 30, "Kratom to add") - String_0 = StringGadget(#PB_Any, 460, 10, 150, 40, "") - Button_0 = ButtonGadget(#PB_Any, 680, 60, 130, 40, "Add") - Button_1 = ButtonGadget(#PB_Any, 310, 60, 130, 40, "Burn!") - Button_2 = ButtonGadget(#PB_Any, 310, 490, 130, 40, "Delete") - String_1 = StringGadget(#PB_Any, 680, 10, 150, 40, "") - Text_2 = TextGadget(#PB_Any, 620, 20, 50, 30, "Type") + ListView_0 = ListViewGadget(#PB_Any, 0, 60, 410, 470) + Text_0 = TextGadget(#PB_Any, 70, 20, 130, 30, "Kratom Stock", #PB_Text_Center) + Text_1 = TextGadget(#PB_Any, 500, 70, 170, 30, "Kratom Name", #PB_Text_Center) + String_0 = StringGadget(#PB_Any, 700, 60, 150, 40, "") + Button_0 = ButtonGadget(#PB_Any, 710, 230, 130, 40, "Add") + Button_1 = ButtonGadget(#PB_Any, 710, 430, 130, 40, "Burn!") + Button_2 = ButtonGadget(#PB_Any, 710, 490, 130, 40, "Delete") + String_1 = StringGadget(#PB_Any, 700, 110, 150, 40, "") + Text_2 = TextGadget(#PB_Any, 590, 120, 50, 30, "Type", #PB_Text_Center) + Text_3 = TextGadget(#PB_Any, 490, 170, 200, 30, "Chance Multiplier") + String_2 = StringGadget(#PB_Any, 700, 160, 150, 40, "1") CloseGadgetList() EndProcedure diff --git a/kratomprj.pbp b/kratomprj.pbp index d19a226..864ef65 100644 --- a/kratomprj.pbp +++ b/kratomprj.pbp @@ -5,18 +5,22 @@
- + - +
- - + + - - + + + + + +
diff --git a/splash.pbf b/splash.pbf new file mode 100644 index 0000000..fff123c --- /dev/null +++ b/splash.pbf @@ -0,0 +1,46 @@ +; Form Designer for PureBasic - 6.12 +; Warning: this file uses a strict syntax, if you edit it, make sure to respect the Form Designer limitation or it won't be opened again. + +; +; This code is automatically generated by the Form Designer. +; Manual modification is possible to adjust existing commands, but anything else will be dropped when the code is compiled. +; Event procedures need to be put in another source file. +; + +Global splash + +Global Image_0 + +Global Img_splash_0 + +UsePNGImageDecoder() + +Img_splash_0 = CatchImage(#PB_Any,?Img_splash_0) + + +Procedure Opensplash(x = 0, y = 0, width = 1020, height = 630) + splash = OpenWindow(#PB_Any, x, y, width, height, "", #PB_Window_BorderLess | #PB_Window_ScreenCentered) + Image_0 = ImageGadget(#PB_Any, 0, -264, 1030, 894, ImageID(Img_splash_0)) +EndProcedure + +Procedure splash_Events(event) + Select event + Case #PB_Event_CloseWindow + ProcedureReturn #False + + Case #PB_Event_Menu + Select EventMenu() + EndSelect + + Case #PB_Event_Gadget + Select EventGadget() + EndSelect + EndSelect + ProcedureReturn #True +EndProcedure + + + +DataSection + Img_splash_0: : IncludeBinary "/home/kake26/projects/purebasic/kratom/kratom.png" +EndDataSection diff --git a/win32kratom.exe b/win32kratom.exe index 0bf0aaa..7feeecb 100755 Binary files a/win32kratom.exe and b/win32kratom.exe differ