Conio module (WIN32)
BlitzMax Forums/BlitzMax Programming/Conio module (WIN32)
| ||
Heres a module wrapper for the Conio library (Console IO) for WIN32. Functions to print colored text anywhere in a console window. The library just wraps the relevant Win32API calls but its a much nicer interface ;) I also added some handy utility functions. Enjoy! EDIT: updated, added functions to resize the window & buffer Download |
| ||
Heres screenshot for the lazy.. hehe![]() |
| ||
I think people might show more/any interest if they knew what it was/what its useful for. |
| ||
hmm.. i suppose your right, although its realy nothing special. Its just some functions that allows you to print colored text anywhere in a console/terminal. With a few helper functions for making boxes,lists,etc and convert an attributed string into something that can be printed example: ' $00-15 = background color ' #00-15 = foreground color PutString( 1,1, "$09#14Press any key to exit...") I needed this for a console based vm debugger im working on, and i thought others might have use for it as well. |
| ||
Thanks! I don't know if I will do something with it but anyhow it's cool ;) |
| ||
I have a bug. Running Windows Vista Home Basic, fully updated. ![]() |
| ||
hmm.. thats wierd, seems like vista is using a font that doesnt handle extended characters properly. It could also be your language set (if any) that has rearranged the table (unlikely). Open the console properties and check the font tab, and post what font its using. And could you post a screen of the chartab.exe example also? It should be similar to the screenshot i posted above. Also test the included example exe's to see if they do this too. Sorry i dont have vista to test myself :/ |
| ||
Yeah, I'll try to work out a fix for you. It doesn't seem to be a big issue. EDIT: Ran chartab.exe and there does seem to be missing characters. I changed the font and same result. I'll see what I can do to patch this. |
| ||
Thanks, much appreciated =) |
| ||
I added 2 new functions to resize the console window and set its buffer (removes the ugly scrollbars ;) Its done automatically by InitConio() & FreeConio() (they just handle common start/end stuff you can do manually if needed) |
| ||
Hmm..useless except for a ZZT clone or a BBS. LOL |
| ||
Hmm..useless except for a ZZT clone or a BBS. LOL Heh, most of the things i code are in console mode. So i wouldn't call it useless. |
| ||
I'm sorry, it is probably very useful for other things too. I remember once I made a complete GUI system with ASCII characters. |
| ||
This is very cool :-) A lot of people/companies still use console mode for their UIs (generally it's much faster to navigate a text-only UI than it is to move the mouse and click stuff) Reminds me of curses and stuff on Unix... (now.. there's an idea.....) |
| ||
remember me on a old powerbasic gui cool |
| ||
I suppose it would be handy for some stuff... When I did a fruit machine simulator it all started out on a console, mostly running millions of spins and seeing if the odds were running correctly when lines would drop in. Using this would of tarted it up nicely! :D |
| ||
Is there anyway to get this working when run from the IDE? |
| ||
I guess not. The IDE is not a console terminal. |
| ||
Looks great. Who's going to write the first BlitzMax Dwarf Fortress clone with it then? :) |
| ||
I'm doing a small roguelike. The best choice for the interface would be this C library But sadly, my C skills are not enough to create the interface. Without a reliable curses lib for Bmax, i'm writing my own. |
| ||
Anyone know how to clear the keyboard buffer in grb.conio.mod? |
| ||
Anyone know how to clear the keyboard buffer in grb.conio.mod? I dont know if blitz uses the right security bits, but this should work: Extern "Win32" Const STD_INPUT_HANDLE:Int = -10 Const STD_OUTPUT_HANDLE:Int = -11 Const STD_ERROR_HANDLE:Int = -12 Function GetStdHandle:Int( stdh:Int) Function FlushConsoleInputBuffer:Int( console:Int) EndExtern Function FlushInput() FlushConsoleInputBuffer( GetStdHandle( STD_INPUT_HANDLE)) EndFunction |
| ||
Cheers, I'll give that a go. EDIT: Looks good! I had a little Millisecs() based hack in place that has been duly relegated to a fallback. Const FLUSHKEYS_WITH_GRABLE_CODE:Int = True:D |
| ||
Windows changes so much that I finally decided to make my roguelikes cross compatible by making all my characters and extended characters tiled images that look like text :) |
| ||
Sorry, resurrecting an old topic, and posting a slightly OT response... For those with MaxGui, you could probably create a decent cross-platform technique based on the HTML gadget, for use in Roguelike games. Eg: Seems to work okay on WindowsXP and Mac OS10.5.4.. |