Page 1 of 1

AHKonsole - Class Based Console Library - Tetris!

Posted: 23 Oct 2014, 21:21
by GeekDude
I present https://github.com/G33kDude/Console

It's a wrapper for the win32 console. Currently pretty small, but still very flexible.

Examples:

A syntax highlighter proof of concept:
Image

A (working) IRC client:
Spoiler
Tetris clone!:
Spoiler

Re: Win32 Console Wrapper Library

Posted: 23 Oct 2014, 21:30
by joedf
Very nice!

Re: Win32 Console Wrapper Library

Posted: 30 Oct 2014, 14:36
by GeekDude
Hey @Lexikos, Would it be possible to add a #directive that would make AHK not detach from the command line?

So that something like this won't look so odd, and that the attachconsole call won't be necessary

Code: Select all

DllCall("AttachConsole", "UInt", -1)
FileOpen("CONOUT$", "w").Write("Test")
MsgBox

Re: Win32 Console Wrapper Library

Posted: 30 Oct 2014, 15:20
by joedf
Well i'm not lexikos but, i can tell you that ahk is compiled as a GUI application.. What you probably want is the Console Subsystem. In the preview2 of ahk2exe there is a compile directive that can set the subsystem to console. I made a little ahk2exe wrapper that compiles ahk scripts to exe with the console subsystem.... I could probably make it a lot better.. But What you really want to look at here is this script by Lexikos that changes it for you: https://github.com/joedf/LibCon.ahk/blo ... hk2CLI.ahk

Re: Win32 Console Wrapper Library

Posted: 31 Oct 2014, 10:42
by GeekDude
That script turns a gui application into a console application? Neato! Any reason you're not in the IRC channel joedf?

Re: Win32 Console Wrapper Library

Posted: 31 Oct 2014, 12:29
by joedf
Sometimes I'm there but no so much recently.. :P
I'll try to pop on more often then ;)

Re: Win32 Console Wrapper Library

Posted: 01 Nov 2014, 18:22
by GeekDude
I've gotten palette swapping to work! http://i.imgur.com/FH0DG5x.gif

Re: Win32 Console Wrapper Library

Posted: 01 Nov 2014, 18:23
by joedf
Bejeebus.... Dats Awesome. :D

Re: Win32 Console Wrapper Library

Posted: 03 Nov 2014, 20:44
by GeekDude
I've updated the palette in Syntax.ahk slightly, and fixed a bug in the hex detection (it didn't used to detect hex numbers with 0s in them).

Also, I added a new example script, Embed.ahk. It's a proof of concept for embedding a console as a control in your own gui. I wasn't sure how to fix a rendering issue until I saw @Ronin 's code that had a style which I did not (WS_CLIPCHILDREN). So, thanks Ronins! If you want, I can put you in the ReadMe

Re: Win32 Console Wrapper Library - Tetris!

Posted: 10 Nov 2014, 23:59
by GeekDude
Added a new sample script, Tetris.ahk!

I added some methods for creating and manipulating console buffers, thus allowing me to double buffer my output. This means I can output (in color) the Tetris game screen seamlessly.

Image

Re: Win32 Console Wrapper Library - Tetris!

Posted: 11 Nov 2014, 09:28
by joedf
Shizzle! At this rate, I'll just deprecated Libcon.ahk ;)

Re: AHKonsole - Class Based Console Library - Tetris!

Posted: 24 Nov 2014, 20:26
by joedf
I gotz an Idea, Now as a class it will be much easier!
Console GUI! :D lol AHKonsole.GUI() :D
Image