flat assembler
Message board for the users of flat assembler.
Index
> Windows > Way to draw a fast terminal emulator type text window? |
Author |
|
edfed 25 Nov 2011, 18:56
look at the tinypad example in fasmw package, and you will have your answer for a little part of your problem.
|
|||
25 Nov 2011, 18:56 |
|
mindcooler 27 Nov 2011, 04:00
You are saying that I should use a built-in window class like a RichEdit or something? Somehow I doubt that would be very fast. And I have no idea how to work with those.
|
|||
27 Nov 2011, 04:00 |
|
mindcooler 27 Nov 2011, 04:18
I'm thinking of dumping the idea of a gui and just going for a cui solution. What is the best way of drawing to the console? Perhaps it's as slow to draw?
|
|||
27 Nov 2011, 04:18 |
|
mindcooler 27 Nov 2011, 22:22
Seems like the way to go is WriteConsoleOutput and ReadConsoleInput. Instead of simulating a console with gui, I'm going to see how you can do the opposite
|
|||
27 Nov 2011, 22:22 |
|
typedef 27 Nov 2011, 22:57
it;s actually very easy to implement.
Just paint the background to black. And start at the top with a static(will work best) or edit control. On each return you append another one but keeping the size and disabling the previous one. Use EM_KEYDOWN / (specifically WM_CHAR : http://msdn.microsoft.com/en-us/library/aa932721.aspx ) to handle the keypress. For history you can "cache" the input to a file or just have like 3 or X amount char * buffers to keep your history. Very easy huh |
|||
27 Nov 2011, 22:57 |
|
mindcooler 27 Nov 2011, 23:01
Well, i suppose a control matrix would have been a solution too. Somehow it sounds a bit resource ineffective though
|
|||
27 Nov 2011, 23:01 |
|
f0dder 28 Nov 2011, 21:29
If you're dealing with monospace fonts, you can prerender all the glyphs you need (to a single) bitmap, and then do simple & insanely fast BitBlt's from that to your surface area.
|
|||
28 Nov 2011, 21:29 |
|
mindcooler 28 Nov 2011, 23:31
That would actually be quite nice. The fonts needn't even be monospaced.
Still, I'm going for a no-frills KISS design. I'm new to serious console programming, so it'll be an adventure! |
|||
28 Nov 2011, 23:31 |
|
f0dder 28 Nov 2011, 23:42
BitBlt is pretty simple and KISS
If you want to look at how other people do it, you could take a look at the PuTTY source code - haven't looked at it myself, but my guess is it that (at least the screen drawing) should be straightforward to follow. As for textmode console, WriteConsoleOutput should be fast enough for anything "normal". Haven't tried 60fps "video" playback with it, but I wouldn't classify that as "normal" |
|||
28 Nov 2011, 23:42 |
|
mindcooler 28 Nov 2011, 23:44
I thought that if there are scene demos getting a good framerate out of the console, it's fast enough for me
|
|||
28 Nov 2011, 23:44 |
|
mindcooler 01 Nov 2012, 21:54
Yeah, working with the console at higher resolution turned out to be a pain, so I will probably scrap this idea. Turns out you only have 64k total for console buffers and console buffer character buffers
Think I'm going back to something I tried in this unfinished project, CUI in GUI with mouse-draggable 'flap windows' and context menus: http://files.sys5.se/mieulwkh.exe _________________ This is a block of text that can be added to posts you make. |
|||
01 Nov 2012, 21:54 |
|
nmake 01 Dec 2012, 17:51
I have made two terminals. The first one I used GDI+ for the first one and the second one I used GDI for. Do not underestimate the work involved. Both supports full screen.
You want to avoid edit controls at all cost. They are slow as hell when they start to fill up. I coded both of mine using custom code from scratch and it's very fast. ExtTextOut is the fastest text drawing function, all others are wrappers of this. http://i.imgur.com/UVRKq.png?1 You can customize font settings and different stuff in an ini file, here I go full screen by issuing the command 'full' and changed font size to a larger font. http://i.imgur.com/kr42U.png It supports unlimited amount of text and terminal does not slow down anything whether the buffer is full or empty, speed stays the same. When you resize the window, it resizes by characters and not by pixels just like cmd.exe does. It supports scrolling, using customized scroll functions and dib sections. ini file supports different colors for input text and for output echo text so that it is easier to see what you typed and what is echo back. It also supports setting maximum MB of memory dedicated for the buffer. You can easily create commands by using a sophisticated macro, creating new commands is very easy. When you type something and press enter, what you typed will be remembered in a history buffer that you can scroll through using up and down arrow keys. In cmd.exe it will remember everything you type but in my editor it will only remember unique input text, if you type 1 and 1 after one another, it will only remember one instance of that since it has been repeated. You can set maximum lines in the history buffer in the ini file, it is set to 100 by default. Editor uses many lookup buffers like character width and height are in lookup buffers. Positions and stuff like that are also pre-buffered, the same goes for resizing your window, it looks up precalculated position values instead of calculating it on the run. Again, do not underestimate the work involved by creating a terminal from scratch. My terminal is 5040 lines of assembly code, but it is highly optimized and has far better viewing and readability than the crappy cmd.exe Compared to putty, my terminal is about up to 10 times faster. |
|||
01 Dec 2012, 17:51 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.