PureTris !
- Mindphazer
- Enthusiast
- Posts: 456
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: PureTris !
Small update : translations are now (hopefully) complete
@AJZIO : i have not had time (yet) to look at your code, but I will
@AJZIO : i have not had time (yet) to look at your code, but I will
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: PureTris !
Specify an icon in the compiler settings (Windows), then it will also be displayed in Explorer as a file icon.
Delete this line
For Linux
Delete this line
Code: Select all
SendMessage_(WindowID(#MainWindow), #WM_SETICON, 0, ImageID(PureTrisIco))
Code: Select all
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
UseGIFImageDecoder()
DataSection
IconTitle:
IncludeBinary "icon.gif"
IconTitleend:
EndDataSection
CatchImage(0, ?IconTitle)
CompilerEndIf
hGUI = OpenWindow(#Window, 0, 0, 111, 111, "example", #PB_Window_SystemMenu)
If hGUI
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
gtk_window_set_icon_(hGUI, ImageID(0)) ; assign an icon to the title
CompilerEndIf
Re: PureTris !
And it is better that the texts are not inside the program, but outside
At you too the map duplicates lines. It's better to use pointers.
Code: Select all
Global PathLang$
; Specifies the language of the OS
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
Global UserIntLang, *Lang
If OpenLibrary(0, "kernel32.dll")
*Lang = GetFunction(0, "GetUserDefaultUILanguage")
If *Lang
UserIntLang = CallFunctionFast(*Lang)
EndIf
CloseLibrary(0)
EndIf
CompilerCase #PB_OS_Linux
Global UserIntLang$
If ExamineEnvironmentVariables()
While NextEnvironmentVariable()
If Left(EnvironmentVariableName(), 4) = "LANG"
; LANG=ru_RU.UTF-8
; LANGUAGE=ru
UserIntLang$ = Left(EnvironmentVariableValue(), 2)
Break
EndIf
Wend
EndIf
CompilerEndSelect
; Debug UserIntLang$
#CountStrLang = 2 ; number of translation lines and corresponding array
Global Dim Lng.s(#CountStrLang)
; Interface strings even if the language file is not found (default)
Lng(1) = "Example"
Lng(2) = "Program"
; you can add 2 languages, your own and English, so as not to depend on external files.
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
If UserIntLang = 1049
CompilerCase #PB_OS_Linux
If UserIntLang$ = "ru"
CompilerEndSelect
Lng(1) = "Пример"
Lng(2) = "Программа"
EndIf
; defines the paths to the language file. In this example, one file is used as the current GUI language
CompilerSelect #PB_Compiler_OS
CompilerCase #PB_OS_Windows
; the file name is the same As the program name "MyProg_Lang.txt" (if compiled as MyProg.exe)
; PathLang$ = GetPathPart(ProgramFilename()) + GetFilePart(ProgramFilename(), #PB_FileSystem_NoExtension) + "_Lang.txt"
; file name by language number, for example 1049.txt, then you can have several languages included with the program
PathLang$ = GetPathPart(ProgramFilename()) + Str(UserIntLang) + ".txt"
CompilerCase #PB_OS_Linux
PathLang$ ="/usr/share/locale/" + UserIntLang$ + "/LC_MESSAGES/" + GetFilePart(ProgramFilename(), #PB_FileSystem_NoExtension) + ".txt"
CompilerEndSelect
; Debug PathLang$
; If the language file exists, use it. Each line contains one of the translations
If FileSize(PathLang$) > 100
If ReadFile(0, PathLang$)
i=0
While Eof(0) = 0 ; The loop is executed until the end of the file is reached. (Eof = 'End of file')
tmp$ = ReadString(0)
; If Left(tmp$, 1) = ";" ; skip commented lines
; Continue
; EndIf
tmp$ = ReplaceString(tmp$ , #CR$ , "") ; correction if in Windows
If Asc(tmp$) And Left(tmp$, 1) <> ";" ; skip commented lines
i+1
If i > #CountStrLang ; the Lng() array is already set, but if there are more lines than necessary, then we do not allow the excess
Break
EndIf
Lng(i) = tmp$
Else
Continue
EndIf
Wend
CloseFile(0)
EndIf
; Else
; SaveFile_Buff(PathLang$, ?LangFile, ?LangFileend - ?LangFile) ; create an example language file
EndIf
; End => Language detection
If OpenWindow(0, 0, 0, 220, 100, Lng(2), #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ButtonGadget (1, 10, 60, 200, 30, Lng(1))
Repeat
Select WaitWindowEvent()
Case #PB_Event_Gadget
Select EventGadget()
Case 1
CloseWindow(0)
End
EndSelect
Case #PB_Event_CloseWindow
CloseWindow(0)
End
EndSelect
ForEver
EndIf
- Mindphazer
- Enthusiast
- Posts: 456
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: PureTris !
Mhmmm... pointers are (very) far from being my best friends

MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
- Mindphazer
- Enthusiast
- Posts: 456
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: PureTris !
@AZJIO : i have modified the source according to some of your suggestions. Can you confirm that Russian language is selected ? (and, by the way, can you complete the russian translation ?)
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: PureTris !
Look at the option with an external file
https://www.upload.ee/files/15490956/PureTris1.7z.html
https://disk.yandex.ru/d/4R5gOYiwNCVCrQ
https://www.upload.ee/files/15490956/PureTris1.7z.html
https://disk.yandex.ru/d/4R5gOYiwNCVCrQ
- Mindphazer
- Enthusiast
- Posts: 456
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: PureTris !
Thanks AZJIO
I'll have a look
I'll have a look
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: PureTris !
Hi, where to download "Tetris.pbf". Thanks
Re: PureTris !
Link is in the first post.
Spec: Linux Mint 20.3 Cinnamon, i7-3770K, 16GB RAM, RTX 2070 Super
Re: PureTris !
Hi, where to download "Tetris.pbf".
I downloaded it from the first post but the Tetris.pbf file is missing.
Thanks
I downloaded it from the first post but the Tetris.pbf file is missing.
Thanks
Re: PureTris !
What makes you think you need a Tetris.pbf-file? Have you even once tried to compile it?ppaolo80 wrote: Wed Aug 23, 2023 10:09 am Hi, where to download "Tetris.pbf".
I downloaded it from the first post but the Tetris.pbf file is missing.
Thanks
Good morning, that's a nice tnetennba!
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
PureBasic 6.21/Windows 11 x64/Ryzen 7900X/32GB RAM/3TB SSD
Synology DS1821+/DX517, 130.9TB+50.8TB+2TB SSD
Re: PureTris !
Sorry you're right compiling the file is complete, I continued to compile an old version where it asked for the Tetris.pbf file. Anyway thanks.
- Mindphazer
- Enthusiast
- Posts: 456
- Joined: Mon Sep 10, 2012 10:41 am
- Location: Savoie
Re: PureTris !
Indeed, as i've stated here (viewtopic.php?p=603512#p603512), there is no .pbf file anymore
MacBook Pro 16" M4 Pro - 24 Gb - MacOS 15.4.1 - Iphone 15 Pro Max - iPad at home
...and unfortunately... Windows at work...
...and unfortunately... Windows at work...
Re: PureTris !
Good job, thank you.