save point

This commit is contained in:
kake26 2024-09-20 13:13:39 -05:00
parent 7f1e46a368
commit 9792d5092b
Signed by: kake26
GPG key ID: E8AFC43591876B4D
9 changed files with 92 additions and 24 deletions

BIN
kratom

Binary file not shown.

BIN
kratom.db

Binary file not shown.

View file

@ -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

BIN
kratom.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

BIN
kratom.xcf Normal file

Binary file not shown.

View file

@ -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

View file

@ -5,18 +5,22 @@
<options closefiles="1" openmode="0" name="Kratom Picker"/>
</section>
<section name="data">
<explorer view="/opt/purebasic/examples/" pattern="0"/>
<explorer view="opt/purebasic/examples/" pattern="0"/>
<log show="1"/>
<lastopen date="2024-09-18 12:49" user="kake26" host="kake26-20l6s42e00"/>
<lastopen date="2024-09-19 22:30" user="kake26" host="kake26-20l6s42e00"/>
</section>
<section name="files">
<file name="kratom.pb">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="1" panelstate="+"/>
<fingerprint md5="9f5e99e1ff488b0b29b5605576464d24"/>
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="+"/>
<fingerprint md5="e1e75b4483da6ceabf322cd25597f501"/>
</file>
<file name="kratomfrm1.pbf">
<config load="0" scan="1" panel="1" warn="1" lastopen="1" sortindex="2" panelstate="+"/>
<fingerprint md5="950999f7a68dfc50b2dffbd1dc130788"/>
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="+"/>
<fingerprint md5="31d9af98eae5516222cbb39a1fa88bbd"/>
</file>
<file name="splash.pbf">
<config load="0" scan="1" panel="1" warn="1" lastopen="0" sortindex="999" panelstate="+"/>
<fingerprint md5="0813b9d39735fd2a3e9a74e20dd54f61"/>
</file>
</section>
<section name="targets">

46
splash.pbf Normal file
View file

@ -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

Binary file not shown.