Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / AGK Console Plugin (Win32)

Author
Message
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 22nd Oct 2018 01:54 Edited at: 26th Oct 2018 02:02



Hey fellas,
I've attached a win32 and win64 Console plugin for AGK2, as I have not managed to find one.

This Plugin can open a console window in win32 applications in order to write stuff:

Nice for debugging, if you do not want to bloat your render screen with text and print.
You are also able to write chars to a specific area in the console,
so you can build some serious debug screens with updating values.



Version 1.0 (x32)
Download: https://forum.thegamecreators.com/attachment/82639

Version 1.1 (x32)
Download: https://forum.thegamecreators.com/attachment/82644

Version 1.2 (x64 support from here on)
Download: https://forum.thegamecreators.com/attachment/82649

Version 1.3 (console handle commands)
Download: https://forum.thegamecreators.com/attachment/82681






The command set:


Console.Init(int MaxLines,CloseableFlag)
- initialize the console in agk - Maxlines: maxial lines in the console to be shown
Console.SetTitle(String$) - set a title for the console
Console.SetColor(int color) - set text color (0-255)
Console.Clear() - similar to cls, can also apply the background color, when setColor is used
Console.SetString(int px, int py,String$) - set a specific text on a specific position in the console
Console.PrintCon(String$) - writes a string to the console
Console.SetSize(x,y) - Sets the console window size, as far as windows lets you
Console.SetVisible(state) - toggles console visibility
Console.Version() - prints the version of this plugin to console
Console.SetPosition(x,y) - Sets the console window position
Console.SetBufferSize(x,y) - Sets the console buffer size
Console.Close() - closes the console
Console.SetHandle(int) - Sets console handle to write to
int = Console.GetHandle() - Get current console handle

I am trying to keep it as simple as possible, in order to port it to all possible platforms later on.
Maybe I could also do a mac and linux version aswell.

It can be as easy as:
Quote: "

#import_plugin Console
Console.Init(20,0)
do
Console.SetString(1,1,"FPS: "+str(ScreenFPS(),4))
sync()
loop
"

to add a console.


Example Code (1.0):





Example Code (1.1 and later):




Enjoy!
Please report any bugs or feature requests here.

[/url]

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Oct 2018 02:08 Edited at: 22nd Oct 2018 02:08
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 22nd Oct 2018 17:22 Edited at: 23rd Oct 2018 01:29
I will, once I polish it up
It's actually just a small weekend project.

Meanwhile there is an update! Version 1.1 released with new commands and a better management!
I update the first post. The x64 version is also done soon.

EDIT:I went 1.2 for the x64 release, in order not to mess everything up.
If there is a notable demand, I try to add mac and linux support.

[/url]

Attachments

Login to view attachments
Bengismo
7
Years of Service
User Offline
Joined: 20th Nov 2017
Location: Yorkshire, England
Posted: 22nd Oct 2018 21:19 Edited at: 22nd Oct 2018 21:21
This is nice and looks good. Great effort

but... You do know there is a Log() function which allows you to send information/debug outputs etc... to AGK's console for debugging right? This is built into AGK

You just use Log("Hello") and you get hello in AGK's debug menu when you debug a program. You can print out text and variable values easily etc...This also works when debugging on other devices on a network too. So you can debug on a networked android device which writing in windows and get the debug console on your PC for the android device. Its cross platform and works really well. You can get console info back from a local program running on PC or a remote device. It even works on raspberry pi and linux reporting back to windows. Just putting this out there as many people may not be aware of this useful functionality.
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 22nd Oct 2018 23:02
It would be great if you could get and set the window handle for the process.
So that multiple .exe's could access the same window
Cliff Mellangard 3DEGS
Developer
18
Years of Service
User Offline
Joined: 20th Feb 2006
Location: Sweden
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 23rd Oct 2018 15:47 Edited at: 23rd Oct 2018 17:04
Thank you for the replies!
@Bengismo
The debug console is only available while you are developing in AppGameKit T1 Editor. If you have some kind of installation with a second monitor and no AppGameKit on the machine, a console will do great work! The Log(num) fuction does actually return the logarithm of num though there are logging commands for the debug console.

@blink0k
Do you mean to return the handle in T1 in order to pass it to another program and something like Console.SetHandle(handle) to aquire control?
Neat idea. I will see what I can do.

Another idea would be to allow unicode chars in the console. I think it should be possible, or is it?

[/url]

Attachments

Login to view attachments
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 23rd Oct 2018 21:45
Quote: "Do you mean to return the handle in T1 in order to pass it to another program and something like Console.SetHandle(handle) to aquire control?
Neat idea. I will see what I can do."

Yes. Would be very handy as then you could use RunApp() to break up your App into manageable pieces
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 24th Oct 2018 02:34 Edited at: 24th Oct 2018 02:35
It seems that I can get the window handle and pass it to agk as an integer, but I don't know if it's right :S
I still have to figure out how to lead all console calls to the new window handle..

Any ideas?

[/url]
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 24th Oct 2018 03:24
Out of my league i'm afraid but stackoverflow would be a good place to start
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 24th Oct 2018 18:18 Edited at: 24th Oct 2018 20:11
Nevermind, it just started to work! - 1.3 will have the console handle features. It was not bound to the window handle, but to the processId

Central question before 1.3 is:

Is there any chance to pass an unicode string from AGKT1 to C++ in order to get unicode console writing? This would be very neat

I just want to add this and simple drawing commands. It would be actually an interesting question how the std:cout calls are directed, if we go for a T1 console only application (without to initialize the console from this plugin) - They should be allocated to the legit console, but I don't know yet. :S

I managed to set the whole project to unicode and change all the required const chars*. I also see, that consolas, the native windows console font, does not have any unicode chars at all! So there will be also a SetFont function for the console soon.

[/url]
Jack
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: [Germany]
Posted: 26th Oct 2018 02:00 Edited at: 26th Oct 2018 02:07
I have managed to port most of the code to unicode, but I can't get even the extended character string from AppGameKit :/ if I create a const char* in VS, it works with unicode, but not with the const char* passed from AppGameKit
Just have to move on to UDP Sockets, so I close the development on this tiny windows console plugin. If someone want to develop in further, just PM me! Or post here first^^

1_3 is available now , with console handle feature!

[/url]

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-11-23 12:00:02
Your offset time is: 2024-11-23 12:00:02