├── BCDASM_ADD ├── BCDASM_ADD.pb └── LICENCE ├── BitmapFont ├── BitmapFont.pb ├── LICENCE └── README.md ├── Blender-Metaballs ├── Blender-Metaballs.pb └── LICENCE ├── DCT ├── Binary_DCT.pb ├── LICENCE ├── directional_dct.pb └── directional_dct2.pb ├── DX9 Subsystem ├── Help │ ├── Advantages.html │ ├── DX9Subsystem.chm │ ├── DX9Subsystem.hhp │ ├── DX9Subsystem.htm │ ├── Differences.html │ ├── Index.hhk │ ├── Index.html │ ├── Loading.html │ ├── Optimize.html │ ├── Supported.html │ └── Table of Contents.hhc ├── LICENCE ├── README.md └── Source │ ├── ColorKey.cps │ ├── ColorKey_PS │ ├── COLOR_KEY_TEST_CREATE.pb │ ├── COLOR_KEY_TEST_PLAY.pb │ ├── ColorKey.fx │ ├── ColorKey.ps │ ├── TEST.bmp │ └── Test.x │ ├── DInput8.pbi │ ├── DX9S_D3D9HelperFunctions.pbi │ ├── DX9S_DIJ8.pbi │ ├── DX9S_DIK8.pbi │ ├── DX9S_DIM8.pbi │ ├── DX9S_DS8.pbi │ ├── DX9S_Dummys.pbi │ ├── DX9S_ImageLoader.pbi │ ├── DX9S_ObjectManager.pbi │ ├── DX9S_TextureManager.pbi │ ├── DX9SubsystemDLL43.pb │ ├── DX9SubsystemDLL44.pb │ └── d3d9_inc.pbi ├── DirectDraw_1_0 ├── DirectDraw_1_0.pb └── LICENCE ├── DrawArray ├── DrawArray.pb └── LICENCE ├── FileSorter ├── FileSorter.exe ├── FileSorter11.pb ├── LICENCE ├── README.md └── icon.ico ├── HTMLViewer ├── HTML.config ├── HTML.exe ├── LICENCE ├── icon.ico ├── source │ └── HTML.pb └── testData │ ├── TextMsg.exe │ ├── css │ └── styling.css │ ├── img │ └── screenshot.png │ ├── index.html │ └── test.vbs ├── IconMod ├── LICENCE ├── README.md ├── bin │ └── IconMod.exe ├── logo.png ├── src │ ├── IconMod.pb │ ├── ResMod-v37.pbi │ └── source.zip └── test │ ├── IconMod.exe │ ├── sample.ico │ ├── test.bat │ ├── test32bit.exe │ └── test64bit.exe ├── Image denoising ├── Image_denoising_soft.exe ├── Image_denoising_soft.pb ├── Image_denoising_strong.exe ├── Image_denoising_strong.pb └── LICENCE ├── Image sharpening ├── Image_sharpening.exe ├── Image_sharpening.pb └── LICENCE ├── ImageChecksum ├── ImageChecksum.pb ├── LICENCE └── README.md ├── Interpreter ├── Interpreter.pb ├── interpreter_v2.pb └── test_regex.pb ├── Interpreter_test.pb ├── MD5Checker ├── LICENCE ├── MD5Checker.exe ├── MD5Checker.pb └── README.md ├── Media-Combiner ├── LICENCE ├── Media-Combiner.exe └── Media-Combiner.pb ├── Overlay ├── LICENCE └── overlay.pb ├── PBTicTacToe ├── LICENCE ├── Logo.bmp ├── LogoMask.bmp ├── O.bmp ├── OMask.bmp ├── PBTicTacToe.exe ├── TTT4.pb ├── X.bmp └── XMask.bmp ├── PasswordGen ├── LICENCE └── PasswordGen.pb ├── Promillerechner ├── LICENCE ├── Promillerechner.exe └── Promillerechner.pb ├── QRandom ├── LICENCE ├── QRAndom_AES.pb └── QRandom.pb ├── QuadBlt ├── LICENCE └── QuadBlt.pb ├── RecursiveCopy ├── CheckForPossibleCopyFail.pb ├── LICENCE ├── RecursiveCopy.exe └── RecursiveCopy5.pb ├── RegSvr32User ├── LICENCE ├── README.md ├── bin │ ├── RegSvr32User.exe │ └── test.bat └── src │ ├── Icon-Database.ico │ ├── RegSvr32Admin.exe │ ├── RegSvr32User-Source.zip │ └── RegSvr32User.pb ├── S3DMultiTexturing_PB4 └── S3DMultiTexturing │ ├── 1.bmp │ ├── 2.bmp │ ├── Fast3DSprites │ ├── Sprite3DFast.exe │ ├── Sprite3DFast.pb │ └── Sprite3DFast_inc.pbi │ ├── Sprite3D │ ├── 1.bmp │ ├── 2.bmp │ ├── ClipSprite3D.PB │ ├── Collision.pb │ ├── Cullmode.pb │ ├── S3DEx.pb │ ├── Sprite3D_Drawing2D.pb │ ├── TEST.bmp │ ├── multi3.pb │ └── tree.bmp │ ├── TEST.bmp │ ├── multi4.pb │ ├── multi4_Both.pb │ └── multi4_Faster.pb ├── SVGRender ├── LICENCE ├── SVGRender_Linux.pb └── SVGRender_Windows.pb ├── SlowCPUSimulator ├── LICENCE └── SlowCPUSimulator.pb ├── UADD └── UADD.pb ├── WinAPI_Jobs ├── LICENCE └── WinAPI_Jobs.pbi ├── WineSec ├── LICENCE ├── README.md ├── wine_sec └── wine_sec.pb ├── colorize_image ├── LICENCE └── colorize_image.pb ├── flying pigs ├── 1.ico ├── GAME.exe ├── Game3.pb ├── LICENCE └── daten │ ├── 1.bmp │ ├── 1.wav │ ├── 10.bmp │ ├── 11.bmp │ ├── 12.bmp │ ├── 13.bmp │ ├── 14.bmp │ ├── 15.bmp │ ├── 16.bmp │ ├── 17.bmp │ ├── 18.bmp │ ├── 2.bmp │ ├── 3.bmp │ ├── 4.bmp │ ├── 5.bmp │ ├── 6.bmp │ ├── 7.bmp │ ├── 8.bmp │ └── 9.bmp ├── nAgent ├── LICENCE └── nAgent.pbi └── nCPU ├── LICENCE └── nCPU.pbi /BCDASM_ADD/BCDASM_ADD.pb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | PrototypeC.l AddBCD(dst,src1,src2) 5 | 6 | s1=AllocateMemory(100) 7 | s2=AllocateMemory(100) 8 | d=AllocateMemory(100) 9 | 10 | AddBCD.AddBCD = ?AddBCDString 11 | 12 | PokeS(s1,"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000123",-1, #PB_Ascii) 13 | PokeS(s2,"0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000339",-1, #PB_Ascii) 14 | AddBCD(d,s1,s2) 15 | Debug PeekS(d,-1, #PB_Ascii) 16 | 17 | End 18 | 19 | AddBCDString: 20 | !StringErgebnis EQU [EBP+8] 21 | !StringA EQU [EBP+12] 22 | !StringB EQU [EBP+16] 23 | !ENTER 0,0 24 | 25 | !MOV ESI, StringA 26 | !MOV EBX, StringB 27 | !MOV EDI, StringErgebnis 28 | 29 | !ADD ESI,99 30 | !ADD EBX,99 31 | !ADD EDI,99 32 | 33 | !XOR EAX,EAX 34 | !XOR EDX,EDX 35 | 36 | !MOV ECX, 100 37 | ;!MOV DH, '0' ; wird nicht benötigt 38 | !Numbers: 39 | !SUB AH, AH 40 | !MOV AL, [ESI] ; Zeichen von StringA 41 | !MOV DL, [EBX] ; Zeichen von StringB 42 | 43 | !ADD AL, DH ; vorheriger Übertrag addieren (am Anfang 0) 44 | !AAA 45 | !OR AX, 3030H 46 | 47 | !MOV DH, AH ; Übertrag sichern 48 | !XOR AH, AH 49 | 50 | !ADD AL, DL 51 | !AAA 52 | !OR AX, 3030H 53 | 54 | !MOV byte[EDI], AL ; Zeichen im Ergebnisstring speichern 55 | 56 | !MOV AL, AH ; Beide Überträge zusammenaddieren 57 | !XOR AH, AH 58 | !ADD AL, DH 59 | !AAA 60 | !OR AL, 30H 61 | !MOV DH, AL 62 | 63 | !DEC ESI 64 | !DEC EBX 65 | !DEC EDI 66 | !Loop Numbers 67 | 68 | !LEAVE 69 | !RET 70 | -------------------------------------------------------------------------------- /BCDASM_ADD/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /BitmapFont/BitmapFont.pb: -------------------------------------------------------------------------------- 1 | ;========================================= 2 | ;Bitmap Font Sample version 1 (2013-03-05) 3 | ;========================================= 4 | ;Licence: Public domian 5 | 6 | #BITMAPFONT_WIDTH = 9 7 | #BITMAPFONT_HEIGHT = 13 8 | 9 | Global Dim _g_bitmapfont_images(255) 10 | Global _g_bitmapfont_color, _g_bitmapfont_bkcolor 11 | 12 | Procedure __BitmapFontFilterCB(x, y, src, dst) 13 | ;Colors are eigher $FFFFFFFF or $00000000 in our Bitmap, so the result of "src & _g_bitmapfont_color" is either _g_bitmapfont_color or $00000000 14 | ProcedureReturn AlphaBlend(src & _g_bitmapfont_color, AlphaBlend(_g_bitmapfont_bkcolor, dst)) 15 | EndProcedure 16 | 17 | ;Frees all resources reserved by LoadBitmapFont() 18 | Procedure FreeBitmapFont() 19 | For i = 0 To 255 20 | If IsImage(_g_bitmapfont_images(i)) 21 | FreeImage(_g_bitmapfont_images(i)) 22 | _g_bitmapfont_images(i) = #Null 23 | EndIf 24 | Next 25 | EndProcedure 26 | 27 | ;Loads the image for 256 chars out of a big image containing all chars 28 | Procedure LoadBitmapFont() 29 | Protected image, ch, result = #True 30 | UsePNGImageDecoder() 31 | image = CatchImage(#PB_Any, ?Bitmap_Font) 32 | If IsImage(image) 33 | For ch = 0 To 255 34 | ;Grab the images from a 16x16 grid 35 | _g_bitmapfont_images(ch) = GrabImage(image, #PB_Any, (ch & 15) * #BITMAPFONT_WIDTH, (ch >> 4) * #BITMAPFONT_HEIGHT, #BITMAPFONT_WIDTH, #BITMAPFONT_HEIGHT) 36 | If Not IsImage(_g_bitmapfont_images(ch)) 37 | result = #False 38 | EndIf 39 | Next 40 | FreeImage(image) 41 | Else 42 | result = #False 43 | EndIf 44 | 45 | If result = #False 46 | ; Free all resources if something failed 47 | FreeBitmapFont() 48 | EndIf 49 | ProcedureReturn result 50 | EndProcedure 51 | 52 | ;Draws the declared string at x,y with the declared color. 53 | ;Optionally a background color is possible. Half transparent colors are also supported 54 | Procedure DrawBitmapText(string.s, x, y, color, bkcolor = $00000000) 55 | Protected i, ch 56 | DrawingMode(#PB_2DDrawing_CustomFilter) 57 | CustomFilterCallback(@__BitmapFontFilterCB()) 58 | _g_bitmapfont_color = color 59 | _g_bitmapfont_bkcolor = bkcolor 60 | For i = 1 To Len(string) 61 | ch = Asc(Mid(string, i, 1)) 62 | If ch < 0 Or ch > 255:ch = 255:EndIf 63 | DrawImage(ImageID(_g_bitmapfont_images(ch)), x, y) 64 | x + #BITMAPFONT_WIDTH 65 | Next 66 | DrawingMode(#PB_2DDrawing_Default) 67 | EndProcedure 68 | 69 | DataSection 70 | Bitmap_Font: 71 | Data.q $A1A0A0D474E5089,$524448490D000000,$D000000090000000,$7AD0D20000000301,$544C500600000097,$A5FFFFFF00000045,$7401000000DD9FD9 72 | Data.q $66D8E64000534E52,$5441444940060000,$D71C6841D6CD5E78,$53789E4FFF00719,$25376522CE3A359E,$2DA45336F0081890,$392F494B53DD7791 73 | Data.q $164036065BCA50B5,$2986795452CB9322,$9CE024575D1ACBAB,$DF8301260A1C63D2,$38C82DF50CBA3030,$18C6531744A8B3C4,$2B46F7BEA4590992 74 | Data.q $A7FE4BEAB5B4DE59,$61BCDEFA7DEFA7E1,$4AA393A0E39A7076,$709640E0E8CC11A7,$9BE38148095DEE81,$EAE05DA3CA237C5C,$1FBBE38179864CDD 75 | Data.q $3BC0C7A65113FCFF,$3F883949E24E1FB7,$AE9EAAA9AFABDBFB,$7C1A74C3F870787A,$F804A3CA4427E9FC,$69F455DF8787ADD3,$F0F17F6F453DC818 76 | Data.q $20711BE166FBDBF0,$A14B925EF0BD43D3,$A5BD7C9077B1BFDB,$3B78FD10D5942F69,$B8F442351E81E8F9,$FDDA3851861EA3D4,$458AF07CD3CD0DD1 77 | Data.q $1388CD97700AB499,$AAB3AC18B83F2587,$41F4A31BB2D08E4,$3BAD1496B2696E98,$59090BD73F7A594,$80F450DDA26C6EE2,$AE9154F60B86B26B 78 | Data.q $CB7127FBDC6A2A4A,$A9D307FB8145EA96,$11A4E2292F1FB2AE,$210EDC0E983FF60,$D7E4C3973525D358,$328022A075BB94DE,$9E478B885A8720F9 79 | Data.q $7B29C039C61B5607,$F239E8CE0D8E129A,$73B4D1034B26BED8,$6A14B92E17DE3DB0,$25C06F84E3408AA2,$45722E648662A9B6,$E5B76AE129397B8D 80 | Data.q $E726B8AB4FB7C46,$984BD568C077BB9A,$91608AC65778985,$F411EE37F1434B90,$A7F3C510D99E9AA8,$DD56D6CB7648ED4E,$1262A59D5E1D60A9 81 | Data.q $46B0F50C0B579E88,$435040486A491521,$40AC8B5799206EDD,$A2DDC615A8745382,$6F0CBA5861457564,$8139EB99B85F0251,$64D0BF0A22AE57B9 82 | Data.q $8FF831141554B005,$A3C2EE0904D719C7,$4040AC4226AE8A8C,$31459127637A8B8,$7536962F04245F5E,$EA453EEBA72E24A2,$AFA961DF05A8DA93 83 | Data.q $7E1F518BE8ABD436,$129AA640CDF9946D,$9144457DE2967DF2,$59A446769A47A13C,$987F222F629D7948,$4E774672AA986A2A,$7DAC2D4CA7C3FE49 84 | Data.q $B14A3437B59C4294,$3EAE666086CD1B55,$D4FB6CAA3D1DB53A,$385FFFA8F44FFA1E,$AF522D56DB545ED0,$CCB7800628913376,$67819F930A189152 85 | Data.q $A381844519A39A8A,$CDDA86A22BAA6822,$1884A1CC97D3489D,$62528860611BCDE2,$8CA754D48142705,$69EFAAFFB4CF21A4,$722A5B914C1A8612 86 | Data.q $62E3225844315E09,$58002A3D0D39EFA3,$3B8BE78C758E9E01,$C3599C0B40A34C4F,$99FFA01C02435F59,$BAE6E514993B0DEA,$E75013628A89385A 87 | Data.q $A38A2AAD915DF3D4,$7EA236A340A7EFDF,$6784D3C8AC3B6869,$7535362F69A17E68,$1BB9E46CF37F7723,$B00DBBCF3CE00180,$FD7A4089E7A49CA4 88 | Data.q $91CD6CDE94E0AC0A,$3BB264EDA5C6ED39,$2E90A66EB7FD4A,$72EAD150DD4673CF,$D158ED1686E4822D,$1BA188CC84CB2B97,$B119E9165737F78E 89 | Data.q $2591757372E367EE,$D971B17996CCF6B3,$3827001CCA588DA7,$6D3C5D19D0D98AC9,$91750DDAD0E6DB38,$3992840BD2C9FCA3,$4FE3537ED73ED462 90 | Data.q $9220A006F31E2E95,$B44D0068639E8E70,$FE9ADB4B1B79CCB7,$D787BCE13C946D0A,$9439359FD600157F,$BF4D6BFCB8179C78,$1F7CE66921B545D5 91 | Data.q $55D1377DAD177F97,$D555F40AF1275D4,$C90A4A218EF592C5,$B66972655FAF157,$5551DA58EBC172E9,$7067920187523FE6,$CD15C9D45CC9F840 92 | Data.q $7D60024245C7329F,$F5006014D690DA81,$30AC705BD173296,$1CDBBE2C6C5607D2,$34052EC4D004226B,$FAC0AD0CEBD00511,$86D0B3724A3B22B0 93 | Data.q $B5C9468A5A8FBB5,$7DC6B003DAAE2BE,$7004776B93DED360,$E115F72F6E572046,$EB3378BF7BE19C94,$292C09A151409D01,$BB57E93AF67D74C4 94 | Data.q $9C6D7FE404AB25E4,$A0402E6E5616C713,$7373EA46ED6977A7,$F084C19C78838A31,$30AC4A32E34E01CD,$A40E27634EADB22F,$6E4F14763BAF58E0 95 | Data.q $FA79EA1A8B7F4265,$EA54D1CE4B79B6C7,$3C1DEC5BA4343327,$CEE839EBD52A91FE,$79AFF8E4B310D9C6,$D897003EF1456479,$FEA128D60C002143 96 | Data.q $39484994665E31B5,$99015006DDECFF40,$BC0BCC7B51DCD7A1,$EAEE5FA2A5E1A66B,$B7C32CA2AF78C621,$5ADE8FB4674A2A57,$BD0B533CDD437D45 97 | Data.q $93FB752C84865A8A,$9427FA19922A0FAA,$1FC43660C4A84FB6,$E3E0BC0A52971DF5,$5E77FD884B81AE7E,$D183EF040DDA0B98,$290045F404391B85 98 | Data.q $8924003F40F9837F,$4D3EA473BF5B69F3,$76AFAAF821146FE8,$A4C1D18FEA430990,$9AE5EF373BD71238,$3E8568EA7B0E39F4,$DD3E17E7B74D3C5A 99 | Data.q $E982E0ACB986167E,$2B300651F8C853D4,$AC8B5B03D97388C,$855D2F215AF355F,$DA4451DEF99FB409,$CFBCA4FA3A0C2FD5,$C3F4CDD96742FFA7 100 | Data.q $F747DA56F3535F09,$45FC239FDF8E8AC3,$A53B5D19D6D3CF13,$FA3BAF77B4C7674E,$C0D8EEFF9DD4C5D4,$15C4E8B637F891B3,$364C4CC1,$826042AE444E4549 101 | EndDataSection 102 | 103 | 104 | 105 | 106 | ;Example 107 | 108 | CompilerIf Not Defined(Cyan, #PB_Constant) 109 | #Cyan = 16776960 110 | CompilerEndIf 111 | 112 | LoadBitmapFont() 113 | 114 | RandomSeed(19) 115 | OpenWindow(0, 0, 0, 800, 800, "Bitmap Font Example", #PB_Window_SystemMenu|#PB_Window_ScreenCentered) 116 | CreateImage(0, 800, 800) 117 | StartDrawing(ImageOutput(0)) 118 | 119 | Box(0, 0, 400, 400, #Cyan) 120 | 121 | DrawBitmapText("Transparent Text", 5, 5, RGBA(255,0,0,255)) 122 | DrawBitmapText("With Background", 5, 25, RGBA(0,255,0,255), RGBA(255,0,255,255)) 123 | 124 | For i = 1 To 30 125 | DrawBitmapText("PureBasic is cool" + Chr(3) + Chr(3) + Chr(3), Random(800), Random(800), RGBA(Random(255), Random(255), Random(255), Random(255) ) ) 126 | Next i 127 | 128 | StopDrawing() 129 | ImageGadget(0, 0, 0, 200, 200, ImageID(0)) 130 | 131 | Repeat 132 | Event = WaitWindowEvent() 133 | Until Event = #PB_Event_CloseWindow 134 | -------------------------------------------------------------------------------- /BitmapFont/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /BitmapFont/README.md: -------------------------------------------------------------------------------- 1 | A small sample/include which shows how to draw a custom bitmap font. 2 | The advantage of using bitmap fonts to regular fonts is that it should look the same on all operating systems. 3 | -------------------------------------------------------------------------------- /Blender-Metaballs/Blender-Metaballs.pb: -------------------------------------------------------------------------------- 1 | 2 | 3 | Procedure OutputLine(line.s) 4 | Debug line.s 5 | EndProcedure 6 | 7 | 8 | Procedure MetaBlend_Init() 9 | OutputLine("import bpy") 10 | OutputLine("metaball = bpy.data.metaballs.new('test')") 11 | OutputLine("obj = bpy.data.objects.new('test', metaball)") 12 | OutputLine("bpy.context.scene.objects.link(obj)") 13 | OutputLine("metaball.resolution = 0.2") 14 | OutputLine("metaball.render_resolution = 0.02") 15 | EndProcedure 16 | 17 | Procedure MetaBlend_AddBall(x.f,y.f,z.f,sz.f,tube,neg) 18 | OutputLine("el= metaball.elements.new()") 19 | OutputLine("el.co = ("+StrF(x,3)+","+StrF(y,3)+","+StrF(z,3)+")") 20 | ; OutputLine("el.dims = ("+StrF(x,3)+","+StrF(y,3)+","+StrF(z,3)+")") 21 | OutputLine("el.radius = " +StrF(sz,3)) 22 | OutputLine("el.stiffness = 10.0") 23 | If tube 24 | OutputLine("el.type= 'CAPSULE'") 25 | EndIf 26 | If neg 27 | OutputLine("el.use_negative= True") 28 | EndIf 29 | EndProcedure 30 | 31 | 32 | Procedure MetaBlend_AddBall2(x.f,y.f,z.f,sz.f,rnd.f) 33 | z = Random(5)+1 34 | For i = 0 To z 35 | dx.f = Random(1000)/1000.0 * rnd - Random(1000)/1000.0 * rnd 36 | dy.f = Random(1000)/1000.0 * rnd - Random(1000)/1000.0 * rnd 37 | dz.f = Random(1000)/1000.0 * rnd - Random(1000)/1000.0 * rnd 38 | dsz.f = Random(1000)/1000.0 * rnd - Random(1000)/1000.0 * rnd 39 | 40 | OutputLine("el= metaball.elements.new()") 41 | OutputLine("el.co = ("+StrF(x+dx,3)+","+StrF(y+dy,3)+","+StrF(z+dz,3)+")") 42 | OutputLine("el.radius = " +StrF(sz+dsz,3)) 43 | Next 44 | EndProcedure 45 | 46 | 47 | Procedure MetaBlend_Line(sx.f,sy.f,sz.f,ex.f,ey.f,ez.f,size.f,stepsize.f,rnd.f) 48 | 49 | dx.f = ex - sx 50 | dy.f = ey - sy 51 | dz.f = ez - sz 52 | dist.f = Sqr(dx*dx + dy*dy +dz*dz) 53 | 54 | pos.f = 0 55 | Repeat 56 | rel.f = pos / dist 57 | px.f = sx + dx * rel 58 | py.f = sy + dy * rel 59 | pz.f = sz + dz * rel 60 | px.f = px + Random(1000)/1000.0 * rnd - Random(1000)/1000.0 * rnd 61 | py.f = py + Random(1000)/1000.0 * rnd - Random(1000)/1000.0 * rnd 62 | pz.f = pz + Random(1000)/1000.0 * rnd - Random(1000)/1000.0 * rnd 63 | sizetmp.f = size+ Random(1000)/1000.0 * rnd 64 | ;MetaBlend_AddBall(px,py,pz,sizetmp.f) 65 | pos + stepsize 66 | Until pos > dist 67 | EndProcedure 68 | 69 | 70 | 71 | MetaBlend_Init() 72 | ;MetaBlend_Line(0,0,0,5,5,5,0.25, 0.25,0.1) 73 | 74 | ;MetaBlend_Line(0,0,0,0,5,5,0.25, 0.25,0.1) 75 | ;MetaBlend_Line(0,0,0,5,0,5,0.25, 0.25,0.1) 76 | ;MetaBlend_Line(0,0,0,5,5,0,0.25, 0.25,0.1) 77 | 78 | MetaBlend_AddBall(0,0,0,5,#False, #False) 79 | 80 | For z =0 To 80 81 | p.f = Random(10000)/100.0 82 | p2.f = Random(10000)/100.0 83 | xf.f = Sin(p) *Cos(p2)* 5 84 | yf.f =Sin(p) *Sin(p2) * 5 85 | zf.f = -Cos(p) * 5 86 | MetaBlend_AddBall(xf,yf,zf,Random(1000)/1000.0*2.5+0.2,#False,#True) 87 | Next 88 | ;For t=0 To 40 89 | ;MetaBlend_AddBall(Random(10000)/1000.0,Random(10000)/1000.0,Random(10000)/1000.0,1) 90 | ;Next 91 | 92 | ; MetaBlend_AddBall(0,0,0,1) 93 | ; MetaBlend_AddBall(5,5,5,1) 94 | ; MetaBlend_AddBall(0,5,5,1) 95 | ; MetaBlend_AddBall(5,0,5,1) 96 | ; MetaBlend_AddBall(5,5,0,1) 97 | -------------------------------------------------------------------------------- /Blender-Metaballs/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /DCT/Binary_DCT.pb: -------------------------------------------------------------------------------- 1 | Global Dim Binary_DCT_Lookup.f($FF, 7) 2 | 3 | Procedure fillLookup() 4 | 5 | For binary_value = 0 To 255 6 | For x=0 To 7 7 | res.f = 0.0 8 | For x2 = 0 To 7 9 | If (binary_value & (1 << x2)) 10 | res + Cos(#PI * (x) * (2 * (x2) + 1.0)/ (8.0 * 2.0)) 11 | EndIf 12 | Next 13 | Binary_DCT_Lookup(binary_value, x) = res 14 | Next 15 | Next 16 | EndProcedure 17 | 18 | fillLookup() 19 | NUM = %10101010 20 | For x=0 To 7 21 | Debug Binary_DCT_Lookup(NUM, x) 22 | Next 23 | -------------------------------------------------------------------------------- /DCT/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /DCT/directional_dct.pb: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Dim dct.f(8,8,8,8) 5 | 6 | OpenWindow(1,0,0,700,700,"") 7 | 8 | CreateImage(1,9*8,9*8) 9 | 10 | StartDrawing(ImageOutput(1)) 11 | For y=0 To 7 12 | For y2 = 0 To 7 13 | 14 | 15 | For x=0 To 7 16 | For x2 = 0 To 7 17 | 18 | 19 | x_=x 20 | y_=y 21 | If x > 0 22 | If x & 1 23 | x_= (x+1)/2 24 | Else 25 | x_= 8-(x/2) 26 | EndIf 27 | EndIf 28 | If y > 0 29 | If y & 1 30 | y_= (y+1)/2 31 | Else 32 | y_= 8-(y/2) 33 | EndIf 34 | EndIf 35 | 36 | v.f= (Sin(#PI * (x_) * (2 * (x2) + 0.0)/ (8.0) + #PI * (y_) * (2.0 * (y2) + 0.0)/ (8.0)+3.0/4.0*#PI)) 37 | 38 | dct(x,x2,y,y2)=v 39 | v2=127.5*v+127.5 40 | 41 | Plot(x*9+x2,y*9+y2,RGB(v2,v2,v2)) 42 | Next 43 | Next 44 | Next 45 | Next 46 | StopDrawing() 47 | ResizeImage(1,9*8*4,9*8*4,#PB_Image_Raw) 48 | 49 | 50 | For x=0 To 7 51 | For y=0 To 7 52 | For x_ = 0 To 7 53 | For y_ = 0 To 7 54 | 55 | If x=x_ And y=y_ 56 | 57 | Else 58 | dot.f=0 59 | For y2 = 0 To 7 60 | For x2 = 0 To 7 61 | dot.f + dct(x,x2,y,y2)*dct(x_,x2,y_,y2) 62 | Next 63 | Next 64 | If Abs(dot) > 0.0001 65 | Debug "BAD:" +StrF(dot) 66 | Else 67 | Debug "OK: " +StrF(dot) 68 | EndIf 69 | 70 | EndIf 71 | Next 72 | Next 73 | Next 74 | Next 75 | Repeat 76 | StartDrawing(WindowOutput(1)) 77 | DrawImage(ImageID(1),0,0) 78 | StopDrawing() 79 | 80 | Until WaitWindowEvent()=#PB_Event_CloseWindow 81 | 82 | -------------------------------------------------------------------------------- /DCT/directional_dct2.pb: -------------------------------------------------------------------------------- 1 | 2 | #WIDTH=8 3 | #W_MAX = 7 4 | 5 | Procedure rev(x) 6 | x_=x 7 | If x > 0 8 | If x & 1 9 | x_= (x+1)/2 10 | Else 11 | x_= #WIDTH-(x/2) 12 | EndIf 13 | EndIf 14 | ProcedureReturn x_ 15 | EndProcedure 16 | 17 | 18 | Dim dct.d(#W_MAX*2,#W_MAX,#W_MAX*2,#W_MAX) 19 | 20 | OpenWindow(1,0,0,700,900,"") 21 | 22 | 23 | For y=0 To #W_MAX 24 | For y2 = 0 To #W_MAX 25 | 26 | 27 | For x=0 To #W_MAX 28 | For x2 = 0 To #W_MAX 29 | 30 | 31 | v1.f= #PI * rev(x) * (2 * (x2) + 1.0)/ (#WIDTH * 2.0) 32 | v2.f= #PI * (y) * (2 * (y2) + 1.0)/ (#WIDTH * 2.0) 33 | 34 | 35 | 36 | If y=0 37 | v.f= Cos((v1 )) 38 | Else 39 | v=Cos((v1*2 +v2 )) 40 | EndIf 41 | 42 | 43 | If x=7 And y>0 44 | 45 | If y=1 46 | xx=7 47 | yy=7 48 | EndIf 49 | If y=2 50 | xx=6 51 | yy=7 52 | EndIf 53 | If y=3 54 | xx=7 55 | yy=6 56 | EndIf 57 | If y=4 58 | xx=7 59 | yy=5 60 | EndIf 61 | If y=5 62 | xx=5 63 | yy=7 64 | EndIf 65 | If y=6 66 | xx=4 67 | yy=7 68 | EndIf 69 | If y=7 70 | xx=7 71 | yy=4 72 | EndIf 73 | 74 | v.f= (Sin(#PI*2.0/(#WIDTH) * ( rev(xx)*x2 + rev(yy)*y2) +1.0/4.0*#PI)) 75 | 76 | EndIf 77 | 78 | dct(x,x2,y,y2)=v 79 | 80 | Next 81 | Next 82 | Next 83 | Next 84 | 85 | 86 | Dim processed(#W_MAX,#W_MAX) 87 | 88 | For ya=0 To #W_MAX 89 | For xa=0 To #W_MAX 90 | 91 | processed(xa,ya)=1 92 | cnt=0 93 | For y=0 To #W_MAX 94 | For x=0 To #W_MaX 95 | 96 | 97 | If processed(x,y)=0 ;And x>0 And y>0 98 | 99 | cnt+1 100 | 101 | l1.d=0 102 | l2.d=0 103 | dot.d=0 104 | For x2=0 To #W_MAX 105 | For y2=0 To #W_MAX 106 | dot.d =dot.d + dct(x,x2,y,y2) * dct(xa,x2,ya,y2) 107 | l1.d= l1.d + Pow(dct(x,x2,y,y2),2.0) ;+ Pow(dct(x,x2,y,y2),2.0) 108 | l2.d= l2.d + Pow(dct(xa,x2,ya,y2),2.0) ;+ Pow(dct(xa,x2,ya,y2),2.0) 109 | Next 110 | Next 111 | l1=Sqr(l1) 112 | l2=Sqr(l2) 113 | 114 | 115 | 116 | len_new.d=0 117 | For x2=0 To #W_MAX 118 | For y2=0 To #W_MAX 119 | dct(x,x2,y,y2) =(dct(x,x2,y,y2)/l1 - dot/(l2*l1) * dct(xa,x2,ya,y2)/l2) 120 | len_new.d+ dct(x,x2,y,y2)*dct(x,x2,y,y2) 121 | Next 122 | Next 123 | len_new.d=Sqr(len_new.d) 124 | For x2=0 To #W_MAX 125 | For y2=0 To #W_MAX 126 | dct(x,x2,y,y2) =dct(x,x2,y,y2)/len_new.d *3 127 | Next 128 | Next 129 | 130 | 131 | 132 | 133 | EndIf 134 | Next 135 | Next 136 | 137 | Next 138 | Next 139 | 140 | 141 | 142 | CreateImage(1,(#WIDTH+1)*#WIDTH,(#WIDTH+1)*#WIDTH,32,#Blue) 143 | 144 | StartDrawing(ImageOutput(1)) 145 | For y=0 To #W_MAX 146 | For y2 = 0 To #W_MAX 147 | 148 | 149 | For x=0 To #W_MAX 150 | For x2 = 0 To #W_MAX 151 | v.f=dct(x,x2,y,y2) 152 | v2=127.5*v+127.5 153 | 154 | If v2 < 0:v=0:EndIf 155 | If v2>255:v=255:EndIf 156 | 157 | Plot(x*(#WIDTH+1)+x2,y*(#WIDTH+1)+y2,RGB(v2,v2,v2)) 158 | Next 159 | Next 160 | Next 161 | Next 162 | StopDrawing() 163 | ResizeImage(1,(#WIDTH+1)*#WIDTH*8,(#WIDTH+1)*#WIDTH*8,#PB_Image_Raw) 164 | StartDrawing(WindowOutput(1)) 165 | DrawImage(ImageID(1),0,0) 166 | StopDrawing() 167 | 168 | For x=0 To #W_MAX 169 | For y=0 To #W_MAX 170 | For x_ = 0 To #W_MAX 171 | For y_ = 0 To #W_MAX 172 | 173 | If x=x_ And y=y_ 174 | 175 | Else 176 | dot.d=0 177 | For y2 = 0 To #W_MAX 178 | For x2 = 0 To #W_MAX 179 | dot.d + dct(x,x2,y,y2)*dct(x_,x2,y_,y2) 180 | Next 181 | Next 182 | If Abs(dot) > 0.00001 183 | Debug "BAD:" +StrF(dot) + " " +Str(x)+","+Str(y) + " "+Str(x_)+","+Str(y_) 184 | Else 185 | ;Debug "OK: " +StrF(dot) 186 | EndIf 187 | 188 | EndIf 189 | Next 190 | Next 191 | Next 192 | Next 193 | Repeat 194 | StartDrawing(WindowOutput(1)) 195 | DrawImage(ImageID(1),0,0) 196 | StopDrawing() 197 | 198 | Until WaitWindowEvent()=#PB_Event_CloseWindow 199 | 200 | SaveImage(1,"/hdd/2.bmp") 201 | -------------------------------------------------------------------------------- /DX9 Subsystem/Help/Advantages.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Advantages:

12 |
    13 |
  • DisplaySprite(), DisplayTransparentSprite() works faster, if 14 | a newer gfx-card is available. 15 |

    16 |
  • DisplayTranslucentSprite(),DisplayRGBFilter(),DisplayAlphaSprite(),DisplayShadowSprite() 17 | and DisplaySolidSprite() are hardware accelerated and much faster. 18 |

    19 |
  • All sprites are backed in system memory, so sprites can be 20 | restored, if the device gets lost. 21 |

    22 |
  • SpritePixelCollision() works much faster for static sprites.

    23 |
  • 3D-Sprites are sometimes faster.

    24 |
25 |

Disadvantages:

26 |
    27 |
  • Direct3D9 and a 3d accelerator are needed.

    28 |
  • The subsystem needs much more memory. 29 |

    30 |
  • UseBuffer(),TransparentSpriteColor(),SpriteOutput() can be very 31 | slow if PS 1.4 is not available. 32 |

    33 |
  • CopySprite(),GrabSprite() are really slow. 34 |

    35 |
  • sprites are limited to the maximal texture size. (usually 36 | 2048x2048)

    37 |
38 | 39 | -------------------------------------------------------------------------------- /DX9 Subsystem/Help/DX9Subsystem.chm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Help/DX9Subsystem.chm -------------------------------------------------------------------------------- /DX9 Subsystem/Help/DX9Subsystem.hhp: -------------------------------------------------------------------------------- 1 | [OPTIONS] 2 | Compatibility=1.1 or later 3 | Compiled file=DX9Subsystem.chm 4 | Contents file=Table of Contents.hhc 5 | Default topic=Index.html 6 | Display compile progress=No 7 | Index file=Index.hhk 8 | Language=0x407 Deutsch (Deutschland) 9 | 10 | [FILES] 11 | Index.html 12 | Differences.html 13 | Optimize.html 14 | Supported.html 15 | Advantages.html 16 | Loading.html 17 | 18 | [INFOTYPES] 19 | 20 | -------------------------------------------------------------------------------- /DX9 Subsystem/Help/DX9Subsystem.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Help/DX9Subsystem.htm -------------------------------------------------------------------------------- /DX9 Subsystem/Help/Differences.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Differences 12 | between the DX7- and the DX9 render system:

13 |

There 14 | are a few differences to the DX7 render system. Some of them are 15 | there because it's not possible to do it the same way like in the DX7 16 | render system, others are different for speed or quality improvement. 17 | 18 |

19 |

OpenScreen():
The 20 | OpenScreen()-command only supports resoultions of 16Bit and 32Bit. 21 | 8Bit and 24Bit resolutions are not supported. Use the DX7 render 22 | system if you want to support them too.

23 |
24 |

OpenWindowedScreen():
The 25 | OpenWindowedScreen()-command only supports desktop resoultions of 26 | 16Bit and 32Bit. 8Bit and 24Bit resolutions are not supported. Use 27 | the DX7 render system if you want to support them too.

28 |
29 |

StartSpecialFX():
StartSpecialFX() 30 | is only available for compatibility reason. It does nothing.

31 |
32 |

StopSpecialFX():
StopSpecialFX() 33 | is only available for compatibility reason. It does nothing.

34 |
35 |

DisplayRGBFilter():
The 36 | command DisplayRGBFilter() is hardware accelerated. So it's much 37 | faster.

38 |
39 |

FlipBuffers():
FlipBuffers(2) 40 | works also in windowed mode.

41 |
42 |

DisplayTranslucentSprite():
The 43 | transparent color set with TransparentSpriteColor() is used as 44 | transparent color instead of always black.
This command is 45 | hardware accelerated. So it's much faster.

46 |
47 |

UseBuffer():
You 48 | can't display a sprite while it's used as render target.

49 | 50 | 51 | 56 | 57 |
52 |

UseBuffer(1) 53 | ; use sprite as render target
DisplaySprite(
1,x,y) 54 | ; doesn't work!

55 |
58 |

It's possible to 59 | use DisplaySprite3D() with UseBuffer(), that means you can display 60 | 3D-Sprites
on a sprite.

61 |

Try to avoid to use 62 | UseBuffer(Sprite) 63 | in the main loop whenever it's possible. It's not recommended to use 64 | this command in the main loop, because it's really slow. If you need 65 | to use UseBuffer() often, you should use the DX7 render 66 | system!
However, if there is at least PS 1.4 support, then this 67 | command works fairly fast.
68 |

69 |
70 |

TransparentSpriteColor():
Try 71 | to avoid to use TransparentSpriteColor() in the main loop.If you need 72 | to use TransparentSpriteColor() often in the main loop, you should 73 | use the DX7 render system!
However, if there is at least PS 1.4 74 | support, then this command works really fast.
75 |

76 |
77 |

GrabSprite():
GrabSprite 78 | creates only a new sprite when it's needed.(e.g. another size or 79 | another bit depth)
Try to avoid to use GrabSprite() in the main 80 | loop whenever it's possible. It's not recommended to use this command 81 | in the main loop, because it's really slow. If you need to use 82 | GrabSprite() often, you should use the DX7 render system!

83 |
84 |

CopySprite():
CopySprite 85 | creates only a new sprite when it's needed.(e.g. another bit 86 | depth)
Try to avoid to use CopySprite() in the main loop whenever 87 | it's possible. It's not recommended to use this command in the main 88 | loop, because it's really slow. If you need to use CopySprite() 89 | often, you should use the DX7 render system!

90 |
91 |

SetFrameRate():
If 92 | you set FrameRate to 0, FlipBuffers() will not wait, except for the 93 | vertical-blank interval.

94 |
95 |

DisplayAlphaSprite():
For 96 | now this command doesn't work correctly. This command is hardware 97 | accelerated. So it's much faster.

98 |
99 |

DisplayShadowSprite():
This 100 | command is hardware accelerated. So it's much faster.

101 |
102 |

DisplaySolidSprite():
This 103 | command is hardware accelerated. So it's much faster.

104 |
105 |

InitPalette():
InitPalette() 106 | is only available for compatibility reason. It does nothing.

107 |
108 |

CreatePalette():
CreatePalette() 109 | is only available for compatibility reason. It does nothing.

110 |
111 |

DisplayPalette():
DisplayPalette() 112 | is only available for compatibility reason. It does nothing.

113 |
114 |

FreePalette():
FreePalette() 115 | is only available for compatibility reason. It does nothing.

116 |
117 |

GetPaletteColor():
GetPaletteColor() 118 | is only available for compatibility reason. It does nothing.

119 |
120 |

IsPalette():
IsPalette() 121 | is only available for compatibility reason. It does nothing.

122 |
123 |

LoadPalette():
LoadPalette() 124 | is only available for compatibility reason. It does nothing.

125 |
126 |

SetPaletteColor():
SetPaletteColor() 127 | is only available for compatibility reason. It does nothing.

128 |
129 | 130 | -------------------------------------------------------------------------------- /DX9 Subsystem/Help/Index.hhk: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
    8 |
  • 9 | 10 | 11 | 12 | 13 |
  • 14 | 15 | 16 | 17 | 18 | 19 |
  • 20 | 21 | 22 | 23 | 24 | 25 |
  • 26 | 27 | 28 | 29 | 30 |
  • 31 | 32 | 33 | 34 | 35 |
  • 36 | 37 | 38 | 39 | 40 | 41 |
42 | 43 | -------------------------------------------------------------------------------- /DX9 Subsystem/Help/Loading.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

How 12 | to improve loading speed of LoadSprite() and CatchSprite()?

You 13 | can easyly reduce the needed time for loading if you load your sprite 14 | with the flags #PB_Sprite_Memory or 15 | #PB_Sprite_Texture|#PB_Sprite_AlphaBlending.
If you don't want to 16 | use these types of sprite (as #PB_Sprite_Memory is slower in 17 | displaying) you should avoid TransparentSpriteColor() calls after 18 | loading the sprite, as they are really really slow:

19 |

Faster way:

20 | 21 | 22 | 23 | 24 | 27 | 28 | 29 |
25 |

TransparentSpriteColor(#PB_Default,#Magenta)
LoadSprite(1,“sprite1.bmp“)
LoadSprite(2,“sprite2.bmp“)
LoadSprite(3,“sprite3.bmp“)
...

26 |
30 |



Slow 31 | way:

32 | 33 | 34 | 35 | 36 | 39 | 40 | 41 |
37 |

LoadSprite(1,“sprite1.bmp“)
TransparentSpriteColor(1,#Magenta)
LoadSprite(2,“sprite2.bmp“)
TransparentSpriteColor(2,#Magenta)
LoadSprite(3,“sprite3.bmp“)
TransparentSpriteColor(3,#Magenta)
...

38 |
42 |


Note:
Even 43 | if you use this faster way, loading sprites with the dx9 subsystem is 44 | slower than with the dx7 subsystem, because there is much more 45 | internal work to do.


46 |

47 |



48 |

49 | 50 | -------------------------------------------------------------------------------- /DX9 Subsystem/Help/Optimize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Optimize 12 | for the DX9 render system:

13 | 14 | 15 | 16 | 17 | 18 | 23 | 27 | 31 | 32 | 33 | 37 | 44 | 52 | 53 | 54 | 61 | 68 | 76 | 77 | 78 | 85 | 93 | 101 | 102 | 103 | 110 | 116 | 122 | 123 |
19 |

Optimize 20 | Sprite for: 21 |

22 |
24 |

DX9: 25 |

26 |
28 |

DX7: 29 |

30 |
34 |

UseBuffer() 35 |

36 |
38 |

The 39 | Sprite should be created in system memory (with #PB_Sprite_Memory) 40 | for the best performance. (This is not really important, because 41 | the DX9 Subsystem optimizes the Sprite automatically for best 42 | performance in this case)

43 |
45 |

The 46 | Sprite should be created in video memory (0 as parameter) for best 47 | performance. 48 |

49 |


50 |

51 |
55 |

SpriteOutput() 56 | 57 |

58 |


59 |

60 |
62 |

The 63 | Sprite should be created in system memory (with #PB_Sprite_Memory) 64 | for best performance. (This is not really important, because the 65 | DX9 Subsystem optimizes the Sprite automatically for best 66 | performance in this case)

67 |
69 |

The 70 | Sprite should be created in system memory (with #PB_Sprite_Memory) 71 | for best performance. 72 |

73 |


74 |

75 |
79 |

SpritePixelCollision() 80 | 81 |

82 |


83 |

84 |
86 |

It 87 | doesn’t matter weather you created the sprite in video 88 | memory or in system memory, because in the DX9 Subsystem the 89 | sprite is always backed in system 90 | memory. 91 |

92 |
94 |

The 95 | Sprite should be created in system memory (with #PB_Sprite_Memory) 96 | for best performance. 97 |

98 |


99 |

100 |
104 |

Fast 105 | sprite displaying 106 |

107 |


108 |

109 |
111 |

The 112 | Sprite should be created in video memory (0 as 113 | parameter) for best performance. 114 |

115 |
117 |

The 118 | Sprite should be created in video memory (0 as parameter ) for 119 | best performance. 120 |

121 |
124 |



125 |

126 | 127 | -------------------------------------------------------------------------------- /DX9 Subsystem/Help/Supported.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |

Supported 12 | commands of the DX9 Subsystem:

13 |

Supported 14 | Sprite 15 | commands:(All)

AvailableScreenMemory()
CatchSprite()
ChangeAlphaIntensity()
ChangeGamma()
ClearScreen()
ClipSprite()
CloseScreen()
CopySprite()
CreateSprite()
DisplayAlphaSprite()
DisplayRGBFilter()
DisplayShadowSprite()
DisplaySolidSprite()
DisplaySprite()
DisplayTranslucentSprite()
DisplayTransparentSprite()
ExamineScreenModes()
FlipBuffers()
FreeSprite()
GrabSprite()
InitSprite()
IsScreenActive()
IsSprite()
LoadSprite()
NextScreenMode()
OpenScreen()
OpenWindowedScreen()
SaveSprite()
ScreenID()
ScreenModeDepth()
ScreenModeHeight()
ScreenModeRefreshRate()
ScreenModeWidth()
ScreenOutput()
SetFrameRate()
SetRefreshRate()
SpriteCollision()
SpriteDepth()
SpriteHeight()
SpriteID()
SpriteOutput()
SpritePixelCollision()
SpriteWidth()
StartSpecialFX()
StopSpecialFX()
TransparentSpriteColor()
UseBuffer()


16 |

17 |

Supported 18 | Sprite3D commands:(All)

19 |
20 | DisplaySprite3D()
FreeSprite3D()
InitSprite3D()
IsSprite3D()
RotateSprite3D()
Sprite3DBlendingMode()
Sprite3DQuality()
Start3D()
Stop3D()
TransformSprite3D()
ZoomSprite3D()


21 |
22 |
Supported 23 | Keyboard commands:(All) 24 | 25 |
26 |

ExamineKeyboard()
InitKeyboard()
KeyboardInkey()
KeyboardMode()
KeyboardPushed()
KeyboardReleased()


27 |

28 |

Supported 29 | Mouse 30 | commands:(All)

ExamineMouse()
InitMouse()
MouseButton()
MouseDeltaX()
MouseDeltaY()
MouseLocate()
MouseWheel()
MouseX()
MouseY()
ReleaseMouse()


31 |

32 |

Supported 33 | Joystick 34 | commands:(All)

ExamineJoystick()
InitJoystick()
JoystickAxisX()
JoystickAxisY()
JoystickButton()


35 |

36 |

Supported 37 | Sound 38 | commands:(All)

CatchSound()
FreeSound()
InitSound()
IsSound()
LoadSound()
PlaySound()
SoundFrequency()
SoundPan()
SoundVolume()
StopSound()


DX9 39 | subsystem extensions:

40 |

DX9S_ClipSprite3D()
DX9S_Sprite3DColor()
DX9S_GetD3DDevice9()
DX9S_GetD3D9()
DX9S_GetScreenDepth()
DX9S_GetScreenWidth()
DX9S_GetScreenHeight()
DX9S_GetScreenRealWidth()
DX9S_GetScreenRealHeight()
DX9S_IsWindowed()
DX9S_ChangeWindowedScreen()
DX9S_SetCreationFlags()
DX9S_GetSpriteDC()
DX9S_ReleaseSpriteDC()
DX9S_GetSpriteTexture()
DX9S_LoadVideo()
DX9S_RenderVideoToSprite()
DX9S_NextVideoFrame()
DX9S_FreeVideo()

41 | 42 | -------------------------------------------------------------------------------- /DX9 Subsystem/Help/Table of Contents.hhc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
    11 |
  • 12 | 13 | 14 | 15 | 16 |
      17 |
    • 18 | 19 | 20 | 21 |
    • 22 | 23 | 24 | 25 |
    • 26 | 27 | 28 | 29 |
    • 30 | 31 | 32 | 33 |
    • 34 | 35 | 36 | 37 | 38 |
    39 | 40 |
41 | 42 | -------------------------------------------------------------------------------- /DX9 Subsystem/LICENCE: -------------------------------------------------------------------------------- 1 | * Author: Stefan Moebius 2 | * 3 | * Date: 2007-06-06 4 | * Vesion: 0.5 5 | * 6 | * Licence: Released to the PUBLIC DOMAIN 7 | * 8 | * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY OF ANY 9 | * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 10 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A 11 | * PARTICULAR PURPOSE. 12 | -------------------------------------------------------------------------------- /DX9 Subsystem/README.md: -------------------------------------------------------------------------------- 1 | #DX9 Subsystem for PureBasic 2 | Source of the DX9 Subsystem for PureBasic. 3 | 4 | Date: 2007-06-06 5 | Vesion: 0.5 6 | 7 | Licence: Released to the PUBLIC DOMAIN 8 | -------------------------------------------------------------------------------- /DX9 Subsystem/Source/ColorKey.cps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/ColorKey.cps -------------------------------------------------------------------------------- /DX9 Subsystem/Source/ColorKey_PS/COLOR_KEY_TEST_CREATE.pb: -------------------------------------------------------------------------------- 1 | #D3D_SDK_VERSION=31 2 | 3 | #D3DADAPTER_DEFAULT=0 4 | #D3DDEVTYPE_HAL=1 5 | #D3DSWAPEFFECT_DISCARD=1 6 | #D3DFMT_UNKNOWN=0 7 | #D3DFMT_D16=80 8 | 9 | #D3DCREATE_SOFTWARE_VERTEXPROCESSING=32 10 | #D3DCLEAR_TARGET=1 11 | #D3DCLEAR_ZBUFFER=2 12 | 13 | #D3DTS_WORLD=256 14 | #D3DTS_VIEW=2 15 | #D3DTS_PROJECTION=3 16 | 17 | Structure D3DPresent_Parameters 18 | BackBufferWidth.l 19 | BackBufferHeight.l 20 | BackBufferFormat.l 21 | BackBufferCount.l 22 | MultiSampleType.l 23 | MultiSampleQuality.l 24 | SwapEffect.l 25 | hDeviceWindow.l 26 | Windowed.l 27 | EnableAutoDepthStencil.l 28 | AutoDepthStencilFormat.l 29 | Flags.l 30 | FullScreen_RefreshRateInHz.l 31 | FullScreen_PresentationInterval.l 32 | EndStructure 33 | 34 | Structure D3DXMATRIX 35 | _11.f 36 | _12.f 37 | _13.f 38 | _14.f 39 | _21.f 40 | _22.f 41 | _23.f 42 | _24.f 43 | _31.f 44 | _32.f 45 | _33.f 46 | _34.f 47 | _41.f 48 | _42.f 49 | _43.f 50 | _44.f 51 | EndStructure 52 | 53 | Structure D3DXPARAMETER_DESC 54 | Name.l ; // Parameter name 55 | Semantic.l ; // Parameter semantic 56 | Class.l ; // Class 57 | Type.l ; // Component type 58 | Rows.l ; // Number of rows 59 | Columns.l ; // Number of columns 60 | Elements.l ;// Number of array elements 61 | Annotations.l ;; // Number of annotations 62 | StructMembers.l ;// Number of Structure member sub-parameters 63 | Flags.l ;; // D3DX_PARAMETER_* flags 64 | Bytes.l ;;// // Parameter size, in bytes 65 | EndStructure 66 | 67 | 68 | D3D9DLL=OpenLibrary(1,"d3d9.dll") 69 | D3DX9DLL=OpenLibrary(2,"d3dx9_30.dll") 70 | 71 | If D3D9DLL=0 Or D3DX9DLL=0 72 | MessageRequester("Error","Can't load needed dlls!") 73 | End 74 | EndIf 75 | 76 | OpenWindow(1,0,0,640,480,"Direct3D9 FX Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget) 77 | 78 | *D3D.IDirect3D9=CallFunction(1,"Direct3DCreate9",#D3D_SDK_VERSION) 79 | 80 | If *D3D=0 81 | MessageRequester("Error","Can't init direct3d 9!") 82 | End 83 | EndIf 84 | 85 | D3DWnd.D3DPresent_Parameters\Windowed=1 86 | D3DWnd\SwapEffect=#D3DSWAPEFFECT_DISCARD 87 | D3DWnd\BackBufferWidth=640 88 | D3DWnd\BackBufferHeight=480 89 | D3DWnd\EnableAutoDepthStencil=1 ; use a z-buffer, or it will look ugly 90 | D3DWnd\AutoDepthStencilFormat=#D3DFMT_D16 91 | 92 | 93 | *D3D\CreateDevice(#D3DADAPTER_DEFAULT,#D3DDEVTYPE_HAL,WindowID(1),#D3DCREATE_SOFTWARE_VERTEXPROCESSING,D3DWnd,@*D3DDevice.IDirect3DDevice9) 94 | 95 | If *D3DDevice=0 96 | *D3D\Release() 97 | MessageRequester("Error","Can't init direct3d 9!") 98 | End 99 | EndIf 100 | 101 | 102 | CallFunction(2,"D3DXCreateTextureFromFileA",*D3DDevice,@"test.bmp",@*Tex) 103 | 104 | Debug "SET TEX" 105 | Debug *D3DDevice\SetTexture(0,*Tex) 106 | 107 | 108 | ; load fx file and compile it 109 | 110 | CallFunction(2,"D3DXCreateEffectCompilerFromFileA",@"ColorKey.fx",0,0,0,@*EffectCompiler.ID3DXEffectCompiler,0) 111 | 112 | If *EffectCompiler=0 113 | *D3DDevice\Release() 114 | *D3D\Release() 115 | MessageRequester("Error","D3DXCreateEffectCompilerFromFileA failed!") 116 | End 117 | EndIf 118 | 119 | *EffectCompiler\CompileEffect(0,@*EffectBuffer.ID3DXBUFFER,0) 120 | 121 | CallFunction(2,"D3DXCreateEffect",*D3DDevice,*EffectBuffer\GetBufferPointer(),*EffectBuffer\GetBufferSize(),0,0,0,0,@*Effect.ID3DXEffect,0) 122 | 123 | 124 | ; create teapot mesh 125 | CallFunction(2,"D3DXCreateTeapot",*D3DDevice,@*Mesh.ID3DXMesh,0) 126 | 127 | If *Mesh=0 128 | *D3DDevice\Release() 129 | *D3D\Release() 130 | MessageRequester("Error","D3DXCreateTeapot failed!") 131 | End 132 | EndIf 133 | 134 | 135 | CallFunction(2,"D3DXMatrixTranslation",Translate.D3DXMATRIX,0,0,5.0) 136 | 137 | CallFunction(2,"D3DXMatrixPerspectiveFovRH",Proj.D3DXMATRIX,ACos(-1)/2,1.0,0.1,100) 138 | 139 | CallFunction(2,"D3DXMatrixPerspectiveLH",Proj.D3DXMATRIX,0.1,0.1,0.1,100.0) 140 | 141 | 142 | ;Debug *Effect\FindNextValidTechnique(0,@Technique) 143 | ;Debug *Effect\SetTechnique(Technique) 144 | 145 | ;Debug *Effect\FindNextValidTechnique(Technique,@Technique) 146 | ;Debug *Effect\SetTechnique(Technique) 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | Repeat 157 | 158 | hParam=*Effect\GetParameter(0,Param) 159 | If hParam 160 | *Effect\GetParameterDesc(hParam,@ParamDesc.D3DXPARAMETER_DESC) 161 | 162 | If ParamDesc\Type=9 163 | Texture=hParam 164 | Debug "TEX" 165 | EndIf 166 | 167 | 168 | If ParamDesc\Semantic 169 | 170 | String$=UCase(PeekS(ParamDesc\Semantic,-1,#PB_UTF8)) 171 | Debug String$ 172 | 173 | If String$="WORLD":hWorld=hParam:EndIf 174 | If String$="WORLDVIEW":hWorldView=hParam:EndIf 175 | If String$="WORLDVIEWPROJECTION":hWorldViewProj=hParam:EndIf 176 | If String$="VIEWPROJECTION":hViewProj=hParam:EndIf 177 | If String$="VIEW":hView=hParam:EndIf 178 | If String$="VIEWINV":hViewInv=hParam:EndIf 179 | If String$="PROJECTION":hProj=hParam:EndIf 180 | If String$="CAMERAPOSITION":hCameraPos=hParam:EndIf 181 | 182 | Else 183 | 184 | Debug "ParamDesc\Semantic=0" 185 | EndIf 186 | 187 | Else 188 | Debug "hParam=0" 189 | EndIf 190 | 191 | Param+1 192 | Until Param>100 193 | 194 | 195 | 196 | 197 | *D3DDevice\SetTextureStageState(0,11,$40000) 198 | *D3DDevice\SetRenderState(7,1) 199 | *D3DDevice\SetRenderState(14,1) 200 | *D3DDevice\SetRenderState(23,4) 201 | 202 | 203 | ; set projection matrix 204 | *D3DDevice\SetTransform(#D3DTS_PROJECTION,Proj) 205 | 206 | 207 | CallFunction(2,"D3DXMatrixIdentity",View.D3DXMATRIX) 208 | 209 | *D3DDevice\SetRenderStaTE(137,0) 210 | 211 | 212 | *Effect\GetPixelShader(*Effect\GetCurrentTechnique(),@*psh) 213 | Debug *psh 214 | 215 | Repeat 216 | 217 | t.f+0.05 218 | 219 | CallFunction(2,"D3DXMatrixRotationX",RotX.D3DXMATRIX,t) 220 | CallFunction(2,"D3DXMatrixRotationY",RotY.D3DXMATRIX,t) 221 | 222 | CallFunction(2,"D3DXMatrixMultiply",World.D3DXMATRIX,RotX,RotY) 223 | CallFunction(2,"D3DXMatrixMultiply",World.D3DXMATRIX,World,Translate) 224 | 225 | *D3DDevice\SetTransform(#D3DTS_WORLD,World) 226 | 227 | *D3DDevice\Clear(0,0,#D3DCLEAR_TARGET|#D3DCLEAR_ZBUFFER,$555555,1.0,0) 228 | *D3DDevice\BeginScene() 229 | 230 | *Effect\Begin(@NumPasses,0) 231 | For Pass=0 To NumPasses-1 232 | *Effect\BeginPass(Pass) 233 | *Mesh\DrawSubset(0) 234 | 235 | 236 | If WR=0 237 | WR=1 238 | *D3DDevice\GetPixelShader(@*ps.IDirect3DPixelShader9) 239 | *ps\GetFunction(0,@Size) 240 | Addr=AllocateMemory(Size) 241 | A=Size 242 | *ps\GetFunction(Addr,@A) 243 | 244 | CreateFile(1,"ColorKey.ps") 245 | WriteData(1,Addr,Size) 246 | CloseFile(1) 247 | EndIf 248 | 249 | 250 | 251 | *Effect\EndPass() 252 | Next 253 | 254 | *D3DDevice\EndScene() 255 | 256 | *D3DDevice\Present(0,0,0,0) 257 | Until WindowEvent()=#PB_Event_CloseWindow 258 | 259 | *Effect\Release() 260 | *EffectBuffer\Release() 261 | *EffectCompiler\Release() 262 | *D3DDevice\Release() 263 | *D3D\Release() 264 | 265 | ; IDE Options = PureBasic 5.00 Beta 3 (Windows - x86) 266 | ; CursorPosition = 101 267 | ; FirstLine = 89 -------------------------------------------------------------------------------- /DX9 Subsystem/Source/ColorKey_PS/COLOR_KEY_TEST_PLAY.pb: -------------------------------------------------------------------------------- 1 | #D3D_SDK_VERSION=31 2 | 3 | #D3DADAPTER_DEFAULT=0 4 | #D3DDEVTYPE_HAL=1 5 | #D3DSWAPEFFECT_DISCARD=1 6 | #D3DFMT_UNKNOWN=0 7 | #D3DFMT_D16=80 8 | 9 | #D3DCREATE_SOFTWARE_VERTEXPROCESSING=32 10 | #D3DCLEAR_TARGET=1 11 | #D3DCLEAR_ZBUFFER=2 12 | 13 | #D3DTS_WORLD=256 14 | #D3DTS_VIEW=2 15 | #D3DTS_PROJECTION=3 16 | 17 | Structure D3DPresent_Parameters 18 | BackBufferWidth.l 19 | BackBufferHeight.l 20 | BackBufferFormat.l 21 | BackBufferCount.l 22 | MultiSampleType.l 23 | MultiSampleQuality.l 24 | SwapEffect.l 25 | hDeviceWindow.l 26 | Windowed.l 27 | EnableAutoDepthStencil.l 28 | AutoDepthStencilFormat.l 29 | Flags.l 30 | FullScreen_RefreshRateInHz.l 31 | FullScreen_PresentationInterval.l 32 | EndStructure 33 | 34 | Structure D3DXMATRIX 35 | _11.f 36 | _12.f 37 | _13.f 38 | _14.f 39 | _21.f 40 | _22.f 41 | _23.f 42 | _24.f 43 | _31.f 44 | _32.f 45 | _33.f 46 | _34.f 47 | _41.f 48 | _42.f 49 | _43.f 50 | _44.f 51 | EndStructure 52 | 53 | Structure D3DXPARAMETER_DESC 54 | Name.l ; // Parameter name 55 | Semantic.l ; // Parameter semantic 56 | Class.l ; // Class 57 | Type.l ; // Component type 58 | Rows.l ; // Number of rows 59 | Columns.l ; // Number of columns 60 | Elements.l ;// Number of array elements 61 | Annotations.l ;; // Number of annotations 62 | StructMembers.l ;// Number of Structure member sub-parameters 63 | Flags.l ;; // D3DX_PARAMETER_* flags 64 | Bytes.l ;;// // Parameter size, in bytes 65 | EndStructure 66 | 67 | 68 | D3D9DLL=OpenLibrary(1,"d3d9.dll") 69 | D3DX9DLL=OpenLibrary(2,"d3dx9_24.dll") 70 | 71 | If D3D9DLL=0 Or D3DX9DLL=0 72 | MessageRequester("Error","Can't load needed dlls!") 73 | End 74 | EndIf 75 | 76 | OpenWindow(1,0,0,640,480,"Direct3D9 FX Test",#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget) 77 | 78 | *D3D.IDirect3D9=CallFunction(1,"Direct3DCreate9",#D3D_SDK_VERSION) 79 | 80 | If *D3D=0 81 | MessageRequester("Error","Can't init direct3d 9!") 82 | End 83 | EndIf 84 | 85 | D3DWnd.D3DPresent_Parameters\Windowed=1 86 | D3DWnd\SwapEffect=#D3DSWAPEFFECT_DISCARD 87 | D3DWnd\BackBufferWidth=640 88 | D3DWnd\BackBufferHeight=480 89 | D3DWnd\EnableAutoDepthStencil=1 ; use a z-buffer, or it will look ugly 90 | D3DWnd\AutoDepthStencilFormat=#D3DFMT_D16 91 | 92 | 93 | *D3D\CreateDevice(#D3DADAPTER_DEFAULT,#D3DDEVTYPE_HAL,WindowID(1),#D3DCREATE_SOFTWARE_VERTEXPROCESSING,D3DWnd,@*D3DDevice.IDirect3DDevice9) 94 | 95 | If *D3DDevice=0 96 | *D3D\Release() 97 | MessageRequester("Error","Can't init direct3d 9!") 98 | End 99 | EndIf 100 | 101 | 102 | CallFunction(2,"D3DXCreateTextureFromFileA",*D3DDevice,@"test.bmp",@*Tex) 103 | 104 | Debug "SET TEX" 105 | Debug *D3DDevice\SetTexture(0,*Tex) 106 | 107 | 108 | 109 | 110 | OpenFile(1,"ColorKey.ps") 111 | Addr=AllocateMemory(Lof(1)) 112 | ReadData(1,Addr,Lof(1)) 113 | 114 | ;Debug CallFunction(2,"D3DXDisassembleShader",Addr,0,0,@p.ID3DXBuffer) 115 | 116 | ;AD=p\GetBufferPointer() 117 | ;SZ=p\GetBufferSize() 118 | 119 | ;CreateFile(2,"CC.txt") 120 | ;WriteData(2,AD,SZ) 121 | ;CloseFile(2) 122 | 123 | 124 | 125 | 126 | 127 | ;WENN USEBUFFER 128 | ;Select Render Target Texture 129 | ;WENN TEXTURE Zeichnen 130 | ;Copy RT->SYSMEM 131 | 132 | 133 | CloseFile(1) 134 | 135 | 136 | *D3DDevice\CreatePixelShader(Addr,@ps) 137 | 138 | Debug *D3DDevice\SetPixelShader(ps) 139 | 140 | 141 | ; create teapot mesh 142 | CallFunction(2,"D3DXCreateTeapot",*D3DDevice,@*Mesh.ID3DXMesh,0) 143 | 144 | If *Mesh=0 145 | *D3DDevice\Release() 146 | *D3D\Release() 147 | MessageRequester("Error","D3DXCreateTeapot failed!") 148 | End 149 | EndIf 150 | 151 | 152 | CallFunction(2,"D3DXMatrixTranslation",Translate.D3DXMATRIX,0,0,5.0) 153 | 154 | CallFunction(2,"D3DXMatrixPerspectiveFovRH",Proj.D3DXMATRIX,ACos(-1)/2,1.0,0.1,100) 155 | 156 | CallFunction(2,"D3DXMatrixPerspectiveLH",Proj.D3DXMATRIX,0.1,0.1,0.1,100.0) 157 | 158 | 159 | ;Debug *Effect\FindNextValidTechnique(0,@Technique) 160 | ;Debug *Effect\SetTechnique(Technique) 161 | 162 | ;Debug *Effect\FindNextValidTechnique(Technique,@Technique) 163 | ;Debug *Effect\SetTechnique(Technique) 164 | 165 | 166 | 167 | Structure RGB 168 | r.f 169 | g.f 170 | b.f 171 | a.f 172 | EndStructure 173 | 174 | 175 | 176 | 177 | 178 | 179 | *D3DDevice\SetTextureStageState(0,11,$40000) 180 | ; *D3DDevice\SetRenderState(7,1) 181 | ;*D3DDevice\SetRenderState(14,1) 182 | 183 | 184 | *D3DDevice\SetRenderState(27,1) 185 | D3DRS_SRCBLEND = 19 186 | D3DRS_DESTBLEND = 20 187 | 188 | *D3DDevice\SetRenderState(D3DRS_SRCBLEND,5) 189 | *D3DDevice\SetRenderState(D3DRS_DESTBLEND,6) 190 | 191 | 192 | 193 | ; set projection matrix 194 | *D3DDevice\SetTransform(#D3DTS_PROJECTION,Proj) 195 | 196 | 197 | CallFunction(2,"D3DXMatrixIdentity",View.D3DXMATRIX) 198 | 199 | *D3DDevice\SetRenderState(137,0) 200 | 201 | 202 | 203 | #D3DUSAGE_RENDERTARGET=1 204 | #D3DUSAGE_DYNAMIC=512 205 | #D3DPOOL_MANAGED=1 206 | #D3DFMT_A8R8G8B8=21 207 | 208 | #D3DPOOL_DEFAULT=0 209 | #D3DPOOL_MANAGED=1 210 | #D3DPOOL_SYSTEMMEM=2 211 | 212 | #D3DFMT_X1R5G5B5=24 213 | *D3DDevice\CreateTexture(500,500,1,#D3DUSAGE_RENDERTARGET,#D3DFMT_X1R5G5B5,#D3DPOOL_DEFAULT,@*RT,0) 214 | 215 | Debug "RT" 216 | Debug *RT 217 | 218 | 219 | Repeat 220 | 221 | 222 | k.RGB 223 | k\r=0/255 224 | k\g=0/255 225 | k\b=0/255 226 | *D3DDevice\SetPixelShaderConstantF(0,k,4) 227 | 228 | t.f+0.05 229 | 230 | CallFunction(2,"D3DXMatrixRotationX",RotX.D3DXMATRIX,t) 231 | CallFunction(2,"D3DXMatrixRotationY",RotY.D3DXMATRIX,t) 232 | 233 | CallFunction(2,"D3DXMatrixMultiply",World.D3DXMATRIX,RotX,RotY) 234 | CallFunction(2,"D3DXMatrixMultiply",World.D3DXMATRIX,World,Translate) 235 | 236 | *D3DDevice\SetTransform(#D3DTS_WORLD,World) 237 | 238 | *D3DDevice\Clear(0,0,#D3DCLEAR_TARGET|#D3DCLEAR_ZBUFFER,$FF5555,1.0,0) 239 | *D3DDevice\BeginScene() 240 | 241 | *Mesh\DrawSubset(0) 242 | 243 | *D3DDevice\EndScene() 244 | 245 | *D3DDevice\Present(0,0,0,0) 246 | Until WindowEvent()=#PB_Event_CloseWindow 247 | 248 | 249 | 250 | 251 | *D3DDevice\Release() 252 | *D3D\Release() 253 | 254 | ; IDE Options = PureBasic 5.00 Beta 3 (Windows - x86) 255 | ; CursorPosition = 101 256 | ; FirstLine = 70 -------------------------------------------------------------------------------- /DX9 Subsystem/Source/ColorKey_PS/ColorKey.fx: -------------------------------------------------------------------------------- 1 | // ColorKeying Pixelshader (c) 2006 Stefan Moebius 2 | 3 | string XFile = "test.x"; 4 | int BCLR = 0xffffffff; 5 | 6 | texture Tex0 < string name = "test.bmp"; >; 7 | 8 | float4 Trans: Trans; 9 | 10 | sampler Sampler = sampler_state 11 | { 12 | Texture = (Tex0); 13 | MipFilter = POINT; 14 | MinFilter = POINT; 15 | MagFilter = POINT; 16 | }; 17 | 18 | float4 PS( 19 | float4 Diff : COLOR0, 20 | float4 Spec : COLOR1, 21 | float2 Tex : TEXCOORD0) : COLOR 22 | { 23 | float4 OutColor; 24 | 25 | OutColor=tex2D(Sampler,Tex); 26 | if (all(abs(OutColor.rgb-Trans.rgb)<0.004)){ 27 | discard; 28 | } 29 | return OutColor*Diff; 30 | } 31 | 32 | 33 | technique ColorKey 34 | { 35 | pass P0 36 | { 37 | PixelShader = compile ps_1_4 PS(); 38 | } 39 | } 40 | 41 | -------------------------------------------------------------------------------- /DX9 Subsystem/Source/ColorKey_PS/ColorKey.ps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/ColorKey_PS/ColorKey.ps -------------------------------------------------------------------------------- /DX9 Subsystem/Source/ColorKey_PS/TEST.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/ColorKey_PS/TEST.bmp -------------------------------------------------------------------------------- /DX9 Subsystem/Source/ColorKey_PS/Test.x: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/ColorKey_PS/Test.x -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DInput8.pbi: -------------------------------------------------------------------------------- 1 | #DISCL_BACKGROUND=8 2 | #DISCL_NONEXCLUSIVE=2 3 | #DISCL_EXCLUSIVE=1 4 | #DISCL_FOREGROUND=4 5 | #DISCL_NOWINKEY=16 6 | 7 | #DIDFT_BUTTON=12 8 | #DIDFT_AXIS=3 9 | #DIDFT_ANYINSTANCE=16776960 10 | #DIDFT_OPTIONAL=2147483648 11 | 12 | #DI8DEVCLASS_KEYBOARD=3;Keyboard 13 | #DI8DEVCLASS_GAMECTRL=4 14 | 15 | 16 | Structure DIDEVICEINSTANCE 17 | dwSize.l 18 | GuidInstance.guid 19 | GuidProduct.guid 20 | dwDevType.l 21 | tszInstanceName.b[#MAX_PATH] 22 | tszProductName.b[#MAX_PATH] 23 | guidFFDriver.guid 24 | wUsagePage.w 25 | wUsage.w 26 | EndStructure 27 | 28 | Structure DIOBJECTDATAFORMAT 29 | pguid.l 30 | dwOfs.l 31 | dwType.l 32 | dwFlags.l 33 | EndStructure 34 | 35 | Structure DIDATAFORMAT 36 | dwSize.l 37 | dwObjSize.l 38 | dwFlags.l 39 | dwDataSize.l 40 | dwNumObjs.l 41 | rgodf.l 42 | EndStructure 43 | 44 | Structure DIMOUSESTATE2 45 | lx.l 46 | ly.l 47 | lz.l 48 | rgbButtons.b[8] 49 | EndStructure 50 | 51 | 52 | Structure DIPROPHEADER 53 | dwSize.l 54 | dwHeaderSize.l 55 | dwObj.l 56 | dwHow.l 57 | EndStructure 58 | 59 | Structure DIPROPDWORD 60 | diph.DIPROPHEADER 61 | dwData.l 62 | EndStructure 63 | 64 | #DIPH_BYOFFSET=1 65 | #DIPROP_GRANULARITY=3 66 | 67 | Structure dfDIMouse2 68 | dfDIMouse2.DIOBJECTDATAFORMAT[11] 69 | EndStructure 70 | 71 | Structure DIK8Keys 72 | Key.DIOBJECTDATAFORMAT[256] 73 | EndStructure 74 | 75 | Structure DIJOYSTATE 76 | lX.l 77 | lY.l 78 | lZ.l 79 | lRx.l 80 | lRy.l 81 | lRz.l 82 | rglSlider.l[2] 83 | rgdwPOV.l[4] 84 | rgbButtons.b[32] 85 | EndStructure 86 | 87 | 88 | DataSection 89 | ___DInput8:;GUID 90 | Data.b 48,-128,121,-65,58,72,-94,77,-86,-103,93,100,-19,54,-105,0 91 | 92 | GUID_SysMouse: 93 | Data.l $6F1D2B60 94 | Data.w $D5A0,$11CF 95 | Data.b $BF,$C7,$44,$45,$53,$54,$00,$00 96 | EndDataSection 97 | ; IDE Options = PureBasic v4.02 (Windows - x86) 98 | ; CursorPosition = 95 99 | ; FirstLine = 61 100 | ; Folding = - -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9S_D3D9HelperFunctions.pbi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/DX9S_D3D9HelperFunctions.pbi -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9S_DIJ8.pbi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/DX9S_DIJ8.pbi -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9S_DIK8.pbi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/DX9S_DIK8.pbi -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9S_DIM8.pbi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/DX9S_DIM8.pbi -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9S_Dummys.pbi: -------------------------------------------------------------------------------- 1 | 2 | 3 | ProcedureDLL InitPalette() 4 | ProcedureReturn 1 5 | EndProcedure 6 | 7 | ProcedureDLL CreatePalette(Palette) 8 | ProcedureReturn 1 9 | EndProcedure 10 | 11 | ProcedureDLL DisplayPalette(Palette) 12 | ProcedureReturn 1 13 | EndProcedure 14 | 15 | ProcedureDLL FreePalette(Palette) 16 | ProcedureReturn 1 17 | EndProcedure 18 | 19 | ProcedureDLL GetPaletteColor(Palette,Index) 20 | ProcedureReturn 1 21 | EndProcedure 22 | 23 | ProcedureDLL IsPalette(Palette) 24 | ProcedureReturn 1 25 | EndProcedure 26 | 27 | ProcedureDLL LoadPalette(Palette,File$) 28 | ProcedureReturn 1 29 | EndProcedure 30 | 31 | ProcedureDLL SetPaletteColor(Palette,Index,Farbe) 32 | ProcedureReturn 1 33 | EndProcedure 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | ; IDE Options = PureBasic 4.10 Beta 1 (Windows - x86) 42 | ; CursorPosition = 2 43 | ; Folding = -- -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9S_ImageLoader.pbi: -------------------------------------------------------------------------------- 1 | 2 | ; Loads bmp And dib files from memory. 3 | Procedure _DIB_LoadFromMem(Addr.l) 4 | Protected *bmfh.BITMAPFILEHEADER, *bminf.BitmapInfo, hBmp.l, MemDC.l, OldhBmp.l, Result.l 5 | If Addr 6 | *bmfh.BITMAPFILEHEADER=Addr 7 | If *bmfh\bfType='MB' ; seems to be a bitmap (*.bmp or *.dib), so we don't need the size 8 | ; load bmp or dib from memory, really short ;) 9 | *bminf.BitmapInfo=*bmfh+SizeOf(BITMAPFILEHEADER) 10 | hBmp=CreateDIBSection_(0,*bminf,#DIB_RGB_COLORS,0,0,0) 11 | If hBmp=0:ProcedureReturn 0:EndIf 12 | 13 | MemDC=CreateCompatibleDC_(0) 14 | 15 | OldhBmp=SelectObject_(MemDC,hBmp) 16 | Result=SetDIBitsToDevice_(MemDC,0,0,*bminf\BmiHeader\biWidth,*bminf\BmiHeader\biHeight,0,0,0,*bminf\BmiHeader\biHeight,*bmfh\bfOffBits+*bmfh,*bminf,#DIB_RGB_COLORS) 17 | SelectObject_(MemDC,OldhBmp) 18 | DeleteDC_(MemDC) 19 | If Result=0:DeleteObject_(MemDC):ProcedureReturn 0:EndIf 20 | EndIf 21 | EndIf 22 | 23 | ProcedureReturn hBmp 24 | EndProcedure 25 | 26 | ; Loads bmp And dib files from file. 27 | Procedure _DIB_LoadFromFile(File.s) 28 | ProcedureReturn LoadImage_(0,File.s,#IMAGE_BITMAP,0,0,#LR_LOADFROMFILE|#LR_CREATEDIBSECTION) 29 | EndProcedure 30 | 31 | Procedure _DIB_CreateFromDC(SrcDC.l,Width.l,Height.l,Bpp.l) 32 | BmInf.BitmapInfo 33 | BmInf\BmiHeader\biBitCount=Bpp 34 | BmInf\BmiHeader\biCompression=#BI_RGB 35 | BmInf\BmiHeader\biPlanes=1 36 | BmInf\BmiHeader\biSize=SizeOf(BITMAPINFOHEADER) 37 | BmInf\BmiHeader\biWidth=Width 38 | BmInf\BmiHeader\biHeight=Height 39 | hBmp=CreateDIBSection_(0,BmInf,#DIB_RGB_COLORS,0,0,0) 40 | 41 | MemDC=CreateCompatibleDC_(0) 42 | If MemDC=0:DeleteObject_(hBmp):ProcedureReturn 0:EndIf 43 | 44 | OldhBmp=SelectObject_(MemDC,hBmp) 45 | Result=BitBlt_(MemDC,0,0,Width,Height,SrcDC,0,0,#SRCCOPY) 46 | SelectObject_(MemDC,OldhBmp) 47 | DeleteDC_(MemDC) 48 | If Result=0:DeleteObject_(hBmp):ProcedureReturn 0:EndIf 49 | ProcedureReturn hBmp 50 | EndProcedure 51 | 52 | 53 | 54 | 55 | 56 | Procedure _PB_LoadImage(Addr.l,File.s,bpp.l,*ds.DIBSECTION) 57 | 58 | If bpp=8 59 | 60 | If Addr=0 61 | hBmp=_DIB_LoadFromFile(File.s) 62 | Else 63 | hBmp=_DIB_LoadFromMem(Addr.l) 64 | EndIf 65 | 66 | If GetObject_(hBmp,SizeOf(DIBSECTION),*ds.DIBSECTION)=0:ProcedureReturn 0:EndIf 67 | 68 | If *ds\dsBm\bmBits=0 Or *ds\dsBm\bmBitsPixel<>8:ProcedureReturn 0:EndIf 69 | 70 | ProcedureReturn hBmp 71 | EndIf 72 | 73 | If bpp=32 Or bpp=16 74 | 75 | If Addr=0 76 | Image=LoadImage(#PB_Any,File,bpp) 77 | Else 78 | Image=CatchImage(#PB_Any,Addr,bpp) 79 | EndIf 80 | 81 | ImageID=ImageID(Image) 82 | 83 | If GetObjectType_(ImageID)<>#OBJ_BITMAP:FreeImage(Image):ProcedureReturn 0:EndIf ; if we try to load an icon 84 | 85 | MemDC=CreateCompatibleDC_(0) 86 | OldImageID=SelectObject_(MemDC,ImageID) 87 | hBmp=_DIB_CreateFromDC(MemDC,ImageWidth(Image),ImageHeight(Image),Bpp) 88 | SelectObject_(MemDC,OldImageID) 89 | DeleteDC_(MemDC) 90 | FreeImage(Image) 91 | 92 | If GetObject_(hBmp,SizeOf(DIBSECTION),*ds.DIBSECTION)=0:DeleteObject_(hBmp):ProcedureReturn 0:EndIf 93 | ProcedureReturn hBmp 94 | EndIf 95 | 96 | EndProcedure 97 | ; IDE Options = PureBasic 5.00 Beta 3 (Windows - x86) 98 | ; CursorPosition = 76 99 | ; FirstLine = 42 100 | ; Folding = - -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9S_ObjectManager.pbi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/DX9S_ObjectManager.pbi -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9S_TextureManager.pbi: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/DX9S_TextureManager.pbi -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9SubsystemDLL43.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/DX9SubsystemDLL43.pb -------------------------------------------------------------------------------- /DX9 Subsystem/Source/DX9SubsystemDLL44.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/DX9 Subsystem/Source/DX9SubsystemDLL44.pb -------------------------------------------------------------------------------- /DirectDraw_1_0/DirectDraw_1_0.pb: -------------------------------------------------------------------------------- 1 | 2 | 3 | ;Use DirectDraw v1.0 for drawing on windows 4 | ;****************************************** 5 | 6 | 7 | Structure DDPIXELFORMAT 8 | dwSize.l 9 | dwFlags.l 10 | dwFourCC.l 11 | dwRGBBitCount.l 12 | dwRBitMask.l 13 | dwGBitMask.l 14 | dwBBitMask.l 15 | dwRGBAlphaBitMask.l 16 | EndStructure 17 | 18 | Structure DDCOLORKEY 19 | dwColorSpaceLowValue.l 20 | dwColorSpaceHighValue.l 21 | EndStructure 22 | 23 | Structure DDSCAPS 24 | dwCaps.l 25 | EndStructure 26 | 27 | Structure DDSURFACEDESC 28 | dwSize.l 29 | dwFlags.l 30 | dwHeight.l 31 | dwWidth.l 32 | lPitch.l 33 | dwBackBufferCount.l 34 | dwMipMapCount.l 35 | dwAlphaBitDepth.l 36 | dwReserved.l 37 | lpSurface.l 38 | ddckCKDestOverlay.DDCOLORKEY 39 | ddckCKDestBlt.DDCOLORKEY 40 | ddckCKSrcOverlay.DDCOLORKEY 41 | ddckCKSrcBlt.DDCOLORKEY 42 | ddpfPixelFormat.DDPIXELFORMAT 43 | ddsCaps.DDSCAPS 44 | EndStructure 45 | 46 | Structure DXImage 47 | *DDS.IDirectDrawSurface 48 | DC.l 49 | left.l 50 | top.l 51 | right.l 52 | bottom.l 53 | RealWidth.l 54 | RealHeight.l 55 | EndStructure 56 | 57 | #DDSD_WIDTH=4 58 | #DDSD_HEIGHT=2 59 | #DDSD_CAPS=1 60 | #DDSCAPS_3DDEVICE=8192 61 | #DDSCAPS_OFFSCREENPLAIN=64 62 | #DDSCL_NORMAL=8 63 | #DDSCAPS_PRIMARYSURFACE=512 64 | #DDBLT_WAIT=$01000000 65 | #DDBLT_KEYSRC=$0000800 66 | 67 | Global *DD.IDirectDraw,*Clipper.IDirectDrawClipper,*Prim.IDirectDrawSurface 68 | Global DESC.DDSURFACEDESC 69 | ;Global OldWindowID 70 | 71 | 72 | Procedure InitDD1() 73 | DirectDrawCreate_(0,@*DD,0) 74 | 75 | *DD\SetCooperativeLevel(0,#DDSCL_NORMAL) 76 | 77 | *DD\CreateClipper(0,@*Clipper,0) 78 | DESC\dwSize=SizeOf(DDSURFACEDESC) 79 | DESC\dwFlags=#DDSD_CAPS 80 | DESC\ddsCaps\dwCaps=#DDSCAPS_PRIMARYSURFACE 81 | 82 | *DD\CreateSurface(DESC,@*Prim,0) 83 | *Prim\SetClipper(*Clipper) 84 | EndProcedure 85 | 86 | 87 | Procedure FreeDD1() 88 | *Clipper\Release() 89 | *Prim\Release() 90 | *DD\Release() 91 | EndProcedure 92 | 93 | Procedure CreateDXImage(width,height) 94 | *Img.DXImage=GlobalAlloc_(#GMEM_FIXED|#GMEM_ZEROINIT,SizeOf(DXImage)) 95 | DESC\dwWidth=width 96 | DESC\dwHeight=height 97 | DESC\dwFlags=#DDSD_WIDTH|#DDSD_HEIGHT|#DDSD_CAPS 98 | DESC\ddsCaps\dwCaps=#DDSCAPS_OFFSCREENPLAIN 99 | *DD\CreateSurface(DESC,@*DDS.IDirectDrawSurface,0) 100 | 101 | *DDS\GetDC(@DC) 102 | BitBlt_(DC,0,0,width,height,0,0,0,#BLACKNESS) 103 | *DDS\ReleaseDC(DC) 104 | 105 | *Img\DDS=*DDS 106 | *Img\right=width 107 | *Img\bottom=height 108 | *Img\RealWidth=width 109 | *Img\RealHeight=height 110 | 111 | ProcedureReturn *Img 112 | EndProcedure 113 | 114 | 115 | Procedure GetDXImageDC(*Img.DXImage) 116 | *DDS.IDirectDrawSurface=*Img\DDS 117 | *DDS\GetDC(@DC) 118 | ProcedureReturn DC 119 | EndProcedure 120 | 121 | Procedure ReleaseDXImageDC(*Img.DXImage,DC) 122 | *DDS.IDirectDrawSurface=*Img\DDS 123 | ProcedureReturn *DDS\ReleaseDC(DC) 124 | EndProcedure 125 | 126 | Procedure DrawDXImage(WindowID,*Img.DXImage,X,Y,trans) 127 | *Clipper\SetHwnd(0,WindowID) 128 | 129 | GetWindowRect_(WindowID,@re.rect) 130 | GetClientRect_(WindowID,@cre.rect) 131 | 132 | tmp=((re\right-re\left)-(cre\right-cre\left))/2 133 | dest.rect\left=tmp+re\left+X 134 | dest\right=dest\left+*Img\right-*Img\left 135 | dest\top=((re\bottom-re\top)-(cre\bottom-cre\top))-tmp+re\top+Y 136 | dest\bottom=dest\top+*Img\bottom-*Img\top 137 | 138 | Select trans 139 | Case 0 140 | ProcedureReturn *Prim\Blt(dest,*Img\DDS,@*Img\left,#DDBLT_WAIT,0) 141 | Default 142 | ProcedureReturn *Prim\Blt(dest,*Img\DDS,@*Img\left,#DDBLT_WAIT|#DDBLT_KEYSRC,0) 143 | EndSelect 144 | EndProcedure 145 | 146 | Procedure FreeDXImage(*Img.DXImage) 147 | *DDS.IDirectDrawSurface=*Img\DDS 148 | *DDS\Release() 149 | GlobalFree_(*DDS) 150 | EndProcedure 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | ;Example: 159 | OpenWindow(1,0,0,640,400,"Use DirectDraw v1.0",#PB_Window_SystemMenu|#PB_Window_ScreenCentered ) 160 | 161 | CreateGadgetList(WindowID(1)) 162 | 163 | ButtonGadget(1,0,0,100,100,"HI") 164 | 165 | ; hRGN=CreateRectRgn_(0,0,800,600) 166 | ; GetWindowRgn_(WindowID(1),@hRGN) 167 | ; Bytes=GetRegionData_(Hrgn,0,0) 168 | ; Global RGN 169 | ; RGN=GlobalAlloc_(#GMEM_FIXED,Bytes) 170 | ; GetRegionData_(Hrgn,Bytes,RGN) 171 | 172 | InitDD1() 173 | 174 | DXImage=CreateDXImage(100,100) 175 | 176 | DC=GetDXImageDC(DXImage) 177 | 178 | For X=0 To 99 179 | For Y=0 To 99 180 | SetPixelV_(DC,X,Y,RGB(X*2,Y*2,255-X*2)) 181 | Next 182 | Next 183 | 184 | ReleaseDXImageDC(DXImage,DC) 185 | 186 | Repeat 187 | DrawDXImage(WindowID(1),DXImage,Random(640),Random(400),0) 188 | 189 | Delay(10) 190 | Until WindowEvent()=#PB_Event_CloseWindow 191 | 192 | FreeDXImage(DXImage) 193 | FreeDD1() 194 | -------------------------------------------------------------------------------- /DirectDraw_1_0/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /DrawArray/DrawArray.pb: -------------------------------------------------------------------------------- 1 | ;Autor: codeprof 2 | ;Licence: Public Domain 3 | Structure BITMAPINFO_RGB 4 | bmiHeader.BITMAPINFOHEADER 5 | rgbRed.l 6 | rgbGreen.l 7 | rgbBlue.l 8 | EndStructure 9 | 10 | 11 | Procedure DrawArray(hDC,width,height,*pointer) 12 | Protected bmi.BITMAPINFO_RGB 13 | bmi\bmiHeader\biSize =SizeOf(BITMAPINFOHEADER) 14 | bmi\bmiHeader\biBitCount = 32 15 | bmi\bmiHeader\biWidth = Width 16 | bmi\bmiHeader\biHeight =-Height 17 | bmi\bmiHeader\biPlanes = 1 18 | bmi\bmiHeader\biCompression = #BI_bitfields 19 | 20 | bmi\rgbBlue = $00FF0000 21 | bmi\rgbGreen = $0000FF00 22 | bmi\rgbRed = $000000FF 23 | 24 | ProcedureReturn SetDIBitsToDevice_(hDC,0,0,Width,Height,0,0,0,Height,*pointer,@bmi,#DIB_RGB_COLORS) 25 | EndProcedure 26 | 27 | 28 | 29 | Dim Picture(255,255) 30 | 31 | For x=0 To 255 32 | For y=0 To 255 33 | Picture(y,x)=RGB(x,x,x) ;x and y are swapped here 34 | Next 35 | Next 36 | 37 | 38 | OpenWindow(1,0,0,1000,500,"DrawArray test",#PB_Window_SystemMenu) 39 | 40 | Repeat 41 | 42 | hDC = StartDrawing(WindowOutput(1)) 43 | DrawArray(hDC,256,256,@Picture(0,0)) 44 | StopDrawing() 45 | 46 | Until WindowEvent()=#PB_Event_CloseWindow 47 | -------------------------------------------------------------------------------- /DrawArray/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /FileSorter/FileSorter.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/FileSorter/FileSorter.exe -------------------------------------------------------------------------------- /FileSorter/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /FileSorter/README.md: -------------------------------------------------------------------------------- 1 | Files with the same extension are placed in the same folder. For PB-Files and images the program tries to categorize them further. 2 | Features: 3 | - for PB files it tries to detect the content (e.g. if it is a DirectX snipped or Toolbar snippet...) 4 | - Images are categorized by the size (thumb,small,medium,big,square) 5 | - MD5 is used to avoid multiple copies of the same file 6 | -------------------------------------------------------------------------------- /FileSorter/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/FileSorter/icon.ico -------------------------------------------------------------------------------- /HTMLViewer/HTML.config: -------------------------------------------------------------------------------- 1 | /WIDTH 800 /HEIGHT 600 /PROTECT /PROTECTPROCESS /STARTFILE "testData\index.html" /TITLE "Html viewer test" -------------------------------------------------------------------------------- /HTMLViewer/HTML.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/HTMLViewer/HTML.exe -------------------------------------------------------------------------------- /HTMLViewer/LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Stefan Moebius 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /HTMLViewer/icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/HTMLViewer/icon.ico -------------------------------------------------------------------------------- /HTMLViewer/source/HTML.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/HTMLViewer/source/HTML.pb -------------------------------------------------------------------------------- /HTMLViewer/testData/TextMsg.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/HTMLViewer/testData/TextMsg.exe -------------------------------------------------------------------------------- /HTMLViewer/testData/css/styling.css: -------------------------------------------------------------------------------- 1 | 2 | body { font-family:"Segoe UI",Tahoma,sans-serif,Arial; font-size:14px; color: #666; background-color: #CCC } 3 | h1 { font-family:"Segoe UI",Tahoma,sans-serif,Arial; font-weight:bolder; font-size:22px; color: #348; text-align: center; } 4 | h2 { font-family:"Segoe UI",Tahoma,sans-serif,Arial; font-weight:bolder; font-size:20px; color: #48B; } 5 | h3 { font-family:"Segoe UI",Tahoma,sans-serif,Arial; font-weight:bolder; font-size:14px; color: #333; } 6 | ul {list-style-type:none;} 7 | a:link { font-size:16px; color: #669; text-decoration:none; } 8 | a:visited { font-size:16px; color: #669; text-decoration:none; } 9 | a:active { font-size:16px; color: #49C; text-decoration:none; } 10 | a:hover { font-size:16px; color: #49C; font-style: italic; text-decoration:none; } 11 | 12 | .overview {clear:left;} 13 | .textblock {clear:left;} 14 | .rightscreenshot {padding-top: 25px; } 15 | .leftscreenshot {float: left; width: 50%; padding-right: 100px;} 16 | 17 | .playlisticons {vertical-align:middle; width: 48px; height: 48px;} 18 | .container {width: 640px; margin: auto; background-color: #FFF; padding: 10px; } -------------------------------------------------------------------------------- /HTMLViewer/testData/img/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/HTMLViewer/testData/img/screenshot.png -------------------------------------------------------------------------------- /HTMLViewer/testData/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
15 |

HTML Viewer

16 |
17 |
18 |

Screenshot

19 | Screenshot 20 |
21 | 22 |
23 |

Parameters

24 |
    25 |
  • /TITLE

    declares the text for the titlebar

  • 26 |
  • /START

    open a file from a absolute path or an URL ("http://my-domain-xyz.com")

  • 27 |
  • /STARTFILE

    open a file from a relative path("files/start.html")

  • 28 |
  • /HIDDENPROCESSES

    starts processes hidden

  • 29 |
  • /PROTECTPROCESS

    protects process against manipulation of other processes

  • 30 |
  • /WIDTH

    declares the width of the window (by default the window is opened maximized)

  • 31 |
  • /HEIGHT

    declares the height of the window (by default the window is opened maximized)

  • 32 |
  • /FULLSCREEN

    opens the window in fullscreen mode

  • 33 |
  • /STICKY

    opens the window as topmost window

  • 34 |
  • /NOSCREENSHOT

    prevents screenshots

  • 35 |
  • /NOMENU

    disables all popup menus

  • 36 |
  • /NOHOTKEYS

    disables hotkeys

  • 37 |
  • /NODRAG

    disables the drag operations

  • 38 |
  • /PROTECT

    Combination of /NOSCREENSHOT, /NOMENU, /NOHOTKEYS and /NODRAG

  • 39 |
  • /NORESIZE

    do not allow to resize the window

  • 40 |
41 | 42 |
43 |

Additional protocols

44 |
    45 |
  • exec://...

    executes a file. The placeholders %25CURRENT_DIR%25, %25EXE_DIR%25, %25TEMP_DIR%25", %25HOME_DIR%25" and %25SYSTEM_DIR%25" can be used. With exec://close the program gets closed, with exec://toggle the fullscreen mode is toggled.

  • 46 |
  • execc://

    The same as exec:// but always closes the application afterwards.

  • 47 |
48 | 49 |
50 |

Test cases

51 |
    52 |
  • 53 |

    Execute EXE file with parameter

    MessageBox

    54 |
  • 55 |
  • 56 |

    Execute VBS file

    test

    57 |
  • 58 |
  • 59 |

    Execute VBS file and close

    test

    60 |
  • 61 |
  • 62 |

    close

    close

    63 |
  • 64 |
  • 65 |

    toggle Fullscreen

    toggle

    66 |
  • 67 |
  • 68 |

    open seperate browser

    open

    69 |
  • 70 |
  • 71 |

    open home directory

    open

    72 |
  • 73 |
74 |

 

75 |
76 |
77 | 78 | -------------------------------------------------------------------------------- /HTMLViewer/testData/test.vbs: -------------------------------------------------------------------------------- 1 | MsgBox("This is a test.") -------------------------------------------------------------------------------- /IconMod/LICENCE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Stefan Moebius 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /IconMod/README.md: -------------------------------------------------------------------------------- 1 | # IconMod 2 | small console tool to add/remove icons in EXE files 3 | 4 | IconMod adds and removes Icon groups (.ico files) from Windows Executables. 5 | 6 | Features: 7 | - supports 32- and 64-Bit Executables 8 | - list existing icon groups 9 | - add new icon groups 10 | - remove existing icon groups 11 | -------------------------------------------------------------------------------- /IconMod/bin/IconMod.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/IconMod/bin/IconMod.exe -------------------------------------------------------------------------------- /IconMod/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/IconMod/logo.png -------------------------------------------------------------------------------- /IconMod/src/source.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/IconMod/src/source.zip -------------------------------------------------------------------------------- /IconMod/test/IconMod.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/IconMod/test/IconMod.exe -------------------------------------------------------------------------------- /IconMod/test/sample.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/IconMod/test/sample.ico -------------------------------------------------------------------------------- /IconMod/test/test.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | echo Adding icon to test32bit.exe... 4 | pause 5 | IconMod.exe test32bit.exe /ADD MAINICON /ICON sample.ico 6 | echo showing icon groups of test32bit.exe... 7 | IconMod.exe test32bit.exe /NAMES 8 | pause 9 | echo Remove icon from test32bit.exe... 10 | pause 11 | IconMod.exe test32bit.exe /REMOVE MAINICON 12 | echo showing icon groups of test32bit.exe... 13 | IconMod.exe test32bit.exe /NAMES 14 | pause 15 | 16 | 17 | echo "Adding icon to test64bit.exe..." 18 | pause 19 | IconMod.exe test64bit.exe /ADD "1" /ICON sample.ico 20 | echo "Remove icon from test64bit.exe..." 21 | pause 22 | IconMod.exe test64bit.exe /REMOVE "1" 23 | pause 24 | 25 | -------------------------------------------------------------------------------- /IconMod/test/test32bit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/IconMod/test/test32bit.exe -------------------------------------------------------------------------------- /IconMod/test/test64bit.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/IconMod/test/test64bit.exe -------------------------------------------------------------------------------- /Image denoising/Image_denoising_soft.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/Image denoising/Image_denoising_soft.exe -------------------------------------------------------------------------------- /Image denoising/Image_denoising_strong.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/Image denoising/Image_denoising_strong.exe -------------------------------------------------------------------------------- /Image denoising/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /Image sharpening/Image_sharpening.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/Image sharpening/Image_sharpening.exe -------------------------------------------------------------------------------- /Image sharpening/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /ImageChecksum/ImageChecksum.pb: -------------------------------------------------------------------------------- 1 | ;AUTHOR: codeprof 2 | ;LICENSE: PUBLIC DOMAIN (can be used without any restriction) 3 | 4 | Procedure.s ImageChecksum(image) 5 | Protected Dim v.i(7,7,1,1) 6 | Protected img, x, y, c, checksum.s = "" 7 | img = CopyImage(image,#PB_Any) 8 | If IsImage(img) 9 | ResizeImage(img, 64, 64, #PB_Image_Smooth) 10 | 11 | StartDrawing(ImageOutput(img)) 12 | For x = 0 To 63 13 | For y = 0 To 63 14 | c = Point(x,y) 15 | v(x >> 3,y >> 3, (x >> 2) & 1 , (y >> 2) & 1 ) + (Red(c) * 3) + (Green(c) * 6) + Blue(c) 16 | Next 17 | Next 18 | StopDrawing() 19 | For x=0 To 7 20 | For y=0 To 7 21 | ;+- 22 | ;+- 23 | If (v(x,y,0,0) + v(x,y,0,1)) - (v(x,y,1,0) + v(x,y,1,1)) > 0 24 | checksum + "1" 25 | Else 26 | checksum + "0" 27 | EndIf 28 | ;++ 29 | ;-- 30 | If (v(x,y,0,0) + v(x,y,1,0)) - (v(x,y,0,1) + v(x,y,1,1)) >= 0 31 | checksum + "1" 32 | Else 33 | checksum + "0" 34 | EndIf 35 | ;+- 36 | ;-+ 37 | If (v(x,y,0,0) + v(x,y,1,1)) - (v(x,y,0,1) + v(x,y,1,0)) >= 0 38 | checksum + "1" 39 | Else 40 | checksum + "0" 41 | EndIf 42 | Next 43 | Next 44 | FreeImage(img) 45 | EndIf 46 | ProcedureReturn checksum 47 | EndProcedure 48 | 49 | Procedure ImageChecksumError(checksum1.s, checksum2.s) 50 | Protected error = 0 51 | For i = 1 To 192 52 | If Mid(checksum1, i, 1) <> Mid(checksum2, i, 1):error+1:EndIf 53 | Next 54 | ProcedureReturn error 55 | EndProcedure 56 | 57 | 58 | 59 | 60 | ;Example: 61 | 62 | UseJPEGImageDecoder() 63 | 64 | 65 | LoadImage(1,"J:\image1.jpg") 66 | LoadImage(2,"J:\image2.jpg") 67 | 68 | Debug ImageChecksum(1) 69 | Debug ImageChecksum(2) 70 | 71 | If ImageChecksumError(ImageChecksum(1),ImageChecksum(2)) <= 8 72 | Debug "Pictures are similar" 73 | Else 74 | Debug "Pictures are not similar" 75 | EndIf 76 | -------------------------------------------------------------------------------- /ImageChecksum/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /ImageChecksum/README.md: -------------------------------------------------------------------------------- 1 | Tiny procedure to check if two images are similar. 2 | It returns a 192 Bit checksum which can be compared to other checksums. 3 | In contrast to a "normal" checksum(hash) this procedure will return a similar checksum if the two images are similar. 4 | The two images can have different sizes,quality, brightness, contrast, saturation, tinit, noise and will be still considered as the same or similar (only a few bits change). 5 | Not supported at the moment is rotation and horz./vert. flip. 6 | -------------------------------------------------------------------------------- /Interpreter/interpreter_v2.pb: -------------------------------------------------------------------------------- 1 | 2 | 3 | Procedure eval(*line, begin, depth, num) 4 | org_num = num 5 | pos=begin 6 | While #True 7 | 8 | If pos <= MemoryStringLength(*line)*2-2 9 | ch.s = PeekS(*line+pos,1,#PB_Unicode) 10 | Else 11 | ch.s ="" 12 | EndIf 13 | pos=pos + 2 14 | If Len(ch) = 0 15 | Break 16 | EndIf 17 | 18 | If ch = ")" 19 | If depth < 1 20 | Debug "missing begin bracket" 21 | EndIf 22 | Debug "append to L"+Str(depth)+"_"+Str(org_num) +" : "+PeekS(*line+begin, (pos-begin)/2-1) 23 | 24 | ProcedureReturn pos 25 | ElseIf ch = "(" 26 | lastpos = pos 27 | 28 | num=num+1 29 | pos = eval(*line, pos,depth+1,num) 30 | Debug "append to L"+Str(depth)+"_"+Str(org_num) +" : "+PeekS(*line+begin, (lastpos-begin)/2-1) + "L"+Str(depth+1)+"_"+Str(num) 31 | 32 | ;Debug "INSERT stack"+Str(depth+1) 33 | continueX = 1 34 | ; CURR$ + "{"+PeekS(*line+lastpos,(pos-lastpos)/2-1)+"}" 35 | begin=pos 36 | EndIf 37 | Wend 38 | If depth > 0 39 | Debug "missig end bracket" 40 | EndIf 41 | ProcedureReturn pos 42 | EndProcedure 43 | 44 | 45 | 46 | Debug eval(@"(a+b-d*-f+(b*h)+z)*(c-d)/(x)",0, 0,0) 47 | -------------------------------------------------------------------------------- /MD5Checker/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /MD5Checker/MD5Checker.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/MD5Checker/MD5Checker.exe -------------------------------------------------------------------------------- /MD5Checker/README.md: -------------------------------------------------------------------------------- 1 | Just a small tool to create a list of MD5 checksums of a directory (and subdirectories). 2 | The checksum can be vailidated later to see if one of the files was modified. 3 | The tool shows an error if there are corrupt sectors in a file (e.g. for defect hard drives). 4 | -------------------------------------------------------------------------------- /Media-Combiner/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /Media-Combiner/Media-Combiner.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/Media-Combiner/Media-Combiner.exe -------------------------------------------------------------------------------- /Media-Combiner/Media-Combiner.pb: -------------------------------------------------------------------------------- 1 | 2 | Dim file.s(3000) 3 | 4 | If OpenWindow(0, 0, 0, 420, 100, "Media-Combiner", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 5 | ButtonGadget(0, 10, 10, 200, 80, "Transport Stream") 6 | ButtonGadget(1, 210, 10, 200, 80, "MPEG") 7 | Repeat 8 | ev = WaitWindowEvent() 9 | 10 | If ev=#PB_Event_Gadget 11 | If EventGadget()= 0 12 | name.s = "Transport Stream" 13 | ending.s = ".ts" 14 | ending2.s = ".ts" 15 | do = #True 16 | EndIf 17 | If EventGadget()= 1 18 | name.s = "MPEG video" 19 | ending.s = ".mpg;*.mpeg" 20 | ending2.s = ".mpg" 21 | do=#True 22 | EndIf 23 | 24 | EndIf 25 | 26 | If ev = #PB_Event_CloseWindow 27 | End 28 | EndIf 29 | 30 | Until do 31 | CloseWindow(0) 32 | EndIf 33 | 34 | do=0 35 | 36 | If OpenWindow(0, 0, 0, 422, 200, name+"-Combiner", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 37 | ButtonGadget(0, 10, 10, 100, 20, "Add...") 38 | ButtonGadget(1, 110, 10, 100, 20, "Create") 39 | ListViewGadget(2,10,30,400,170) 40 | Repeat 41 | ev = WaitWindowEvent() 42 | 43 | If ev=#PB_Event_Gadget 44 | If EventGadget()= 0 45 | 46 | File$ = OpenFileRequester("select file", "", name.s+" (*"+ending+")|*"+ending+"|Alle Dateien (*.*)|*.*",0) 47 | If FileSize(File$) > 0 48 | AddGadgetItem(2,-1,GetFilePart(File$)) 49 | file(index)= File$ 50 | index +1 51 | EndIf 52 | 53 | EndIf 54 | If EventGadget()= 1 55 | 56 | File$ = SaveFileRequester("save file", "", name.s+" (*"+ending+")|*"+ending+"|Alle Dateien (*.*)|*.*",0) 57 | 58 | If GetExtensionPart(File$) ="":File$ + ending2:EndIf 59 | 60 | If FileSize(File$) < 0 61 | If CreateFile(1,File$) 62 | do=#True 63 | EndIf 64 | Else 65 | MessageRequester("Error","File already exists!") 66 | EndIf 67 | EndIf 68 | 69 | EndIf 70 | 71 | If ev = #PB_Event_CloseWindow 72 | End 73 | EndIf 74 | 75 | Until do 76 | EndIf 77 | 78 | *buffer=AllocateMemory($FFFFF+1024) 79 | 80 | For i=0 To index-1 81 | If ReadFile(2,file(i))=0 82 | MessageRequester("Error", "Cannot open file "+file(i)) 83 | End 84 | EndIf 85 | 86 | 87 | ges.q = Lof(2) 88 | Repeat 89 | 90 | If ges => $FFFF 91 | ReadData(2,*buffer,$FFFF) 92 | WriteData(1,*buffer,$FFFF) 93 | ges - $FFFF 94 | Else 95 | 96 | ReadData(2,*buffer,ges) 97 | WriteData(1,*buffer,ges) 98 | ges=0 99 | EndIf 100 | 101 | Repeat 102 | ev = WindowEvent() 103 | If ev=#PB_Event_CloseWindow 104 | End 105 | EndIf 106 | Until ev=0 107 | counter + 1 108 | If counter > 20 109 | counter = 0 110 | counter2 + 1 111 | counter2 % 4 112 | SetWindowTitle(0, "Please wait" + LSet("",counter2,".")) 113 | EndIf 114 | 115 | Until ges = 0 116 | 117 | CloseFile(2) 118 | Next 119 | 120 | CloseFile(1) 121 | 122 | ; IDE Options = PureBasic 4.60 Beta 2 (Windows - x86) 123 | ; CursorPosition = 92 124 | ; FirstLine = 68 125 | ; EnableXP 126 | ; Executable = Media-Combiner.exe -------------------------------------------------------------------------------- /Overlay/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /PBTicTacToe/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /PBTicTacToe/Logo.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/PBTicTacToe/Logo.bmp -------------------------------------------------------------------------------- /PBTicTacToe/LogoMask.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/PBTicTacToe/LogoMask.bmp -------------------------------------------------------------------------------- /PBTicTacToe/O.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/PBTicTacToe/O.bmp -------------------------------------------------------------------------------- /PBTicTacToe/OMask.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/PBTicTacToe/OMask.bmp -------------------------------------------------------------------------------- /PBTicTacToe/PBTicTacToe.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/PBTicTacToe/PBTicTacToe.exe -------------------------------------------------------------------------------- /PBTicTacToe/TTT4.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/PBTicTacToe/TTT4.pb -------------------------------------------------------------------------------- /PBTicTacToe/X.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/PBTicTacToe/X.bmp -------------------------------------------------------------------------------- /PBTicTacToe/XMask.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/PBTicTacToe/XMask.bmp -------------------------------------------------------------------------------- /PasswordGen/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /PasswordGen/PasswordGen.pb: -------------------------------------------------------------------------------- 1 | ;================================================================================================================================ 2 | ;SUBJECT: A small snippet to generate different types of passwords 3 | ;AUTHOR: codeprof 4 | ;LICENSE: PUBLIC DOMAIN (can be used without any restriction) 5 | ; This software is provided 'as-is', without any express or implied warranty. 6 | ; In the author cannot be held liable for any damages arising from the use of this software. 7 | ; Use this software at your own risk. 8 | ;DATE: 2013-03-10 9 | ;================================================================================================================================ 10 | Procedure.s GenerateReadablePassword(length.i = 6) 11 | Protected i, password.s = "" 12 | vocs.s = "aeiou" 13 | cons.s = "bcdfghjklmnpqrstvwxyz" 14 | If OpenCryptRandom() 15 | For i = 0 To length-1 16 | If i & 1 17 | password.s + Mid(vocs, CryptRandom(Len(vocs) - 1) + 1, 1) 18 | Else 19 | password.s + Mid(cons, CryptRandom(Len(cons) - 1) + 1, 1) 20 | EndIf 21 | Next 22 | CloseCryptRandom() 23 | EndIf 24 | ProcedureReturn password 25 | EndProcedure 26 | 27 | Procedure.s GenerateRandomPassword(length.i = 30, allowedChars.s = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$&§!?%*+-_") 28 | Protected i, password.s = "" 29 | If OpenCryptRandom() 30 | For i = 0 To length - 1 31 | password.s + Mid(allowedChars, CryptRandom(Len(allowedChars) - 1) + 1, 1) 32 | Next 33 | CloseCryptRandom() 34 | EndIf 35 | ProcedureReturn password 36 | EndProcedure 37 | 38 | Procedure.s GeneratePassphrasePassword(length.i = 25, allowedSpecialChars.s = "$&§!?%*+-_") 39 | Protected password.s = "" 40 | While (Len(password) < length) 41 | password + GenerateReadablePassword(4) + " " 42 | password + GenerateRandomPassword(4, "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + allowedSpecialChars) + " " 43 | Wend 44 | 45 | password = Trim(Left(password, length)) 46 | allowedSpecialChars = ReplaceString(allowedSpecialChars, " ", "") 47 | password + GenerateRandomPassword(length - Len(password), "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + allowedSpecialChars) 48 | ProcedureReturn password 49 | EndProcedure 50 | 51 | 52 | For t=0 To 24 53 | Debug GenerateReadablePassword() 54 | Next 55 | 56 | For t=0 To 24 57 | Debug GenerateRandomPassword() 58 | Next 59 | 60 | For t = 0 To 24 61 | Debug GeneratePassphrasePassword() 62 | Next 63 | -------------------------------------------------------------------------------- /Promillerechner/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /Promillerechner/Promillerechner.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/Promillerechner/Promillerechner.exe -------------------------------------------------------------------------------- /Promillerechner/Promillerechner.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/Promillerechner/Promillerechner.pb -------------------------------------------------------------------------------- /QRandom/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /QRandom/QRandom.pb: -------------------------------------------------------------------------------- 1 | ;================================================================================================================================ 2 | ;SUBJECT: Generating random numbers with a string as seed 3 | ; This should fill the gap between Random() and CryptRandom() 4 | ;AUTHOR: codeprof 5 | ;LICENSE: PUBLIC DOMAIN (can be used without any restriction) 6 | ; This software is provided 'as-is', without any express or implied warranty. 7 | ; In the author cannot be held liable for any damages arising from the use of this software. 8 | ; Use this software at your own risk. 9 | ;DATE: 2013-03-23 10 | ;================================================================================================================================ 11 | 12 | ;Advantages: 13 | ; - String can be used as seed! 14 | ; - more secure than Random() 15 | ; - configurable whether it should be fast or more secure 16 | ; - supports Unicode (and returns the same values like in ANSI mode) 17 | ; - support for quad random numbers (up to 63 bits instead of 31 bits with Random()) 18 | ; - works for Windows, Linux and MacOSX 19 | 20 | ;Disadvantages: 21 | ; - probably not as secure as CryptRandom() 22 | ; - not thread safe ( as the "Threaded" keyword of PureBasic cannot be used inside procedures 23 | ; To make it thread safe move the "Static" variables outside of the procedure as 24 | ; global variables and use the "Threaded" keyword) 25 | 26 | 27 | 28 | ;================================================================================================================================ 29 | ;Initializes the random number generator with an seed string. 30 | ;Parameters: 31 | ; seed : string with which the random number generator is initialized (max 128 chars) 32 | ; num_iterations [optional] : Number of times the result should be hashed with MD5 33 | ; The result should be at least hashed once for security reason (prevents known plaintext attacks...) 34 | ; If security is not important "num_iterations" can be set to 0 to improve performace. 35 | ; A high number will result in very slow number generation. 36 | ; This could be used to prevent timing attacks (make brute force attacks harder). 37 | ;================================================================================================================================ 38 | Procedure.q QRandomSeed(seed.s, num_iterations.i = 1) 39 | Static Dim key.q(1) 40 | Static Dim current.q(1) 41 | Static Dim tmp.q(1) 42 | Static num_md5_iterations = 0 43 | Protected md5.s, i.i 44 | If seed <> "" 45 | ;Initalize random number generator 46 | Protected Dim seed_string.UNICODE(127 + 1) 47 | PokeS(@seed_string(0), Left(seed,128), 128, #PB_Unicode) 48 | ;We use the MD5 of "seed.s" to generate a 128 bit key. 49 | md5.s = MD5Fingerprint(@seed_string(0), SizeOf(UNICODE) * 128) 50 | key(0) = Val("$" + Left(md5, 16)) 51 | key(1) = Val("$" + Right(md5, 16)) 52 | ;The MD5 of the MD5 is used here so it is not possible to restore the key out of it (as reverting the MD5 is not possible). 53 | ;MD5(seed)+seed is used to reduce the chance for a collision, because it is much harder to find a string 54 | ;which returns a correct result for MD5(seed) and MD5(MD5(seed)+seed). 55 | PokeS(@seed_string(0), Left(md5 + seed, 128), 128, #PB_Unicode) 56 | md5.s = MD5Fingerprint(@seed_string(0), SizeOf(UNICODE) * 128) 57 | current(0) = Val("$" + Left(md5, 16)) 58 | current(1) = Val("$" + Right(md5, 16)) 59 | num_md5_iterations = num_iterations 60 | Else 61 | ;generate the next random number 62 | AESEncoder(@current(0), @tmp(0), 128 / 8, @key(0), 128, #Null, #PB_Cipher_ECB) 63 | CopyMemory(@tmp(0), @current(0), 128 / 8) 64 | ;To prevent short cycles we increment the 128 bit key by 1. 65 | key(0) + 1 66 | If key(0) = 0:key(1) + 1:EndIf 67 | ;hash the result with MD5 68 | For i = 1 To num_md5_iterations 69 | md5.s = MD5Fingerprint(@tmp(0), 16) 70 | tmp(0) = Val("$" + Left(md5, 16)) 71 | tmp(1) = Val("$" + Right(md5, 16)) 72 | Next 73 | EndIf 74 | ProcedureReturn tmp(0) ! tmp(1) 75 | EndProcedure 76 | 77 | 78 | ;================================================================================================================================ 79 | ;Random number between "min" and "max" (including "min" and "max") 80 | ;The functions supports random numbers up to 63 bits. 81 | ; max : maximum number (must be greater than "min") 82 | ; min : minimum number (must be less than "max") 83 | ;================================================================================================================================ 84 | Procedure.q QRandom(max.q, min.q = 0) 85 | Protected val.q = QRandomSeed("") & $7FFFFFFFFFFFFFFF 86 | val = val % ( max - min + 1) 87 | ProcedureReturn val + min 88 | EndProcedure 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | ;Example 97 | 98 | QRandomSeed("MY TOP SECRET MASTER PASSWORD", 100) 99 | For j = 1 To 10 100 | 101 | passwd$ = "" 102 | For i = 0 To 30 103 | passwd$ + Chr(QRandom(126,33)) 104 | Next 105 | 106 | Debug "Password("+Str(j)+"): " + passwd$ 107 | Next 108 | -------------------------------------------------------------------------------- /QuadBlt/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /QuadBlt/QuadBlt.pb: -------------------------------------------------------------------------------- 1 | Structure QUADBLT_VERTEX 2 | x.l 3 | y.l 4 | EndStructure 5 | 6 | Structure QUADBLT_QUAD 7 | v.QUADBLT_VERTEX[4] 8 | EndStructure 9 | 10 | Structure QUADBLT_TRIANGLE 11 | v.QUADBLT_VERTEX[3] 12 | EndStructure 13 | 14 | Procedure QuadBlt(hdcDest.l,*points.QUADBLT_QUAD,hdcSrc.l,lXSrc.l,lYSrc.l,lWidth.l,lHeight.l) 15 | 16 | 17 | If hdcDest=0 Or *points=0 Or hdcSrc=0 18 | ProcedureReturn #False 19 | EndIf 20 | 21 | GetClipBox_(hdcSrc,clipbox.rect) 22 | If lXSrc+lWidth>clipbox\right-clipbox\left Or lYSrc+lHeight>clipbox\bottom-clipbox\top Or lXSrc<0 Or lYSrc<0 Or lWidth<=0 Or lHeight<=0 23 | ProcedureReturn #False 24 | EndIf 25 | rectrgn=CreateRectRgn_(clipbox\left,clipbox\top,clipbox\right,clipbox\bottom) 26 | lResult=GetClipRgn_(hdcDest,rectrgn) 27 | If lResult=-1 Or rectrgn=0 28 | ProcedureReturn #False 29 | EndIf 30 | 31 | Triangle2.QUADBLT_TRIANGLE 32 | Triangle2\v[0]\x=*points\v[3]\x 33 | Triangle2\v[0]\y=*points\v[3]\y 34 | Triangle2\v[1]\x=*points\v[2]\x 35 | Triangle2\v[1]\y=*points\v[2]\y 36 | Triangle2\v[2]\x=*points\v[1]\x 37 | Triangle2\v[2]\y=*points\v[1]\y 38 | 39 | rgntriangle1=CreatePolygonRgn_(*points,3,1) 40 | rgntriangle2=CreatePolygonRgn_(Triangle2,3,1) 41 | 42 | If lResult<>0 43 | CombineRgn_(rgntriangle1,rgntriangle1,rectrgn,#RGN_AND) 44 | CombineRgn_(rgntriangle2,rgntriangle2,rectrgn,#RGN_AND) 45 | EndIf 46 | 47 | lOldStretchBltMode=SetStretchBltMode_(hdcDest,#COLORONCOLOR) 48 | 49 | SelectClipRgn_(hdcDest,rgntriangle1) 50 | PlgBlt_(hdcDest,*points,hdcSrc,lXSrc,lYSrc,lWidth,lHeight,0,0,0) 51 | 52 | SelectClipRgn_(hdcDest,rgntriangle2) 53 | PlgBlt_(hdcDest,Triangle2,hdcSrc,lWidth+lXSrc,lHeight+lYSrc,-lWidth,-lHeight,0,0,0) 54 | 55 | SetStretchBltMode_(hdcDest,lOldStretchBltMode) 56 | 57 | ;If lResult=0 58 | SelectClipRgn_(hdcDest,0) 59 | ;Else 60 | ;SelectClipRgn_(hdcDest,rectrgn) 61 | ;EndIf 62 | 63 | DeleteObject_(rectrgn) 64 | DeleteObject_(rgntriangle1) 65 | DeleteObject_(rgntriangle2) 66 | EndProcedure 67 | 68 | 69 | 70 | Dim pt.point(3) 71 | 72 | 73 | OpenWindow(1,0,0,900,900,"TEST") 74 | LoadImage(1,"d:\test.bmp") 75 | 76 | MemDC=CreateCompatibleDC_(0) 77 | SelectObject_(MemDC,ImageID(1)) 78 | 79 | DC=StartDrawing(WindowOutput(1)) 80 | 81 | pt(0)\x=70 82 | pt(0)\y=300 83 | 84 | pt(1)\x=400 85 | pt(1)\y=300 86 | 87 | pt(2)\x=400 88 | pt(2)\y=580 89 | 90 | pt(3)\x=900 91 | pt(3)\y=700 92 | 93 | QuadBlt(DC,@pt(),MemDC,0,0,ImageWidth(1),ImageHeight(1)) 94 | StopDrawing() 95 | DeleteDC_(MemDC) 96 | 97 | Repeat 98 | Until WindowEvent()=#WM_CLOSE 99 | -------------------------------------------------------------------------------- /RecursiveCopy/CheckForPossibleCopyFail.pb: -------------------------------------------------------------------------------- 1 | ;License: Public Domain 2 | CompilerIf #PB_Compiler_Unicode = 0 3 | CompilerError "Should be compiled with Unicode support!" 4 | CompilerEndIf 5 | 6 | Global from.s, destination.s 7 | 8 | Procedure.s Fit(dir.s) 9 | If Right(dir,1)<> "\" 10 | dir = dir + "\" 11 | EndIf 12 | ProcedureReturn dir 13 | EndProcedure 14 | 15 | 16 | Global Dim test.b(1000000) 17 | 18 | Procedure add_files(dir.s) 19 | If Len(dir.s) < #MAX_PATH 20 | id = ExamineDirectory(#PB_Any, dir, "*.*") 21 | If id <> 0 22 | While NextDirectoryEntry(id) 23 | FileName$ = DirectoryEntryName(id) 24 | If DirectoryEntryType(id) = #PB_DirectoryEntry_Directory 25 | If DirectoryEntryName(id) <> "." And DirectoryEntryName(id) <> ".." 26 | add_files(Fit(dir) + DirectoryEntryName(id)) 27 | EndIf 28 | EndIf 29 | If DirectoryEntryType(id) = #PB_DirectoryEntry_File 30 | 31 | file.s = Fit(dir.s)+ DirectoryEntryName(id) 32 | 33 | If FileSize(file) >= 1000000 34 | 35 | SetGadgetText(1, file) 36 | Repeat 37 | ev = WindowEvent() 38 | If ev = #PB_Event_CloseWindow:End:EndIf 39 | Until ev=0 40 | 41 | ok = #False 42 | ReadFile(1,file) 43 | FileSeek(1,Lof(1)-1000000) 44 | ReadData(1, @test(), 1000000) 45 | For i = 0 To 999999 46 | If test(i) <> 0:ok = #True:EndIf 47 | Next 48 | CloseFile(1) 49 | If ok = #False 50 | MessageRequester("info","Maybe copy error: " + file) 51 | EndIf 52 | EndIf 53 | 54 | If FileSize(destination + "STOP.TXT") >=0 55 | End 56 | EndIf 57 | 58 | Repeat 59 | ev = WindowEvent() 60 | If ev = #PB_Event_CloseWindow:End:EndIf 61 | Until ev=0 62 | 63 | EndIf 64 | Wend 65 | FinishDirectory(id) 66 | Else 67 | MessageRequester("","ERROR: failed To List directory: '" + dir.s + "'") 68 | EndIf 69 | Else 70 | MessageRequester("","WARN: path '" + dir.s + "' is IGNORED because it is too long.") 71 | EndIf 72 | EndProcedure 73 | 74 | OpenWindow(1,0,0,800,60,"") 75 | TextGadget(1,0,0,800,60,"") 76 | 77 | destination.s = Fit(InputRequester("","Folder to check","")) 78 | 79 | SetWindowTitle(1,"check " +destination) 80 | 81 | add_files(destination) 82 | 83 | 84 | 85 | ; IDE Options = PureBasic 5.11 beta 3 (Windows - x86) 86 | ; CursorPosition = 45 87 | ; FirstLine = 21 88 | ; Folding = - 89 | ; EnableUnicode 90 | ; EnableXP -------------------------------------------------------------------------------- /RecursiveCopy/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /RecursiveCopy/RecursiveCopy.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/RecursiveCopy/RecursiveCopy.exe -------------------------------------------------------------------------------- /RecursiveCopy/RecursiveCopy5.pb: -------------------------------------------------------------------------------- 1 | ;License: Public Domain 2 | CompilerIf #PB_Compiler_Unicode = 0 3 | CompilerError "Should be compiled with Unicode support!" 4 | CompilerEndIf 5 | 6 | 7 | Global from.s, destination.s,exts.s, idstr.s 8 | 9 | idstr.s = Hex(GetTickCount_()) 10 | 11 | Procedure.s Fit(dir.s) 12 | If Right(dir,1)<> "\" 13 | dir = dir + "\" 14 | EndIf 15 | ProcedureReturn dir 16 | EndProcedure 17 | 18 | Procedure Logv(text.s) 19 | OpenFile(1,GetTemporaryDirectory() + "recursive-copy-log"+idstr.s+".txt") 20 | FileSeek(1,Lof(1)) 21 | WriteStringN(1,text.s) 22 | CloseFile(1) 23 | EndProcedure 24 | 25 | Procedure add_files(dir.s) 26 | If Len(dir.s) < #MAX_PATH 27 | id = ExamineDirectory(#PB_Any, dir, "*.*") 28 | If id <> 0 29 | While NextDirectoryEntry(id) 30 | FileName$ = DirectoryEntryName(id) 31 | If DirectoryEntryType(id) = #PB_DirectoryEntry_Directory 32 | If DirectoryEntryName(id) <> "." And DirectoryEntryName(id) <> ".." 33 | add_files(Fit(dir) + DirectoryEntryName(id)) 34 | EndIf 35 | EndIf 36 | If DirectoryEntryType(id) = #PB_DirectoryEntry_File 37 | 38 | file.s = Fit(dir.s)+ DirectoryEntryName(id) 39 | dst_real.s = destination + Right(file, Len(file) - Len(from)) 40 | dst.s = dst_real.s + ".$$_TMP_$$" 41 | 42 | Debug file 43 | 44 | 45 | 46 | If FindString(exts,"," + UCase(GetExtensionPart(file)) + ",") Or exts="" 47 | Debug "y" 48 | If FileSize(file) >= 0 49 | If FileSize(file) <> FileSize(dst_real.s) 50 | 51 | If FileSize(dst_real.s) >=0 52 | Logv( dst+ " has other size" + Str(FileSize(dst))) 53 | EndIf 54 | SetGadgetText(1, file) 55 | 56 | ; CreateFile(100, destination + "last.log") 57 | ; WriteStringN(100,file + "->" + dst) 58 | ; FlushFileBuffers(100) 59 | ; CloseFile(100) 60 | Repeat 61 | ev = WindowEvent() 62 | If ev = #PB_Event_CloseWindow:End:EndIf 63 | Until ev=0 64 | 65 | SHCreateDirectory_(#Null, GetPathPart(dst)) 66 | If CopyFile(file, dst) = #False 67 | Logv("failed to copy:"+ file + " -->" + dst.s) 68 | Else 69 | If RenameFile(dst, dst_real.s) = #False 70 | Logv("failed to rename:"+ dst + " -->" + dst_real.s) 71 | EndIf 72 | EndIf 73 | Else 74 | Debug "ALREADY:" + file 75 | EndIf 76 | EndIf 77 | EndIf 78 | 79 | If FileSize(destination + "STOP.TXT") >=0 80 | End 81 | EndIf 82 | 83 | Repeat 84 | ev = WindowEvent() 85 | If ev = #PB_Event_CloseWindow:End:EndIf 86 | Until ev=0 87 | 88 | EndIf 89 | Wend 90 | FinishDirectory(id) 91 | Else 92 | ;MessageRequester("","ERROR: failed To List directory: '" + dir.s + "'") 93 | Logv("ERROR: failed To List directory: '" + dir.s + "'") 94 | EndIf 95 | Else 96 | Logv("WARN: path '" + dir.s + "' is IGNORED because it is too long.") 97 | ;MessageRequester("","WARN: path '" + dir.s + "' is IGNORED because it is too long.") 98 | EndIf 99 | EndProcedure 100 | 101 | OpenWindow(1,0,0,800,60,"") 102 | TextGadget(1,0,0,800,60,"") 103 | 104 | 105 | from.s = Fit(InputRequester("","Folder to copy files from","")) 106 | 107 | destination.s = Fit(InputRequester("","Folder to copy files to","")) 108 | 109 | exts.s = UCase(Trim(InputRequester("","Extensions (Empty For all Files)","MP4,MPG,MPEG,OGV,FLV,3GP,F4V,MKV,TS,MTS"))) 110 | If exts <> "" 111 | exts = "," + exts + "," 112 | EndIf 113 | 114 | MessageRequester("Hint","Put a file with name 'STOP.TXT'"+Chr(13)+" into the destination path to stop the process!") 115 | 116 | SetWindowTitle(1,from +" -> " + destination) 117 | 118 | add_files(from) 119 | 120 | MessageRequester("done", "done with " + from.s) 121 | 122 | 123 | ; IDE Options = PureBasic 5.21 LTS (Windows - x86) 124 | ; CursorPosition = 114 125 | ; Folding = - 126 | ; EnableUnicode 127 | ; EnableThread 128 | ; EnableXP 129 | ; EnableOnError 130 | ; Executable = RecursiveCopy5.exe -------------------------------------------------------------------------------- /RegSvr32User/LICENCE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Stefan Moebius 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /RegSvr32User/README.md: -------------------------------------------------------------------------------- 1 | # RegSvr32User 2 | A small tool to register Windows-DLL per User (without needing admin-rights) 3 | -------------------------------------------------------------------------------- /RegSvr32User/bin/RegSvr32User.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/RegSvr32User/bin/RegSvr32User.exe -------------------------------------------------------------------------------- /RegSvr32User/bin/test.bat: -------------------------------------------------------------------------------- 1 | RegSvr32User.exe -extractsource 2 | pause 3 | -------------------------------------------------------------------------------- /RegSvr32User/src/Icon-Database.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/RegSvr32User/src/Icon-Database.ico -------------------------------------------------------------------------------- /RegSvr32User/src/RegSvr32Admin.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/RegSvr32User/src/RegSvr32Admin.exe -------------------------------------------------------------------------------- /RegSvr32User/src/RegSvr32User-Source.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/RegSvr32User/src/RegSvr32User-Source.zip -------------------------------------------------------------------------------- /RegSvr32User/src/RegSvr32User.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/RegSvr32User/src/RegSvr32User.pb -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/1.bmp -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/2.bmp -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Fast3DSprites/Sprite3DFast.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/Fast3DSprites/Sprite3DFast.exe -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Fast3DSprites/Sprite3DFast.pb: -------------------------------------------------------------------------------- 1 | IncludeFile "Sprite3DFast_inc.pbi" 2 | 3 | 4 | InitSprite() 5 | InitSprite3D() 6 | 7 | 8 | OpenWindow(1,0,0,640,480,"Fast 3D-Sprites",#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_SystemMenu) 9 | OpenWindowedScreen(WindowID(1),0,0,640,480,0,0,0) 10 | 11 | CreateSprite(1,16,16,#PB_Sprite_Texture) 12 | 13 | StartDrawing(SpriteOutput(1)) 14 | Box(0,0,64,64,#Green) 15 | StopDrawing() 16 | 17 | 18 | 19 | 20 | Start3D() 21 | result=S3D_InitS3DFast() 22 | If result:Stop3D():CloseScreen():MessageRequester("ERROR","Can't render with current blending operations!"):End:EndIf 23 | 24 | Stop3D() 25 | CreateSprite3D(1,1) 26 | 27 | 28 | Repeat 29 | 30 | ClearScreen(0) 31 | 32 | 33 | 34 | Start=GetTickCount_() 35 | Start3D() 36 | S3D_StartFast() 37 | For c=0 To 500000 38 | S3D_DisplaySprite3DFast(1,Random(640),Random(480),5) 39 | Next 40 | S3D_StopFast() 41 | Stop3D() ; Make sure, that everything has been rendered. 42 | NeededTime=GetTickCount_()-Start 43 | 44 | 45 | Start=GetTickCount_() 46 | Start3D() 47 | For c=0 To 500000 48 | DisplaySprite3D(1,Random(640),Random(480),5) 49 | Next 50 | Stop3D() ; Make sure, that everything has been rendered. 51 | NeededTime2=GetTickCount_()-Start 52 | 53 | 54 | StartDrawing(ScreenOutput()) 55 | DrawingMode(1) 56 | 57 | DrawText(0,5,"S3D_DisplaySprite3DFast(): "+Str(NeededTime)+" ms") 58 | DrawText(0,20,"DisplaySprite3D(): "+Str(NeededTime2)+" ms") 59 | StopDrawing() 60 | 61 | FlipBuffers() 62 | 63 | Until WindowEvent()=#PB_Event_CloseWindow 64 | 65 | S3D_EndS3DFast() 66 | ; IDE Options = PureBasic v4.02 (Windows - x86) 67 | ; CursorPosition = 58 68 | ; FirstLine = 37 69 | ; Folding = - 70 | ; DisableDebugger -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/1.bmp -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/2.bmp -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/ClipSprite3D.PB: -------------------------------------------------------------------------------- 1 | Structure DDPIXELFORMAT 2 | dwSize.l 3 | dwFlags.l 4 | dwFourCC.l 5 | dwRGBBitCount.l 6 | dwRBitMask.l 7 | dwGBitMask.l 8 | dwBBitMask.l 9 | dwRGBAlphaBitMask.l 10 | EndStructure 11 | 12 | Structure DDCOLORKEY 13 | dwColorSpaceLowValue.l 14 | dwColorSpaceHighValue.l 15 | EndStructure 16 | 17 | Structure DDSCAPS2 18 | dwCaps.l 19 | dwCaps2.l 20 | dwCaps3.l 21 | dwCaps4.l 22 | EndStructure 23 | 24 | Structure DDSURFACEDESC2 25 | dwSize.l 26 | dwFlags.l 27 | dwHeight.l 28 | dwWidth.l 29 | lPitch.l 30 | dwBackBufferCount.l 31 | dwRefreshRate.l 32 | dwAlphaBitDepth.l 33 | dwReserved.l 34 | lpSurface.l 35 | ddckCKDestOverlay.DDCOLORKEY 36 | ddckCKDestBlt.DDCOLORKEY 37 | ddckCKSrcOverlay.DDCOLORKEY 38 | ddckCKSrcBlt.DDCOLORKEY 39 | ddpfPixelFormat.DDPIXELFORMAT 40 | ddsCaps.DDSCAPS2 41 | dwTextureStage.l 42 | EndStructure 43 | 44 | Structure D3DTLVERTEX 45 | sx.f 46 | sy.f 47 | sz.f 48 | rhw.f 49 | color.l 50 | specular.l 51 | tu.f 52 | tv.f 53 | EndStructure 54 | 55 | Structure PB_Sprite3D 56 | Texture.IDirectDrawSurface7 ; DirectDrawSurface7 57 | Vertice.D3DTLVERTEX[4] ; The 4 vertices for the rectangle sprite 58 | Width.w ; width set with ZoomSprite3D() 59 | Height.w ; height set with ZoomSprite3D() 60 | unknown.l 61 | EndStructure 62 | 63 | 64 | 65 | 66 | Procedure ClipSprite3D(Sprite3D,ClipX,ClipY,ClipWidth,ClipHeight) 67 | *Sprite3D.PB_Sprite3D=IsSprite3D(Sprite3D) 68 | 69 | If *Sprite3D=0:ProcedureReturn 0:EndIf 70 | *DDS.IDirectDrawSurface7=*Sprite3D\Texture 71 | 72 | DDSDESC.DDSURFACEDESC2 73 | DDSDESC\dwSize=SizeOf(DDSURFACEDESC2) 74 | Result=*DDS\GetSurfaceDesc(DDSDESC) 75 | If Result:ProcedureReturn 0:EndIf 76 | 77 | *Sprite3D\Vertice[0]\tu=ClipX/DDSDESC\dwWidth 78 | *Sprite3D\Vertice[0]\tv=ClipY/DDSDESC\dwHeight 79 | 80 | *Sprite3D\Vertice[1]\tu=(ClipX+ClipWidth)/DDSDESC\dwWidth 81 | *Sprite3D\Vertice[1]\tv=ClipY/DDSDESC\dwHeight 82 | 83 | *Sprite3D\Vertice[2]\tu=ClipX/DDSDESC\dwWidth 84 | *Sprite3D\Vertice[2]\tv=(ClipY+ClipHeight)/DDSDESC\dwHeight 85 | 86 | *Sprite3D\Vertice[3]\tu=(ClipX+ClipWidth)/DDSDESC\dwWidth 87 | *Sprite3D\Vertice[3]\tv=(ClipY+ClipHeight)/DDSDESC\dwHeight 88 | 89 | ProcedureReturn 1 ; return success 90 | EndProcedure 91 | 92 | 93 | 94 | 95 | ;Example: 96 | InitSprite() 97 | InitSprite3D() 98 | InitKeyboard() 99 | 100 | SetRefreshRate(60) 101 | OpenWindow(1,0,0,1024,768,"Clip sprite3D") 102 | OpenWindowedScreen(WindowID(1),0,0,1024,768,0,0,0) 103 | 104 | LoadSprite(1,"tree.bmp",#PB_Sprite_Texture) 105 | 106 | CreateSprite3D(1,1) 107 | 108 | 109 | ClipSprite3D(1,25,25,50,50) 110 | ZoomSprite3D(1,400,400) 111 | 112 | Repeat 113 | 114 | ClearScreen(0) 115 | 116 | Start3D() 117 | Sprite3DQuality(1) 118 | 119 | RotateSprite3D(1,1,1) 120 | DisplaySprite3D(1,200,200) 121 | Stop3D() 122 | 123 | FlipBuffers() 124 | 125 | ExamineKeyboard() 126 | WindowEvent() 127 | Until KeyboardPushed(#PB_Key_Escape) 128 | 129 | ; IDE Options = PureBasic v4.02 (Windows - x86) 130 | ; CursorPosition = 125 131 | ; FirstLine = 100 132 | ; Folding = - -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/Collision.pb: -------------------------------------------------------------------------------- 1 | ;Collision between 3D-Sprites. 2 | ;***************************** 3 | 4 | Structure DDPIXELFORMAT 5 | dwSize.l 6 | dwFlags.l 7 | dwFourCC.l 8 | dwRGBBitCount.l 9 | dwRBitMask.l 10 | dwGBitMask.l 11 | dwBBitMask.l 12 | dwRGBAlphaBitMask.l 13 | EndStructure 14 | 15 | Structure DDCOLORKEY 16 | dwColorSpaceLowValue.l 17 | dwColorSpaceHighValue.l 18 | EndStructure 19 | 20 | Structure DDSCAPS2 21 | dwCaps.l 22 | dwCaps2.l 23 | dwCaps3.l 24 | dwCaps4.l 25 | EndStructure 26 | 27 | Structure DDSURFACEDESC2 28 | dwSize.l 29 | dwFlags.l 30 | dwHeight.l 31 | dwWidth.l 32 | lPitch.l 33 | dwBackBufferCount.l 34 | dwRefreshRate.l 35 | dwAlphaBitDepth.l 36 | dwReserved.l 37 | lpSurface.l 38 | ddckCKDestOverlay.DDCOLORKEY 39 | ddckCKDestBlt.DDCOLORKEY 40 | ddckCKSrcOverlay.DDCOLORKEY 41 | ddckCKSrcBlt.DDCOLORKEY 42 | ddpfPixelFormat.DDPIXELFORMAT 43 | ddsCaps.DDSCAPS2 44 | dwTextureStage.l 45 | EndStructure 46 | 47 | Structure PB_Sprite 48 | Sprite.l 49 | Width.w 50 | Height.w 51 | Depth.w 52 | Mode.w 53 | FileName.l 54 | RealWidth.w 55 | RealHeight.w 56 | ClipX.w 57 | ClipY.w 58 | EndStructure 59 | 60 | #DDSD_WIDTH=4 61 | #DDSD_HEIGHT=2 62 | #DDSD_CAPS=1 63 | #DDSCAPS_3DDEVICE=8192 64 | #DDSCAPS_OFFSCREENPLAIN=64 65 | 66 | Global *D3DDevice.IDirect3DDevice7 67 | Global *BackBuffer.IDirectDrawSurface7 68 | 69 | Procedure CreateRenderSprite(Sprite,Width,Height) 70 | Result=CreateSprite(Sprite,Width,Height) 71 | If Result=0:ProcedureReturn 0:EndIf 72 | *PBSprite.PB_Sprite=IsSprite(Sprite) 73 | *DDS.IDirectDrawSurface7=*PBSprite\Sprite 74 | *DDS\GetDDInterface(@*DD.IDirectDraw7) 75 | *DDS\Release() 76 | DDSD.DDSURFACEDESC2 77 | DDSD\dwSize=SizeOf(DDSURFACEDESC2) 78 | DDSD\dwFlags=#DDSD_WIDTH|#DDSD_HEIGHT|#DDSD_CAPS 79 | DDSD\dwWidth=Width 80 | DDSD\dwHeight=Height 81 | DDSD\ddsCaps\dwCaps=#DDSCAPS_3DDEVICE|#DDSCAPS_OFFSCREENPLAIN 82 | Result=*DD\CreateSurface(DDSD,*PBSprite,0) 83 | *DD\Release() 84 | If Result:ProcedureReturn 0:EndIf 85 | ProcedureReturn *PBSprite\Sprite 86 | EndProcedure 87 | 88 | Procedure SelectRenderSprite(Sprite) 89 | !extrn _PB_Direct3D_Device 90 | !MOV Eax,[_PB_Direct3D_Device] 91 | !MOV [p_D3DDevice],Eax 92 | !extrn _PB_DirectX_BackBuffer 93 | !MOV Eax,[_PB_DirectX_BackBuffer] 94 | !MOV [p_BackBuffer],Eax 95 | *D3DDevice\EndScene() 96 | Select Sprite 97 | Case -1 98 | *D3DDevice\SetRenderTarget(*BackBuffer,2) 99 | Default 100 | *D3DDevice\SetRenderTarget(PeekL(IsSprite(Sprite)),2) 101 | EndSelect 102 | *D3DDevice\BeginScene() 103 | EndProcedure 104 | 105 | 106 | 107 | 108 | 109 | 110 | ;Example: 111 | 112 | InitSprite() 113 | InitSprite3D() 114 | 115 | 116 | InitKeyboard() 117 | InitMouse() 118 | 119 | OpenWindow(1,0,0,1024,768,"Collision detection with 3D-Sprites") 120 | OpenWindowedScreen(WindowID(1),0,0,1024,768,0,0,0) 121 | 122 | CreateRenderSprite(0,181,181) 123 | CreateRenderSprite(1,181,181) 124 | 125 | TransparentSpriteColor(0,RGB(255,0,255)) 126 | TransparentSpriteColor(1,RGB(255,0,255)) 127 | 128 | FontID=LoadFont(1,"Arial",20) 129 | 130 | CreateSprite(5,128,128,#PB_Sprite_Texture) 131 | StartDrawing(SpriteOutput(5)) 132 | Ellipse(64,64,64,32,#Blue) 133 | FrontColor(RGB(255,255,0)) 134 | DrawingMode(1) 135 | DrawingFont(FontID) 136 | DrawText(10,48,"3D-Sprite") 137 | StopDrawing() 138 | 139 | CreateSprite3D(5,5) 140 | 141 | 142 | Repeat 143 | ExamineKeyboard() 144 | ExamineMouse() 145 | 146 | ClearScreen(0) 147 | 148 | UseBuffer(0) 149 | ClearScreen(RGB(255,0,255));Clear Sprite 0 150 | UseBuffer(1) 151 | ClearScreen(RGB(255,0,255));Clear Sprite 1 152 | UseBuffer(-1) 153 | 154 | 155 | Start3D() 156 | 157 | SelectRenderSprite(0);Draw the 3D-Sprite on Sprite 0 158 | Angle1+2 159 | RotateSprite3D(5,Angle1,0) 160 | DisplaySprite3D(5,27,27) 161 | 162 | 163 | SelectRenderSprite(1);Draw the 3D-Sprite on Sprite 1 164 | Angle2-2 165 | RotateSprite3D(5,Angle2,0) 166 | DisplaySprite3D(5,27,27) 167 | 168 | SelectRenderSprite(-1);Draw on Backbuffer 169 | Stop3D() 170 | 171 | 172 | DisplayTransparentSprite(0,MouseX(),MouseY()) 173 | DisplayTransparentSprite(1,200,100) 174 | 175 | If SpritePixelCollision(0,MouseX(),MouseY(),1,200,100) 176 | StartDrawing(ScreenOutput()) 177 | FrontColor(RGB(255,255,0)) 178 | DrawingMode(1) 179 | DrawingFont(FontID) 180 | DrawText(0,0,"Collision !") 181 | StopDrawing() 182 | EndIf 183 | 184 | FlipBuffers() 185 | WindowEvent() 186 | Until KeyboardPushed(#PB_Key_Escape) 187 | 188 | 189 | 190 | 191 | ; IDE Options = PureBasic v4.02 (Windows - x86) 192 | ; CursorPosition = 179 193 | ; FirstLine = 162 194 | ; Folding = - -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/Cullmode.pb: -------------------------------------------------------------------------------- 1 | 2 | #D3DRENDERSTATE_CULLMODE=22 3 | 4 | #D3DCULL_NONE=1 5 | #D3DCULL_CW=2 6 | #D3DCULL_CCW=3 ; default 7 | 8 | 9 | Procedure Sprite3DGetD3DDevice() 10 | !extrn _PB_Direct3D_Device 11 | !MOV Eax,[_PB_Direct3D_Device] 12 | ProcedureReturn 13 | EndProcedure 14 | 15 | Procedure Sprite3DSetCullmode(mode) 16 | *D3DDevice.IDirect3DDevice7=Sprite3DGetD3DDevice() 17 | If *D3DDevice 18 | ProcedureReturn *D3DDevice\SetRenderState(#D3DRENDERSTATE_CULLMODE,mode) 19 | EndIf 20 | ProcedureReturn -1 21 | EndProcedure 22 | 23 | 24 | InitSprite() 25 | InitSprite3D() 26 | InitKeyboard() 27 | 28 | #flags=#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget 29 | 30 | OpenWindow(1,0,0,400,300,"Change cullmode",#flags) 31 | OpenWindowedScreen(WindowID(1),0,0,400,300,1,0,0) 32 | 33 | LoadSprite(1,"TEST.bmp",#PB_Sprite_Texture) 34 | CreateSprite3D(1,1) 35 | 36 | Repeat 37 | 38 | ClearScreen(0) 39 | 40 | Start3D() 41 | 42 | Select Cullmode 43 | Case 0 44 | Sprite3DSetCullmode(#D3DCULL_NONE) ; alles zeichnen 45 | Case 1 46 | Sprite3DSetCullmode(#D3DCULL_CCW) ; nur Vierecke zeichnen, deren Eckpunkte im Uhrzeigersinn angeordnet sind 47 | EndSelect 48 | 49 | TransformSprite3D(1,0,0,100,0,100,100,0,100) 50 | DisplaySprite3D(1,0,50) 51 | 52 | TransformSprite3D(1,0,100,100,100,100,0,0,0) 53 | DisplaySprite3D(1,200,50) 54 | 55 | Stop3D() 56 | 57 | StartDrawing(ScreenOutput()) 58 | Select Cullmode 59 | Case 0 60 | DrawText(0,0,"Cullmode:None (change with F1)") 61 | Case 1 62 | DrawText(0,0,"Cullmode:Counter clockwise (change with F1)") 63 | EndSelect 64 | StopDrawing() 65 | 66 | Delay(16) 67 | FlipBuffers() 68 | 69 | ExamineKeyboard() 70 | 71 | If KeyboardReleased(#PB_Key_F1):Cullmode=(Cullmode+1)%2:EndIf 72 | 73 | Until WindowEvent()=#PB_Event_CloseWindow 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | ; IDE Options = PureBasic v4.02 (Windows - x86) 83 | ; CursorPosition = 61 84 | ; FirstLine = 53 85 | ; Folding = - 86 | ; DisableDebugger -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/S3DEx.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/S3DEx.pb -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/Sprite3D_Drawing2D.pb: -------------------------------------------------------------------------------- 1 | ;Draw primitives with Direct3D7 2 | ;****************************** 3 | 4 | Structure MyVertices 5 | x1.f 6 | y1.f 7 | z1.f 8 | rhw1.f 9 | diffuse1.l 10 | 11 | x2.f 12 | y2.f 13 | z2.f 14 | rhw2.f 15 | diffuse2.l 16 | 17 | x3.f 18 | y3.f 19 | z3.f 20 | rhw3.f 21 | diffuse3.l 22 | 23 | x4.f 24 | y4.f 25 | z4.f 26 | rhw4.f 27 | diffuse4.l 28 | EndStructure 29 | 30 | #D3DCLEAR_TARGET=1 31 | 32 | #D3DFVF_XYZRHW=4 33 | #D3DFVF_DIFFUSE=64 34 | #D3DFVF_SPECULAR=128 35 | 36 | #D3DPT_POINTLIST=1 37 | #D3DPT_LINELIST=2 38 | #D3DPT_TRIANGLELIST=4 39 | #D3DPT_TRIANGLESTRIP=5 40 | 41 | #D3DRENDERSTATE_CULLMODE=22 42 | #D3DRENDERSTATE_DITHERENABLE=26 43 | #D3DRENDERSTATE_SPECULARENABLE=29 44 | #D3DRENDERSTATE_COLORKEYENABLE=41 45 | #D3DRENDERSTATE_LIGHTING=137 46 | #D3DCULL_NONE=1 47 | #D3DCULL_CCW=3 48 | 49 | 50 | #D3DBLEND_ZERO=1 51 | #D3DBLEND_ONE=2 52 | 53 | #D3DBLEND_SRCCOLOR=3 54 | #D3DBLEND_INVSRCCOLOR=4 55 | 56 | 57 | 58 | Procedure Sprite3D_Start2DDrawing() 59 | Global Sprite3D_Points.MyVertices 60 | Global *D3DDevice.IDirect3DDevice7 61 | 62 | !extrn _PB_Direct3D_Device 63 | !MOV Eax,[_PB_Direct3D_Device] 64 | !MOV [p_D3DDevice],Eax 65 | 66 | Sprite3D_Points\rhw1=1.0 67 | Sprite3D_Points\rhw2=1.0 68 | Sprite3D_Points\rhw3=1.0 69 | Sprite3D_Points\rhw4=1.0 70 | 71 | *D3DDevice\SetRenderState(#D3DRENDERSTATE_COLORKEYENABLE,0) ; disable colorkey 72 | *D3DDevice\SetRenderState(#D3DRENDERSTATE_DITHERENABLE,1) ; enable dithering (improve the quality) 73 | *D3DDevice\SetRenderState(#D3DRENDERSTATE_CULLMODE,#D3DCULL_NONE); disable culling 74 | Sprite3DBlendingMode(#D3DBLEND_ONE,#D3DBLEND_ZERO) 75 | EndProcedure 76 | 77 | 78 | 79 | Procedure Sprite3D_Stop2DDrawing() 80 | *D3DDevice\SetRenderState(#D3DRENDERSTATE_COLORKEYENABLE,1);enable colorkey 81 | *D3DDevice\SetRenderState(#D3DRENDERSTATE_DITHERENABLE,0) 82 | *D3DDevice\SetRenderState(#D3DRENDERSTATE_CULLMODE,#D3DCULL_CCW) 83 | Sprite3DBlendingMode(#D3DBLEND_SRCCOLOR,#D3DBLEND_INVSRCCOLOR) 84 | EndProcedure 85 | 86 | 87 | 88 | Procedure Sprite3D_DrawLine2D(x1.f,y1.f,x2.f,y2.f,RGB1,RGB2) 89 | Sprite3D_Points\x1=x1 90 | Sprite3D_Points\y1=y1 91 | Sprite3D_Points\diffuse1=RGB1>>16+(RGB1&$FF00)+(RGB1&$FF)<<16 ;convert RGB to BGR 92 | Sprite3D_Points\x2=x2 93 | Sprite3D_Points\y2=y2 94 | Sprite3D_Points\diffuse2=RGB2>>16+(RGB2&$FF00)+(RGB2&$FF)<<16 95 | ProcedureReturn *D3DDevice\DrawPrimitive(#D3DPT_LINELIST,#D3DFVF_XYZRHW|#D3DFVF_DIFFUSE,@Sprite3D_Points,2,0) 96 | EndProcedure 97 | 98 | 99 | 100 | Procedure Sprite3D_ClearScreen(RGB) 101 | *D3DDevice\Clear(0,0,#D3DCLEAR_TARGET,RGB>>16+(RGB&$FF00)+(RGB&$FF)<<16,0,0) 102 | EndProcedure 103 | 104 | 105 | 106 | Procedure Sprite3D_DrawTriangle2D(x1.f,y1.f,x2.f,y2.f,x3.f,y3.f,RGB1,RGB2,RGB3) 107 | Sprite3D_Points\x1=x1 108 | Sprite3D_Points\y1=y1 109 | Sprite3D_Points\diffuse1=RGB1>>16+(RGB1&$FF00)+(RGB1&$FF)<<16 110 | Sprite3D_Points\x2=x2 111 | Sprite3D_Points\y2=y2 112 | Sprite3D_Points\diffuse2=RGB2>>16+(RGB2&$FF00)+(RGB2&$FF)<<16 113 | Sprite3D_Points\x3=x3 114 | Sprite3D_Points\y3=y3 115 | Sprite3D_Points\diffuse3=RGB3>>16+(RGB3&$FF00)+(RGB3&$FF)<<16 116 | ProcedureReturn *D3DDevice\DrawPrimitive(#D3DPT_TRIANGLELIST,#D3DFVF_XYZRHW|#D3DFVF_DIFFUSE,@Sprite3D_Points,3,0) 117 | EndProcedure 118 | 119 | 120 | 121 | Procedure Sprite3D_DrawBox2D(X.f,Y.f,Width.f,Height.f,RGB1,RGB2,RGB3,RGB4) 122 | Sprite3D_Points\x1=X 123 | Sprite3D_Points\y1=Y 124 | Sprite3D_Points\diffuse1=RGB1>>16+(RGB1&$FF00)+(RGB1&$FF)<<16 125 | Sprite3D_Points\x2=X+Width 126 | Sprite3D_Points\y2=Y 127 | Sprite3D_Points\diffuse2=RGB2>>16+(RGB2&$FF00)+(RGB2&$FF)<<16 128 | Sprite3D_Points\x3=X 129 | Sprite3D_Points\y3=Y+Height 130 | Sprite3D_Points\diffuse3=RGB3>>16+(RGB3&$FF00)+(RGB3&$FF)<<16 131 | Sprite3D_Points\x4=X+Width 132 | Sprite3D_Points\y4=Y+Height 133 | Sprite3D_Points\diffuse4=RGB4>>16+(RGB4&$FF00)+(RGB4&$FF)<<16 134 | ProcedureReturn *D3DDevice\DrawPrimitive(#D3DPT_TRIANGLESTRIP,#D3DFVF_XYZRHW|#D3DFVF_DIFFUSE,@Sprite3D_Points,4,0) 135 | EndProcedure 136 | 137 | 138 | 139 | Procedure Sprite3D_DrawPixel2D(X.f,Y.f,RGB) 140 | Sprite3D_Points\x1=X 141 | Sprite3D_Points\y1=Y 142 | Sprite3D_Points\diffuse1=RGB>>16+(RGB&$FF00)+(RGB&$FF)<<16 143 | ProcedureReturn *D3DDevice\DrawPrimitive(#D3DPT_POINTLIST,#D3DFVF_XYZRHW|#D3DFVF_DIFFUSE,@Sprite3D_Points,1,0) 144 | EndProcedure 145 | 146 | 147 | 148 | 149 | 150 | ;example: 151 | 152 | InitSprite() 153 | InitSprite3D() 154 | 155 | #flags=#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget 156 | 157 | OpenWindow(1,0,0,400,300,"Direct3D 7 Primitives test",#flags) 158 | OpenWindowedScreen(WindowID(1),0,0,400,300,1,0,0) 159 | 160 | XPos=50:addX=1 161 | 162 | Repeat 163 | 164 | 165 | Start3D() 166 | Sprite3D_Start2DDrawing() 167 | 168 | 169 | Sprite3D_ClearScreen(#Blue);clear the screen 170 | 171 | 172 | ;Draw a triangle 173 | Sprite3D_DrawTriangle2D(50,150,150,150,150,250,#Red,#Green,#Blue) 174 | 175 | 176 | ;Draw a few lines 177 | Sprite3D_DrawLine2D(200,200,300,300,#Black,#White) 178 | Sprite3D_DrawLine2D(300,300,400,200,#Black,#White) 179 | Sprite3D_DrawLine2D(400,200,300,100,#Black,#White) 180 | Sprite3D_DrawLine2D(300,100,200,200,#Black,#White) 181 | 182 | Sprite3D_DrawBox2D(100,25,250,50,#Magenta,#White,#Yellow,#Red) 183 | 184 | XPos+addX 185 | YPos+addY 186 | 187 | If XPos<=0:addX=1:EndIf 188 | If XPos>=300:addX=-1:EndIf 189 | 190 | If YPos<=0:addY=2:EndIf 191 | If YPos>=200:addY=-2:EndIf 192 | 193 | Sprite3D_DrawBox2D(XPos,YPos,100,100,#Black,#White,#Green,#Black) 194 | 195 | Sprite3D_Stop2DDrawing() 196 | Stop3D() 197 | 198 | Delay(16) 199 | FlipBuffers() 200 | Until WindowEvent()=#PB_Event_CloseWindow 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | ; IDE Options = PureBasic v4.02 (Windows - x86) 210 | ; CursorPosition = 198 211 | ; FirstLine = 180 212 | ; Folding = -- 213 | ; DisableDebugger -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/TEST.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/TEST.bmp -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/tree.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/Sprite3D/tree.bmp -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/TEST.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/TEST.bmp -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/multi4.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/multi4.pb -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/multi4_Both.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/multi4_Both.pb -------------------------------------------------------------------------------- /S3DMultiTexturing_PB4/S3DMultiTexturing/multi4_Faster.pb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/S3DMultiTexturing_PB4/S3DMultiTexturing/multi4_Faster.pb -------------------------------------------------------------------------------- /SVGRender/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /SVGRender/SVGRender_Linux.pb: -------------------------------------------------------------------------------- 1 | ImportC "" 2 | gdk_pixbuf_get_width (*pixbuf) 3 | gdk_pixbuf_get_height (*pixbuf) 4 | gdk_pixbuf_loader_write(*loader, *buf, count, *error) 5 | gdk_pixbuf_loader_get_pixbuf(*loader) 6 | gdk_pixbuf_loader_new() 7 | gdk_pixbuf_loader_close(*loader, *error) 8 | EndImport 9 | 10 | #GTK_IMAGE = 100 11 | 12 | Procedure __LoadPixbuf(*mem, size) 13 | Protected ok = #True 14 | Protected *loader = gdk_pixbuf_loader_new() 15 | Protected *pixbuf = #Null, *err.GError = #Null 16 | 17 | If *mem = #Null 18 | ok = #False 19 | Debug "LoadPixbuf called with invalid mem argument" 20 | EndIf 21 | 22 | If ok 23 | If size < 1 24 | ok = #False 25 | Debug "LoadPixbuf called with invalid size argument" 26 | EndIf 27 | EndIf 28 | 29 | If ok 30 | gdk_pixbuf_loader_write(loader, *mem, size, @*err) 31 | If *err 32 | ok = #False 33 | Debug "gdk_pixbuf_loader_write failed with error: " + PeekS(*err\message, -1, #PB_UTF8) 34 | EndIf 35 | EndIf 36 | 37 | If ok 38 | *err = #Null 39 | gdk_pixbuf_loader_close(loader, @*err) 40 | If *err 41 | ok = #False 42 | Debug "gdk_pixbuf_loader_close failed with error: " + PeekS(*err\message, -1, #PB_UTF8) 43 | EndIf 44 | EndIf 45 | 46 | If ok 47 | *pixbuf = gdk_pixbuf_loader_get_pixbuf(loader) 48 | EndIf 49 | ProcedureReturn *pixbuf 50 | EndProcedure 51 | 52 | 53 | Procedure SVG_Init() 54 | ProcedureReturn #True 55 | EndProcedure 56 | 57 | Procedure SVG_Free() 58 | ProcedureReturn #True 59 | EndProcedure 60 | 61 | Procedure SVG_Render(width, height, resizeWidth, resizeHeight, *mem, size) 62 | Protected img, width, height 63 | img = __LoadPixbuf(*mem,size) 64 | 65 | If img 66 | width = gdk_pixbuf_get_width (img) 67 | height = gdk_pixbuf_get_height (img) 68 | 69 | If IsImage(#GTK_IMAGE) And ImageWidth(#GTK_IMAGE) = width And ImageHeight(#GTK_IMAGE) = height 70 | CreateImage(#GTK_IMAGE, width, height, 32) 71 | EndIf 72 | StartDrawing(ImageOutput(#GTK_IMAGE)) 73 | DrawingMode(#PB_2DDrawing_AllChannels) 74 | DrawImage(img, 0, 0) 75 | StopDrawing() 76 | ResizeImage(#GTK_IMAGE,resizeWidth, resizeHeight) 77 | EndIf 78 | EndProcedure 79 | 80 | -------------------------------------------------------------------------------- /SlowCPUSimulator/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /SlowCPUSimulator/SlowCPUSimulator.pb: -------------------------------------------------------------------------------- 1 | ;Licence: Public domain 2 | EnableExplicit 3 | Structure THROTTLE_CPU 4 | hThread.i 5 | pauseFactor.i 6 | EndStructure 7 | 8 | Procedure __ThPause(*params.THROTTLE_CPU) 9 | Protected timecaps.TIMECAPS, exitCode.i 10 | If *params <> #Null 11 | timeGetDevCaps_(timecaps,SizeOf(TIMECAPS)) 12 | timeBeginPeriod_(timecaps\wPeriodMin) 13 | Repeat 14 | If GetExitCodeThread_(*params\hThread, @exitCode) 15 | If exitCode <> #STILL_ACTIVE 16 | ; for the main thread this would be to late(process already terminated) however we could also use only repeat...forever here 17 | Break 18 | EndIf 19 | EndIf 20 | SuspendThread_(*params\hThread) 21 | Sleep_(*params\pauseFactor) 22 | ResumeThread_(*params\hThread) 23 | Sleep_(1) 24 | ForEver 25 | timeEndPeriod_(timecaps\wPeriodMin) 26 | CloseHandle_(*params\hThread) 27 | FreeMemory(*params) 28 | EndIf 29 | EndProcedure 30 | 31 | Procedure ThrottleCPU(pauseFactor.i) 32 | Protected *params.THROTTLE_CPU = AllocateMemory(SizeOf(THROTTLE_CPU)) 33 | If *params 34 | *params\pauseFactor = pauseFactor 35 | If DuplicateHandle_(GetCurrentProcess_(),GetCurrentThread_(), GetCurrentProcess_(), @*params\hThread, #THREAD_GET_CONTEXT, #False, #DUPLICATE_SAME_ACCESS) 36 | ProcedureReturn CreateThread(@__ThPause(), *params) 37 | Else 38 | FreeMemory(*params) 39 | EndIf 40 | EndIf 41 | ProcedureReturn #Null 42 | EndProcedure 43 | 44 | 45 | 46 | ;Example 47 | ThrottleCPU(100) 48 | 49 | OpenWindow(0, 0, 0, 800, 800, "Highspeed drawing", #PB_Window_SystemMenu | #PB_Window_ScreenCentered) 50 | 51 | Repeat 52 | StartDrawing(WindowOutput(0)) 53 | LineXY(Random(800),Random(800),Random(800),Random(800),Random($FFFFFF)) 54 | StopDrawing() 55 | Until WindowEvent() = #PB_Event_CloseWindow 56 | -------------------------------------------------------------------------------- /UADD/UADD.pb: -------------------------------------------------------------------------------- 1 | Procedure.s UADD(A$,B$) 2 | Erg$="" 3 | If FindString(A$,".",1)=0:A$=A$+".0":EndIf 4 | If FindString(B$,".",1)=0:B$=B$+".0":EndIf 5 | 6 | PointA=FindString(A$,".",1) 7 | If PointA=0:PointA=Len(A$):EndIf 8 | 9 | PointB=FindString(B$,".",1) 10 | If PointB=0:PointB=Len(B$):EndIf 11 | 12 | If PointA>PointB:B$=LSet("",PointA-PointB,"0")+B$:EndIf 13 | If PointB>PointA:A$=LSet("",PointB-PointA,"0")+A$:EndIf 14 | 15 | If Len(A$)>Len(B$):B$=B$+LSet("",Len(A$)-Len(B$),"0"):EndIf 16 | If Len(B$)>Len(A$):A$=A$+LSet("",Len(B$)-Len(A$),"0"):EndIf 17 | 18 | Old=0 19 | For M=Len(A$) To 1 Step -1 20 | If Mid(A$,M,1)<>"." 21 | A=Val(Mid(A$,M,1)) 22 | b=Val(Mid(B$,M,1)) 23 | C=A+b+Old 24 | C$=Str(C) 25 | Old=0 26 | If C>9:Old=Val(Left(C$,1)):C$=Right(C$,1):EndIf 27 | Erg$=C$+Erg$ 28 | Else 29 | Erg$="."+Erg$ 30 | EndIf 31 | Next 32 | If Old<>0:Erg$=Str(Old)+Erg$:EndIf 33 | ProcedureReturn Erg$ 34 | EndProcedure 35 | 36 | Debug UADD("7654321.12345","999000.000999") 37 | 38 | Debug 7654321.12345+999000.000999 39 | -------------------------------------------------------------------------------- /WinAPI_Jobs/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /WinAPI_Jobs/WinAPI_Jobs.pbi: -------------------------------------------------------------------------------- 1 | 2 | 3 | #IDI_SHIELD = 32518 4 | #JobObjectBasicUIRestrictions = 4 5 | #JOB_OBJECT_UILIMIT_HANDLES = 1 6 | 7 | Prototype.i __CreateJobObject(*pSa.i,*pName.i) 8 | Prototype.i __OpenJobObject(*pSa.i,bInheritHandles.i, *pName.i) 9 | Prototype.i __SetInformationJobObject(hJob.i, JobObjectInfoClass.i, lpJobObjectInfo.i, cbJobObjectInfoLength.i) 10 | Prototype.i __AssignProcessToJobObject(hJob.i, hProcess.i) 11 | Prototype.i __UserHandleGrantAccess(hUserHandle.i, hJob.i, bGrant.i) 12 | Prototype.i __GetShellWindow() 13 | Prototype.i __TerminateJobObject(hJob.i,iExit.i) 14 | 15 | Structure JOBOBJECT 16 | hJob.i 17 | hKernel32.i 18 | hUser32.i 19 | CreateJobObject.__CreateJobObject 20 | OpenJobObject.__OpenJobObject 21 | SetInformationJobObject.__SetInformationJobObject 22 | AssignProcessToJobObject.__AssignProcessToJobObject 23 | UserHandleGrantAccess.__UserHandleGrantAccess 24 | GetShellWindow.__GetShellWindow 25 | TerminateJobObject.__TerminateJobObject 26 | EndStructure 27 | 28 | Global g_Job.JOBOBJECT 29 | 30 | Procedure JOB_Create() 31 | g_Job\hJob = #Null 32 | g_Job\hKernel32 = LoadLibrary_("Kernel32.dll") 33 | g_Job\hUser32 = LoadLibrary_("User32.dll") 34 | 35 | If g_Job\hKernel32 And g_Job\hUser32 36 | g_Job\CreateJobObject = GetProcAddress_(g_Job\hKernel32, "CreateJobObjectA") 37 | g_Job\OpenJobObject = GetProcAddress_(g_Job\hKernel32, "OpenJobObjectA") 38 | g_Job\SetInformationJobObject = GetProcAddress_(g_Job\hKernel32, "SetInformationJobObject") 39 | g_Job\AssignProcessToJobObject = GetProcAddress_(g_Job\hKernel32, "AssignProcessToJobObject") 40 | g_Job\UserHandleGrantAccess = GetProcAddress_(g_Job\hUser32, "UserHandleGrantAccess") 41 | g_Job\GetShellWindow = GetProcAddress_(g_Job\hUser32, "GetShellWindow") 42 | g_Job\TerminateJobObject = GetProcAddress_(g_Job\hKernel32, "TerminateJobObject") 43 | 44 | Debug g_Job\TerminateJobObject 45 | 46 | If g_Job\OpenJobObject And g_Job\CreateJobObject And g_Job\SetInformationJobObject And g_Job\AssignProcessToJobObject And g_Job\UserHandleGrantAccess And g_Job\GetShellWindow 47 | g_Job\hJob = g_Job\OpenJobObject($1F001F, #False, @"UserJOB") 48 | Debug "OpenJob "+Str(g_Job\hJob ) 49 | If g_Job\hJob = 0 50 | g_Job\hJob = g_Job\CreateJobObject(#Null, @"UserJOB") 51 | Debug "CreateJob "+Str(g_Job\hJob ) 52 | EndIf 53 | EndIf 54 | EndIf 55 | 56 | If g_Job\hJob = #Null 57 | If g_Job\hKernel32:FreeLibrary_(g_Job\hKernel32):EndIf 58 | If g_Job\hUser32:FreeLibrary_(g_Job\hUser32):EndIf 59 | g_Job\hKernel32 = #Null 60 | g_Job\hUser32 = #Null 61 | EndIf 62 | 63 | ProcedureReturn g_Job\hJob 64 | EndProcedure 65 | 66 | 67 | Procedure JOB_InitUserObjects() 68 | If g_Job\hJob And g_Job\UserHandleGrantAccess And g_Job\SetInformationJobObject And g_Job\GetShellWindow And g_Job\AssignProcessToJobObject 69 | 70 | lRestriction.l = #JOB_OBJECT_UILIMIT_HANDLES 71 | If g_Job\SetInformationJobObject(g_Job\hJob, #JobObjectBasicUIRestrictions, @lRestriction, SizeOf(LONG)) 72 | 73 | g_Job\UserHandleGrantAccess(GetDesktopWindow_(),g_Job\hJob,#True) 74 | g_Job\UserHandleGrantAccess(g_Job\GetShellWindow(),g_Job\hJob,#True) 75 | g_Job\UserHandleGrantAccess(#HWND_BROADCAST,g_Job\hJob,#True) 76 | ;g_Job\UserHandleGrantAccess(CallFunction(2,"GetTaskmanWindow"),g_Job\hJob,#True) 77 | 78 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_APPSTARTING),g_Job\hJob,#True) 79 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_ARROW),g_Job\hJob,#True) 80 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_CROSS),g_Job\hJob,#True) 81 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_HAND),g_Job\hJob,#True) 82 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_HELP),g_Job\hJob,#True) 83 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_IBEAM),g_Job\hJob,#True) 84 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_ICON),g_Job\hJob,#True) 85 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_NO),g_Job\hJob,#True) 86 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_SIZE),g_Job\hJob,#True) 87 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_SIZEALL),g_Job\hJob,#True) 88 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_SIZENESW),g_Job\hJob,#True) 89 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_SIZENS),g_Job\hJob,#True) 90 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_SIZENWSE),g_Job\hJob,#True) 91 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_SIZEWE),g_Job\hJob,#True) 92 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_UPARROW),g_Job\hJob,#True) 93 | g_Job\UserHandleGrantAccess(LoadCursor_(#Null,#IDC_WAIT),g_Job\hJob,#True) 94 | 95 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_APPLICATION),g_Job\hJob,#True) 96 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_ASTERISK),g_Job\hJob,#True) 97 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_ERROR),g_Job\hJob,#True) 98 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_EXCLAMATION),g_Job\hJob,#True) 99 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_HAND),g_Job\hJob,#True) 100 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_INFORMATION),g_Job\hJob,#True) 101 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_QUESTION),g_Job\hJob,#True) 102 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_WARNING),g_Job\hJob,#True) 103 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_WINLOGO),g_Job\hJob,#True) 104 | g_Job\UserHandleGrantAccess(LoadIcon_(#Null,#IDI_SHIELD),g_Job\hJob,#True) 105 | Debug "ok" 106 | EndIf 107 | EndIf 108 | EndProcedure 109 | 110 | 111 | Procedure JOB_AssignProcessToJob(hProcess.i) 112 | If hProcess = #Null:hProcess = GetCurrentProcess_():EndIf 113 | Debug "process to job: "+Str(hProcess) 114 | ProcedureReturn g_Job\AssignProcessToJobObject(g_Job\hJob, hProcess) 115 | EndProcedure 116 | 117 | Procedure JOB_ProtectUserObjects() 118 | If g_Job\hJob And g_Job\SetInformationJobObject 119 | ;lRestriction.l = 0 120 | ;g_Job\SetInformationJobObject(g_Job\hJob, #JobObjectBasicUIRestrictions, @lRestriction, SizeOf(LONG)) 121 | lRestriction.l = #JOB_OBJECT_UILIMIT_HANDLES 122 | g_Job\SetInformationJobObject(g_Job\hJob, #JobObjectBasicUIRestrictions, @lRestriction, SizeOf(LONG)) 123 | EndIf 124 | EndProcedure 125 | 126 | Procedure JOB_UnProtectUserObjects() 127 | If g_Job\hJob And g_Job\SetInformationJobObject 128 | ; Reset restrictions, so we have acess to all user object 129 | lRestriction.l = 0 130 | ProcedureReturn g_Job\SetInformationJobObject(g_Job\hJob, #JobObjectBasicUIRestrictions, @lRestriction, SizeOf(LONG)) 131 | EndIf 132 | ProcedureReturn #False 133 | EndProcedure 134 | 135 | Procedure JOB_Close() 136 | JOB_UnProtectUserObjects() 137 | If g_Job\hJob 138 | CloseHandle_(g_Job\hJob) 139 | g_Job\hJob = #Null 140 | If g_Job\hKernel32:FreeLibrary_(g_Job\hKernel32):EndIf 141 | If g_Job\hUser32:FreeLibrary_(g_Job\hUser32):EndIf 142 | g_Job\hKernel32 = #Null 143 | g_Job\hUser32 = #Null 144 | EndIf 145 | EndProcedure 146 | 147 | -------------------------------------------------------------------------------- /WineSec/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /WineSec/README.md: -------------------------------------------------------------------------------- 1 | makes wine more secure by asking before starting the process and preventing running EXE files as root. 2 | -------------------------------------------------------------------------------- /WineSec/wine_sec: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/WineSec/wine_sec -------------------------------------------------------------------------------- /WineSec/wine_sec.pb: -------------------------------------------------------------------------------- 1 |  2 | 3 | realprog.s = GetFilePart(ProgramFilename()) + "_xxx" 4 | 5 | 6 | Debug realprog.s 7 | 8 | If CreateFile(1,"/root/test891250299534") 9 | CloseFile(1) 10 | DeleteFile("/root/test891250299534") 11 | MessageRequester("WINE", "Wine darf nicht als Admin ausgeführt werden!") 12 | End 13 | EndIf 14 | 15 | ;allow_direct = #False 16 | param$ = "" 17 | For i=0 To CountProgramParameters() 18 | new$ = ProgramParameter(i) 19 | ;If new$ = "/allow_direct_run" 20 | ; allow_direct=#True 21 | ;EndIf 22 | If FindString(new$, " ") > 0 23 | new$ = Chr(34) + new$ + Chr(34) 24 | EndIf 25 | param$ = param$ + new$ + " " 26 | Next 27 | param$=Trim(param$);+ " /allow_direct_run" 28 | 29 | ;If allow_direct 30 | ; RunProgram("/usr/bin/" + realprog, param$, GetCurrentDirectory(), #PB_Program_Wait) 31 | ;Else 32 | If MessageRequester("WINE", "Start WINE application?" +Chr(13)+"Commandline:"+Chr(13) + param$, #PB_MessageRequester_YesNo) = #PB_MessageRequester_Yes 33 | ;MessageRequester("WINE", "/usr/bin/" + realprog) 34 | RunProgram("/usr/bin/" + realprog, param$, GetCurrentDirectory(), #PB_Program_Wait) 35 | EndIf 36 | ;EndIf 37 | ; IDE Options = PureBasic 5.22 LTS Beta 2 (Linux - x64) 38 | ; ExecutableFormat = Console 39 | ; CursorPosition = 33 40 | ; FirstLine = 11 41 | ; EnableUnicode 42 | ; EnableXP 43 | ; Executable = wine_sec 44 | ; CommandLine = wine -------------------------------------------------------------------------------- /colorize_image/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /colorize_image/colorize_image.pb: -------------------------------------------------------------------------------- 1 | 2 | 3 | UseJPEGImageDecoder() 4 | UseJPEGImageEncoder() 5 | UsePNGImageEncoder() 6 | UsePNGImageDecoder() 7 | 8 | SetCurrentDirectory("D:\my_images") 9 | LoadImage(1,"with_color.jpg") 10 | LoadImage(2,"grayscale.jpg") 11 | 12 | Dim col.i(ImageWidth(1),ImageHeight(1)) 13 | 14 | StartDrawing(ImageOutput(1)) 15 | For x=0 To ImageWidth(1)-1 16 | For y=0 To ImageHeight(1)-1 17 | col(x,y) =Point(x,y) 18 | Next 19 | Next 20 | StopDrawing() 21 | 22 | 23 | StartDrawing(ImageOutput(2)) 24 | For x=0 To ImageWidth(1)-1 25 | For y=0 To ImageHeight(1)-1 26 | col = Point(x,y) 27 | col2 = col(x,y) 28 | y1.f = (Red(col)+2.0 * Green(col)+Blue(col))/ 4.0 29 | y2.f = (Red(col2)+2.0 * Green(col2)+Blue(col2))/ 4.0 30 | r1.f = y1 + Red(col2)-y2 31 | g1.f = y1 + Green(col2)-y2 32 | b1.f = y1 + Blue(col2)-y2 33 | If r1 > 255:r1= 255:EndIf 34 | If r1 < 0:r1 = 0:EndIf 35 | If g1 > 255:g1= 255:EndIf 36 | If g1 < 0:g1 = 0:EndIf 37 | If b1 > 255:b1= 255:EndIf 38 | If b1 < 0:b1 = 0:EndIf 39 | Plot(x,y,RGB(r1,g1,b1)) 40 | 41 | Next 42 | Next 43 | StopDrawing() 44 | 45 | SaveImage(2,"out.png",#PB_ImagePlugin_PNG) 46 | -------------------------------------------------------------------------------- /flying pigs/1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/1.ico -------------------------------------------------------------------------------- /flying pigs/GAME.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/GAME.exe -------------------------------------------------------------------------------- /flying pigs/Game3.pb: -------------------------------------------------------------------------------- 1 | InitSprite() 2 | InitKeyboard() 3 | InitMouse() 4 | InitSound() 5 | 6 | OpenWindow(1,0,0,640,480,1,"GAME") 7 | OpenWindowedScreen(WindowID(),0,0,640,480,0,0,0) 8 | 9 | LoadSound(1,"daten\1.wav") 10 | 11 | LoadSprite(0,"daten\1.bmp") 12 | LoadSprite(1,"daten\2.bmp") 13 | LoadSprite(2,"daten\3.bmp") 14 | LoadSprite(100,"daten\4.bmp") 15 | LoadSprite(101,"daten\5.bmp") 16 | LoadSprite(102,"daten\6.bmp") 17 | LoadSprite(103,"daten\7.bmp") 18 | LoadSprite(104,"daten\8.bmp") 19 | LoadSprite(105,"daten\9.bmp") 20 | LoadSprite(106,"daten\10.bmp") 21 | LoadSprite(107,"daten\11.bmp") 22 | LoadSprite(108,"daten\12.bmp") 23 | 24 | LoadSprite(3,"daten\13.bmp") 25 | LoadSprite(4,"daten\14.bmp") 26 | 27 | LoadSprite(5,"daten\15.bmp") 28 | LoadSprite(6,"daten\16.bmp") 29 | 30 | LoadSprite(7,"daten\17.bmp") 31 | LoadSprite(8,"daten\18.bmp") 32 | TransparentSpriteColor(0,255,0,255) 33 | TransparentSpriteColor(2,255,0,255) 34 | TransparentSpriteColor(100,255,0,255) 35 | TransparentSpriteColor(101,255,0,255) 36 | TransparentSpriteColor(102,255,0,255) 37 | 38 | TransparentSpriteColor(104,0,255,0) 39 | TransparentSpriteColor(105,0,255,0) 40 | TransparentSpriteColor(106,0,255,0) 41 | TransparentSpriteColor(107,0,255,0) 42 | TransparentSpriteColor(108,0,255,0) 43 | 44 | 45 | TransparentSpriteColor(3,0,255,0) 46 | TransparentSpriteColor(4,0,255,0) 47 | 48 | TransparentSpriteColor(5,0,255,0) 49 | TransparentSpriteColor(6,0,255,0) 50 | TransparentSpriteColor(7,0,255,0) 51 | TransparentSpriteColor(8,0,255,0) 52 | 53 | 54 | LoadFont(1,"Arial",24) 55 | 56 | Structure PIG 57 | Use.l 58 | X.l 59 | Y.l 60 | DirX.l 61 | DirY.l 62 | State.l 63 | Typ.l 64 | Z.l 65 | EndStructure 66 | 67 | 68 | 69 | 70 | Dim Pigs.PIG(1000) 71 | 72 | 73 | For M=0 To 1000 74 | Pigs(M)\Use=1 75 | 76 | Pigs(M)\Typ=Random(5)+3 77 | 78 | If Pigs(M)\Typ=3 79 | Pigs(M)\Y=Random(1000)-Random(1000) 80 | Pigs(M)\X=-Random(95000) 81 | Pigs(M)\DirY=Random(1)-Random(1) 82 | Pigs(M)\DirX=Random(1)+1 83 | Pigs(M)\Z=1 84 | EndIf 85 | 86 | If Pigs(M)\Typ=4 87 | Pigs(M)\Y=Random(1000)-Random(1000) 88 | Pigs(M)\X=Random(95000) 89 | Pigs(M)\DirY=Random(1)-Random(1) 90 | Pigs(M)\DirX=-Random(1)-1 91 | Pigs(M)\Z=1 92 | EndIf 93 | 94 | If Pigs(M)\Typ=5 95 | Pigs(M)\Y=Random(1000)-Random(1000) 96 | Pigs(M)\X=-Random(95000) 97 | Pigs(M)\DirY=0 98 | Pigs(M)\DirX=Random(1)+8 99 | Pigs(M)\Z=1 100 | EndIf 101 | 102 | If Pigs(M)\Typ=6 103 | Pigs(M)\Y=Random(1000)-Random(1000) 104 | Pigs(M)\X=Random(95000) 105 | Pigs(M)\DirY=0 106 | Pigs(M)\DirX=-Random(1)-8 107 | Pigs(M)\Z=1 108 | EndIf 109 | 110 | If Pigs(M)\Typ=7 111 | Pigs(M)\Y=Random(1000)-Random(1000) 112 | Pigs(M)\X=Random(95000) 113 | Pigs(M)\DirY=0 114 | Pigs(M)\DirX=1 115 | Pigs(M)\Z=5 116 | EndIf 117 | 118 | If Pigs(M)\Typ=8 119 | Pigs(M)\Y=Random(1000)-Random(1000) 120 | Pigs(M)\X=Random(95000) 121 | Pigs(M)\DirY=0 122 | Pigs(M)\DirX=-1 123 | Pigs(M)\Z=5 124 | EndIf 125 | 126 | 127 | Next 128 | 129 | 130 | X=500 131 | MouseLocate(320/1.5,240/1.5) 132 | Gun=5 133 | EGun=0 134 | Start=GetTickCount_() 135 | 136 | Repeat 137 | 138 | 139 | ExamineMouse() 140 | MouseX=MouseX()*1.5-16 141 | MouseY=MouseY()*1.5-16 142 | 143 | If MouseX>640:MouseLocate(640/1.5,MouseY()):MouseX=640:EndIf 144 | If MouseY>480:MouseLocate(MouseX(),480/1.5):MouseY=480:EndIf 145 | 146 | ExamineKeyboard() 147 | Event=WindowEvent() 148 | 149 | DisplaySprite(1,-X/8,0) 150 | If smPigDead=0:DisplayTransparentSprite(108,(-X)/8+100,225):EndIf 151 | 152 | 153 | For M=0 To 1000 154 | If Pigs(M)\Use And Pigs(M)\Z=5 155 | DisplayTransparentSprite(Pigs(M)\Typ,Pigs(M)\X-X,Pigs(M)\Y) 156 | Pigs(M)\X+Pigs(M)\DirX 157 | Pigs(M)\Y+Pigs(M)\DirY 158 | EndIf 159 | 160 | Next 161 | 162 | For M=0 To 1000 163 | If Pigs(M)\Use And Pigs(M)\Z=1 164 | DisplayTransparentSprite(Pigs(M)\Typ,Pigs(M)\X-X,Pigs(M)\Y) 165 | Pigs(M)\X+Pigs(M)\DirX 166 | Pigs(M)\Y+Pigs(M)\DirY 167 | EndIf 168 | Next 169 | 170 | 171 | DisplayTransparentSprite(2,-X,245) 172 | 173 | DisplayTransparentSprite(102,-X+1700,200) 174 | If BigPigDead=0 175 | DisplayTransparentSprite(104,-X+1500,200) 176 | Else 177 | DisplayTransparentSprite(105,-X+1500,200) 178 | EndIf 179 | DisplayTransparentSprite(106,-X+300,300) 180 | DisplayTransparentSprite(107,-X+1900,420) 181 | 182 | 183 | StartDrawing(ScreenOutput()) 184 | DrawingMode(1) 185 | DrawingFont(FontID()) 186 | Locate(0,0) 187 | FrontColor(255,128,0) 188 | If Points<0:Points=0:EndIf 189 | DrawText("Punkte: "+Str(Points)) 190 | Locate(0,30) 191 | FrontColor(0,0,128) 192 | Min=(120000-(GetTickCount_()-Start))/60000 193 | Sec=((120000-(GetTickCount_()-Start))-Min*60000)/1000 194 | Min$=Str(Min) 195 | Sec$=Str(Sec) 196 | If Sec<10:Sec$="0"+Sec$:EndIf 197 | DrawText("Zeit: "+Min$+":"+Sec$) 198 | 199 | StopDrawing() 200 | 201 | 202 | Pause+1 203 | Bed=0 204 | If EGun<>2 205 | If MouseButton(1)=1 And OldMouseState=0 And Gun:Bed=1:EndIf 206 | Else 207 | If MouseButton(1)=1 And Pause>5 And Gun:Bed=1:Pause=0:EndIf 208 | EndIf 209 | 210 | 211 | 212 | If Bed 213 | Gun-1:PlaySound(1) 214 | Hit=0 215 | 216 | If SpritePixelCollision(108,(-X)/8+100,225,103,MouseX+16,MouseY+16) And smPigDead=0 217 | smPigDead=1 218 | Points+100 219 | Hit=1 220 | EndIf 221 | 222 | 223 | If SpritePixelCollision(104,-X+1500,200,103,MouseX+16,MouseY+16) And BigPigDead=0 224 | BigPigDead=1 225 | Points+85 226 | Hit=1 227 | EndIf 228 | 229 | If SpritePixelCollision(106,-X+300,300,103,MouseX+16,MouseY+16) 230 | EGun=1 231 | Hit=1 232 | If Gun>8:Gun=8:EndIf 233 | EndIf 234 | 235 | 236 | If SpritePixelCollision(107,-X+1900,420,103,MouseX+16,MouseY+16) And EGun=1 237 | EGun=2 238 | Hit=1 239 | EndIf 240 | 241 | 242 | If SpritePixelCollision(102,-X+1700,200,103,MouseX+16,MouseY+16) 243 | Points-5 244 | Hit=1 245 | EndIf 246 | 247 | If Hit=0 248 | If SpritePixelCollision(2,-X,245,103,MouseX+16,MouseY+16)=0 249 | 250 | For M=0 To 1000 251 | If Pigs(M)\Z=5 And Hit=0 252 | If SpritePixelCollision(Pigs(M)\Typ,Pigs(M)\X-X,Pigs(M)\Y,103,MouseX+16,MouseY+16) 253 | A.f=Abs(Pigs(M)\DirX*Pigs(M)\Z) 254 | Points+A 255 | Pigs(M)\DirY+8 256 | Pigs(M)\DirX=0 257 | Hit=1 258 | EndIf 259 | EndIf 260 | 261 | If Pigs(M)\Z=1 And Hit=0 262 | If SpritePixelCollision(Pigs(M)\Typ,Pigs(M)\X-X,Pigs(M)\Y,103,MouseX+16,MouseY+16) 263 | A.f=Abs(Pigs(M)\DirX*Pigs(M)\Z) 264 | Points+A 265 | Pigs(M)\DirY+8 266 | Pigs(M)\DirX=0 267 | Hit=1 268 | EndIf 269 | EndIf 270 | Next 271 | 272 | 273 | EndIf 274 | EndIf 275 | 276 | 277 | 278 | 279 | EndIf 280 | 281 | 282 | OldMouseState=MouseButton(1) 283 | 284 | If EGun=0 285 | If MouseButton(2)=1 And OldMouseState=0 And Gun<5:Gun=5:Points-5:EndIf 286 | OldMouseState2=MouseButton(2) 287 | EndIf 288 | 289 | If EGun=1 290 | If MouseButton(2)=1 And OldMouseState=0 And Gun<8:Gun=8:Points-6:EndIf 291 | OldMouseState2=MouseButton(2) 292 | EndIf 293 | 294 | If EGun=2 295 | If MouseButton(2)=1 And OldMouseState=0 And Gun<32:Gun=32:Points-6:EndIf 296 | OldMouseState2=MouseButton(2) 297 | EndIf 298 | 299 | 300 | 301 | If EGun=0 302 | For M=0 To Gun 303 | DisplayTransparentSprite(100,640-M*20,400) 304 | Next 305 | Else 306 | For M=0 To Gun 307 | DisplayTransparentSprite(101,640-M*20,400) 308 | Next 309 | EndIf 310 | 311 | 312 | DisplayTransparentSprite(0,MouseX,MouseY) 313 | FlipBuffers() 314 | 315 | If KeyboardPushed(#PB_KEY_LEFT):X-5:EndIf 316 | If KeyboardPushed(#PB_KEY_RIGHT):X+5:EndIf 317 | 318 | If MouseX>608:X+5:EndIf 319 | If MouseX<1:X-5:EndIf 320 | 321 | If X<0:X=0:EndIf 322 | If X>1920-640:X=1920-640:EndIf 323 | 324 | 325 | Until KeyboardPushed(#PB_KEY_ESCAPE) Or GetTickCount_()-Start>120000 326 | 327 | MessageRequester("Punkte:",Str(Points)) 328 | 329 | ; ExecutableFormat=Windows 330 | ; UseIcon=C:\CDROM\2\1.ico 331 | ; Executable=C:\CDROM\2\GAME3.exe 332 | ; DisableDebugger 333 | ; EOF -------------------------------------------------------------------------------- /flying pigs/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /flying pigs/daten/1.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/1.bmp -------------------------------------------------------------------------------- /flying pigs/daten/1.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/1.wav -------------------------------------------------------------------------------- /flying pigs/daten/10.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/10.bmp -------------------------------------------------------------------------------- /flying pigs/daten/11.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/11.bmp -------------------------------------------------------------------------------- /flying pigs/daten/12.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/12.bmp -------------------------------------------------------------------------------- /flying pigs/daten/13.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/13.bmp -------------------------------------------------------------------------------- /flying pigs/daten/14.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/14.bmp -------------------------------------------------------------------------------- /flying pigs/daten/15.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/15.bmp -------------------------------------------------------------------------------- /flying pigs/daten/16.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/16.bmp -------------------------------------------------------------------------------- /flying pigs/daten/17.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/17.bmp -------------------------------------------------------------------------------- /flying pigs/daten/18.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/18.bmp -------------------------------------------------------------------------------- /flying pigs/daten/2.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/2.bmp -------------------------------------------------------------------------------- /flying pigs/daten/3.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/3.bmp -------------------------------------------------------------------------------- /flying pigs/daten/4.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/4.bmp -------------------------------------------------------------------------------- /flying pigs/daten/5.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/5.bmp -------------------------------------------------------------------------------- /flying pigs/daten/6.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/6.bmp -------------------------------------------------------------------------------- /flying pigs/daten/7.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/7.bmp -------------------------------------------------------------------------------- /flying pigs/daten/8.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/8.bmp -------------------------------------------------------------------------------- /flying pigs/daten/9.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeprof/small-PureBasic-projects/c8b00232057b4d0f7173f918f56e2586cb1b0d1f/flying pigs/daten/9.bmp -------------------------------------------------------------------------------- /nAgent/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /nCPU/LICENCE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /nCPU/nCPU.pbi: -------------------------------------------------------------------------------- 1 | 2 | 3 | ; ************************************************************************************* 4 | ; * 5 | ; * Function: nCPU_UseCPU (lFlags.l) 6 | ; * 7 | ; * Description: Decalares which CPU(s) should be used for the current thread. 8 | ; * 9 | ; * Parameters: lFlags.l can be: 10 | ; * 1: for the first processor 11 | ; * 2: for the second processor 12 | ; * 1+2: for the first and the second processor 13 | ; * 14 | ; * Return: If the function succeeds, the return value TRUE. 15 | ; * If the function fails, the return value is FALSE. 16 | ; * 17 | ; ************************************************************************************* 18 | 19 | ProcedureDLL.l nCPU_UseCPU(lCPU.l) 20 | ProcedureReturn SetThreadAffinityMask_(GetCurrentThread_(),lCPU) 21 | EndProcedure 22 | 23 | 24 | ; ************************************************************************************* 25 | ; * 26 | ; * Function: nCPU_GetMhz () 27 | ; * 28 | ; * Description: Returns the frequency of the Processor. (in MHz) 29 | ; * 30 | ; * Parameters: n/a 31 | ; * 32 | ; * Return: Look at description. 33 | ; * 34 | ; ************************************************************************************* 35 | 36 | ProcedureDLL.l nCPU_GetMhz() 37 | Protected SysInf.System_Info, dTime.d, lKey.l, lcpuid.l, lMHz.l, lResult.l, lSize.l=4, qticks1.q, qticks2.q, qFreq.q, qTime1.q, qTime2.q 38 | 39 | ; First try to get the value from the registry.( should work for Windows 2000 and Windows XP) 40 | lResult=RegOpenKeyEx_(#HKEY_LOCAL_MACHINE,"HARDWARE\DESCRIPTION\System\CentralProcessor\0",0,#KEY_ALL_ACCESS,@lKey) 41 | If lResult=#S_OK 42 | RegQueryValueEx_(lKey,"~MHz",0,0,@lMHz,@lSize) 43 | RegCloseKey_(lKey) 44 | EndIf 45 | 46 | If lMHz>0 47 | ProcedureReturn lMHz 48 | EndIf 49 | 50 | ; Ok, we can't get the value form the registry, so we must calculate it: 51 | ; This method may works not correctly, if the CPU runs not with full speed! 52 | 53 | GetSystemInfo_(SysInf) 54 | If SysInf\dwProcessorType<#PROCESSOR_INTEL_PENTIUM 55 | ; CPUID is supported since Pentium, and this processor is not at least a Pentium. 56 | ProcedureReturn 0 ; return zero, as we need CPUID. 57 | EndIf 58 | 59 | !MOV Eax, 1 60 | !cpuid 61 | !MOV [p.v_lcpuid],Edx 62 | 63 | If (lcpuid>>4)&1=0 ; RDTSC available? (we need a Pentium Pro for this) 64 | ProcedureReturn 0 ; If not, return zero, as we need RDTSC. 65 | EndIf 66 | 67 | If QueryPerformanceFrequency_(@qFreq.q)=0 68 | ;high performance counter is not supported! 69 | ProcedureReturn 0 ; return zero, as we need a high performance counter. 70 | EndIf 71 | ; so now we can calculate the value, and hope that it is correct. 72 | 73 | QueryPerformanceCounter_(@qTime1.q) ; we need to calculate the needed time, because Sleep(10) waits not exactly 10 ms. 74 | !RDTSC 75 | !MOV dword[p.v_qticks1],Eax 76 | !MOV dword[p.v_qticks1+4],Edx 77 | 78 | Sleep_(10) ; Wait some time... to get exacter values increase this value.(with 10 ms you should get good values.) 79 | 80 | !RDTSC 81 | !MOV dword[p.v_qticks2],Eax 82 | !MOV dword[p.v_qticks2+4],Edx 83 | QueryPerformanceCounter_(@qTime2.q) 84 | 85 | dTime.d=(qTime2-qTime1)/qFreq 86 | 87 | ProcedureReturn ((qticks2-qticks1)/dTime)*0.000001 88 | EndProcedure 89 | 90 | 91 | 92 | ; ************************************************************************************* 93 | ; * 94 | ; * Function: nCPU_GetNumber () 95 | ; * 96 | ; * Description: Returns the number of processors in the system. 97 | ; * 98 | ; * Parameters: n/a 99 | ; * 100 | ; * Return: Look at description. 101 | ; * 102 | ; ************************************************************************************* 103 | 104 | ProcedureDLL.l nCPU_GetNumber() 105 | Protected SysInf.System_Info 106 | GetSystemInfo_(SysInf) 107 | ProcedureReturn SysInf\dwNumberOfProcessors 108 | EndProcedure 109 | --------------------------------------------------------------------------------