Useful Tips

BlitzPlus Forums/BlitzPlus Tutorials/Useful Tips

NoremacSkich(Posted 2012) [#1]
This is going to be a place where coding practices are posted and it will also house links to useful sites


NoremacSkich(Posted 2012) [#2]
Here is a great site for learning more on how to program in Blitz Plus. The website says that the language used is Blitz Basic, but it also works out for Blitz Plus.

http://www.bettiesart.com/tc/blitz/


NoremacSkich(Posted 2012) [#3]
;+----------+
;|  Note 1  |
;+----------+
;
;   You can put multiple lines of code into a single line
;   
;   Ex:
;
;     +-----------+
;     | y = y + 1 |
;     | x = x + 1 |
;     +-----------+
;
;   could be typed as
;
;     +-----------------------+
;     | y = y + 1 : x = x + 1 |
;     +-----------------------+
;
;   BUT
; 
;   You CANNOT put a single line of code into multiple lines
;
;   Ex:
;
;     +-------------------------------------+
;     | if x = 3 and y = 11 and z = 15 then |
;     +-------------------------------------+
;
;   CANNOT be written like this, because there is no support for it in Blitz Plus:
;
;     +----------------+
;     | if x =  3 And  |
;     |    y = 11 And  |
;     |    z = 15 Then |
;     +----------------+
;



ozzi789(Posted 2012) [#4]
Howto make B+ Windows 7 ready


1. Use OGL for more Performance in 2D Stuff

Before Graphics use
SetGfxDriver 2

and use
api_ExitProcess(0) 

.lib "kernel32.dll"
api_ExitProcess (uExitCode%) : "ExitProcess" 

instead of END in your programm.



2. Use Windows 7 Style

-Download Ressource Hacker
-Use this Manifest file and save it with your notepad.
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity
    version="1.0.0.0"
    processorArchitecture="X86"
    name="MyCompany.MyLabel.MyAppName"
    type="win32"
/>
<description>MultiMedia BoardCast/Scheduler.</description>
<dependency>
    <dependentAssembly>
        <assemblyIdentity
            type="win32"
            name="Microsoft.Windows.Common-Controls"
            version="6.0.0.0"
            processorArchitecture="X86"
            publicKeyToken="6595b64144ccf1df"
            language="*"
        />
    </dependentAssembly>
</dependency>
</assembly>

-Start Ressource Hacker
- File -> Open -> Choose your EXE
- Action -> Add new Ressource -> Choose Manifest file
Resource Type: 24
Resource Name: 1
Resource Language: 1033
- File -> Save

Here a screencap to compare:
http://www.blitzforum.de/upload/file.php?id=11346




3. Styled Progbars
Use google translate on this page ;)
http://www.blitzforum.de/forum/viewtopic.php?t=35507



4. Use Windows 7 Superbar

Looks like:


;CODED BY NIDCEL
;http://www.blitzforum.de/forum/viewtopic.php?t=33706&highlight=

;user32.decls
;api_FindWindow% (lpClassName$, lpWindowName$) : "FindWindowA"

Const TBPF_NOPROGRESS = 0, TBPF_INDETERMINATE = 1, TBPF_NORMAL = 2, TBPF_ERROR = 4, TBPF_PAUSED = 8

AppTitle("Superbar-Test")
Graphics 130,20,32,2


hwnd = api_FindWindow("BLITZMAX_WINDOW_CLASS", "Superbar-Test")


Local i# = 0, state = 2
Color 0,230,0

Local timer = CreateTimer(20)


Repeat

   ShowProgress(hwnd,Int(i),100,state)
   
   i = i + 1
   
   If i > 100
   
      i = 0
      
      If state = 2
      
         state = 4
         
         Color 230,0,0
         
      ElseIf state = 4
      
         state = 8
         
         Color 255,200,0
         
      ElseIf state = 8
      
         state = 2
         
         Color 0,230,0
         
      EndIf      
      
   EndIf
   
   Text 0,0,Int(i)+"% | State: "+state
   
   Flip 0
   
   Cls
   
   WaitTimer timer
   
Until KeyHit(1)

End