Undock Sidebar
Home
Forum
Showcases
Articles / Tutorials
Code Snippets
Links
Blogs
Newsletter
Wed. Workshop
Search
FAQs
About
Member List
Dev Tools
Log in
Username
Password
Log In
Forgot your Password?
Register
Username
Email
Register
Recent Uploads
Jayenkai
IMG 0986
Jayenkai
IMG 0981
Jayenkai
Kavokian
cyangames
JSE Screen ... 0 17-57-46
spinal
explode ef ... ect 01 mp4
Jayenkai
Photo on 1 ... 15 41 jpg
Jayenkai
IMG 7186
Jayenkai
IMG 0927
spinal
Warehouse ... -53-08 mp4
spinal
Warehouse ... -39-27 mp4
Undock Sidebar
ROG Ally
Jayenkai
(Fri 16:34)
November 2024 Photo Challenge
Jayenkai
(Fri 02:32)
QOTD - November 2024
Jayenkai
(Fri 01:17)
Happy Birthday, TomToad
Dan
(Thu 05:27)
JSE - Optimisationalism 4
cyangames
(Wed 11:01)
Coke's AI Advert
Jayenkai
(Wed 02:43)
Suno/Bing Tunes
Jayenkai
(Tue 17:32)
SnackVerse
Jayenkai
(Tue 16:03)
Snow - Nov 2024
Jayenkai
(Tue 02:02)
Half Life 2 @20
Jayenkai
(Tue 01:56)
Scrolling tiles
Jayenkai
(Mon 17:00)
Pizza Time
cyangames
(Mon 02:38)
ALChoons : Recorded
Jayenkai
(Sat 16:29)
In Search Of Pi
steve_ancell
(Thu 22:02)
Flap Happy and Fancy Free!
cyangames
(Wed 09:52)
Bill&Ted Switch it Up
spinal
(Wed 01:21)
Amstrad Dot Com
therevillsgames
(Tue 03:33)
Poll Chat
Jayenkai
(Tue 01:25)
Greenie's Typing Tutorium
Jayenkai
(Mon 18:15)
Are Filesizes Important?
Dan
(Mon 06:55)
Spiderbots Descend
cyangames
(Mon 03:23)
Xmas Jumpers
Jayenkai
(Fri 17:33)
Site Tweaks - Oct 2024
Jayenkai
(Wed 03:54)
What's A Good 3D Modeller
Jayenkai
(Tue 04:28)
Showcase - Pictorial OK Tarot
Eikon
(Fri 23:03)
My Threads
|
More
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987
0|548|0
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder
->
Snippet Home
->
Misc
LostUser
Created : 19 May 2008
System : Windows
Language : Blitz
Debug Replacement
DebugLog() Replacement
; Debug Replacement Notes ; ----------------------- ; One of the things that annoys me about Blitz Basic 2D is ; that the in-built DebugLog() function outputs to a tabbed ; window, and its not very usable. ; ; So, I coded this solution based upon Rob Farley's "Debug Onscreen Text thingy" (url given below). ; ; It will display the debug entries in your viewing/output ; screen in the top-left hand side, output to the ; DebugLog(), and allow you to seperate phrases using "|" ; and allow you to write directly to a "log.txt" file. ; ; Note: Ideally this would append messages to any existing ; 'log.txt' file, at the moment it just overwrites any ; existing 'log.txt' file. ; ; See examples for more info.
--v
;#################################################################### ;# ;# Debug Replacement for Blitz Basic 2D ;# v0.1b ;# @updated: 19 May 2008 ;# @author: zardon ;# ;# Based upon: ;# "Debug Onscreen Text thingy" by Rob Farley ;# URL: https://blitzbasic.com/codearcs/codearcs.php?code=1337 ;# ;#################################################################### Const debugfile$ = "log.txt" ;-------------------------------------------------------------------- Type t_debug Field txt$ End Type ;-------------------------------------------------------------------- ;random variable assignment animal$ = "fox" ; just a normal debug entry debug("Animal:" + animal$ ) ; this uses the '|' seperator (must have no whitespace post seperator) debug( "Graphcis Width: " + GraphicsWidth() +"|Graphics Height:"+ GraphicsHeight() + "|Graphics Depth: " + GraphicsDepth() + "|GraphicsBuffer: " + GraphicsBuffer() ) ; output all debug debug( "", True ) ; write my debug log file debug( "", False, True ) ; cleanup debug debug_cleanup() ;-------------------------------------------------------------------- ; ; debug() function ; creates a new debug item, ; creates a visual output, ; creates a logfile ; @parameters; ; txt$ (string) = the text to add to the debug ; output$ (boolean) = whether to output to the screen ; mkfile (boolean) = whether to write a log file to the current directory ; @return; ; (boolean) Function debug(txt$="", output=False, mkfile=False) If (txt$<>"") Then ; Handle Seperators If Right(txt,1) <> "|" Then txt$ = txt$ + "|" ty=0 Repeat tx=Instr(txt$,"|") If tx>0 Then outputLeft$ = Left(txt$,tx-1) outputRight$ = Right(txt$,Len(txt$)-tx) ; create a new debug object debug_new( outputLeft$ ) txt$ = outputRight$ EndIf Until tx = 0 End If If (output = True) Then debug_echo() End If If (mkfile = True) Then debug_writelog() End If Return True End Function ;-------------------------------------------------------------------- ; ; debug new() function ; adds a new debug item ; @parameters; ; txt$ (string) = the text to add to the debug ; @return; ; (boolean) ; Function debug_new(txt$) p.t_debug = New t_debug p\txt$ = txt$ DebugLog( txt$ ) Return True End Function ;-------------------------------------------------------------------- ; ; debug output() function ; outputs the debug to the screen ; ; @parameters; ; none ; @return; ; (boolean) ; Function debug_echo() Local y=1 For p.t_debug = Each t_debug Text 1, y, p\txt$ y=y+FontHeight() Next Return True End Function ;-------------------------------------------------------------------- ; ; debug writelog() function ; dumps the contents of the debug type to a .txt file ; ; NOTE: This will OVERWRITE any entries in a 'log.txt' file!!! ; ; @parameters; ; none ; @return; ; (boolean) true ; ; Ideally a log file should search for an existing log file ; and append to it. ; Function debug_writelog() Local path$ = CurrentDir$() fileout = WriteFile(path$ + debugfile$) For p.t_debug = Each t_debug WriteLine(fileout, p\txt$) Next CloseFile(fileout) Return True End Function ;-------------------------------------------------------------------- ; ; debug cleanup() function ; deletes all debug object types ; ; @parameters; ; none ; @return; ; (boolean) true ; Function debug_cleanup() For p.t_debug = Each t_debug: Delete p: Next: Return True End Function
--v
Comments
Copyright
Jayenkai
- 2017+ | Thanks to
Shroom_Monk
for CSS/Dev Tips | Uses a Jay-Tweaked version of
CBParser
.
Page Took : 0.1