Debug Replacement - Socoder
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
spinal
nerdly error 1
spinal
blitz3d error array
Pakz
pixelArtPoster26x6
steve_ancell
434309993 ... 31684153 n
steve_ancell
432365916 ... 86179983 n
steve_ancell
432314655 ... 69078089 n
steve_ancell
431956005 ... 97119998 n
steve_ancell
432407365 ... 66476721 n
steve_ancell
419385028 ... 85737358 n
Pakz
6x6filtersoc
Undock Sidebar
Scrolling tiles
Jayenkai
(Thu 12:16)
QOTD - March 2024
Jayenkai
(Thu 05:15)
Glutton for punishment?
cyangames
(Wed 04:36)
Mmmmmm Soldering is fun
cyangames
(Wed 04:23)
AGameAWeek 2024
Jayenkai
(Wed 03:45)
Happy Birthday, Spinal
cyangames
(Tue 07:23)
Amazon Same Day
Jayenkai
(Mon 10:08)
Twisted Metal : The Series
Pakz
(Mon 08:09)
Blogs - Generating pixel art with filtering
Jayenkai
(Sun 02:36)
Ghostbusters Afterlife
therevillsgames
(Sat 23:57)
Steve's Car
steve_ancell
(Sat 14:40)
Suno/Bing Tunes
Jayenkai
(Fri 20:03)
Getting Back to iOS Dev
cyangames
(Fri 12:03)
Happy Birthday, Evil Roy Ferguson
Pakz
(Fri 10:17)
OpenAI Chat
Pakz
(Fri 04:29)
Beetlejuice 2
Jayenkai
(Thu 16:15)
Showcase - Emu's Massive Hunt [Vic 20 +35K]
AndyH
(Wed 07:47)
Happy Birthday, therevillsgames
therevillsgames
(Wed 04:36)
Flap Happy and Fancy Free!
cyangames
(Tue 07:00)
Happy Birthday, TKS
Jayenkai
(Mon 15:18)
Leonardo Adds Transparency
cyangames
(Mon 07:54)
Funko Pops
cyangames
(Mon 04:58)
Fraggle Rock
Jayenkai
(Sat 10:04)
Pakz' New Site
Jayenkai
(Sat 05:55)
Picard Season Three
Pakz
(Sat 00:28)
My Threads
|
More
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987
0|685|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.102
Debug Replacement - Socoder