Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming > #1365

Re: misc: multi-line editing/evaluation...

From BGB <cr88192@hotmail.com>
Newsgroups comp.lang.misc, comp.programming
Subject Re: misc: multi-line editing/evaluation...
Date 2012-03-15 13:09 -0700
Organization albasani.net
Message-ID <jjtic6$8g8$1@news.albasani.net> (permalink)
References <jjlqg2$vbf$1@news.albasani.net> <baa5094c-e27a-482c-b843-6be81b38622c@i18g2000vbx.googlegroups.com> <jjrj81$7vi$1@news.albasani.net> <jjs85t$pcf$1@speranza.aioe.org>

Cross-posted to 2 groups.

Show all headers | View raw


On 3/15/2012 1:10 AM, Rod Pemberton wrote:
> "BGB"<cr88192@hotmail.com>  wrote in message
> news:jjrj81$7vi$1@news.albasani.net...
>> [...]
>> as-is, it uses kind of a lame/hack interface for loading/saving though:
>> "ALT-;" toggles between text-entry mode and console mode (sort of, one
>> first has to type "*start_edit" to bring up the text editor initially).
>> could also consider "CTRL-SHIFT-:" or "CTRL-;" here.
>>
>
> Up for another "bizarre" idea?
>
> It sounds like you're actually using a video-card text mode for the
> text-entry mode ...  Are you?  Can't you create your own "sprites" for an
> ASCII font and use them for "text" in your graphics console mode?  You can
> make them see-through that way.  Didn't you say your text was see-through
> ... ?  If you've done it this way, I don't understand what the problem is.
>


actually, it is all done in-program already.

the console is itself rendered using OpenGL, hence why it is translucent.


a lot of the console code is fairly old, and I haven't messed with it 
much in years (until recently).

however, the "style" of the console is similar to that of the HW 
textmode, with the most obvious difference being that both the 
characters and color/flags-codes are 16 bits.


so, main console:
conbuf: big 2D grid of 16-bit characters (theoretically, Unicode BMP).

conclr: big 2D grid of 16-bit color/status values.
the low 8 bits are used for the foreground and background colors, and 
use the same basic layout and color palette as in text-mode;
the other bits currently give flags: blink, underline, strike-out, bold, 
italic.


how fonts are done:
externally, they are represented as bitmapped fonts in a custom format. 
the Unicode characters came from an old version of "Unifont".

most of the ASCII-range characters use a custom font, which mostly has 
the merit of improved readability (by having the same character-cell 
size as most of the on-screen characters).

internally, the fonts are handled by generating banks of textures, each 
texture holding a grid of character cells (these textures are generated 
on-demand, by rendering all of the relevant character cells into the 
texture).

when the characters are drawn on-screen, the appropriate textures are 
bound, and the character cells are drawn as quads (with some internal 
added hackishness).


now, as for the UI issues:
this is mostly due to code organization.

my 3D engine isn't built as a single large binary, but rather as a 
collection of DLLs.

as-is, the code for rendering the console (and also the normal load/save 
dialog) is located in one DLL, but the text-editor is in another DLL, 
which can't directly call into the first DLL.


currently, interfacing is done via a shared struct with a bunch of 
function pointers and similar in it, as well as arrays for the console 
buffer and similar.

setting up the editor involves setting function pointers and drawing 
directly into the console buffers.


the contents of the DLL holding the editor in-fact have no access to 
either OpenGL or the 3D renderer (as it is generally code shared between 
the "client" and "server" parts of the 3D engine).


natural result: it can't access the (graphical) load/save dialog. or, at 
least, not without resorting to hacks or code reorganization (such as 
moving the text editor into the 3D renderer).

a possible option could be to write some code for implementing an 
in-console text-based load/save dialog.


so, general DLL dependency graph:
Engine (Main Engine)
-> BTGESV (Server End, "game-logic", ...)
   -> BTGECM, VECMATH, ...
-> LBXGL (Renderer/Client, Higher-level, models/world/etc)
   -> PDGL (Renderer, Lower-level)
     Manages:
       Basic OpenGL stuff
       Textures / Fonts / ...
       Console(drawing)
       Camera, GUIs, Sound, ...
     -> BTGECM
     -> BGBMID (MIDI playback)
     -> Tremor (Xiph.org, alternative Ogg/Vorbis codec)
     -> VECMATH (Vector Math stuff)
     -> ...

BTGECM (Common)
Manages:
   Shared MAP / BSP stuff
   Voxels, Perlin Noise, ...
   Client/Server Network stuff
   Shared Console Stuff:
     Cvars
     Command Evaluation (partly)
     Console Scripts (partly)
     Text Editing UI
-> VECMATH
-> BGBSVM (BGBScript VM Core)
   -> BGBDY, BGBGC, BGBASM, ...
-> BGBNET (Lower-level Network Code: Sockets, ...)
   -> BGBDY (VM Support Code, Dynamic Type-System, ...)
     -> BGBGC (Garbage Collector)
     -> BGBASM (Assembler/Linker)
     -> ...
...

Back to comp.programming | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-12 14:38 -0700
  Re: misc: multi-line editing/evaluation... Rui Maciel <rui.maciel@gmail.com> - 2012-03-12 23:42 +0000
    Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-12 17:39 -0700
  Re: misc: multi-line editing/evaluation... "BartC" <bc@freeuk.com> - 2012-03-12 23:51 +0000
    Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-12 18:29 -0700
      Re: misc: multi-line editing/evaluation... "BartC" <bc@freeuk.com> - 2012-03-13 12:31 +0000
        Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-13 10:03 -0700
  Re: multi-line editing/evaluation... "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-13 02:43 -0400
    Re: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-13 11:12 -0700
  Re: misc: multi-line editing/evaluation... Paul N <gw7rib@aol.com> - 2012-03-14 15:08 -0700
    Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-14 19:11 -0700
      Re: misc: multi-line editing/evaluation... "Rod Pemberton" <do_not_have@noavailemail.cmm> - 2012-03-15 04:10 -0400
        Re: misc: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-15 13:09 -0700
  Re: multi-line editing/evaluation... "Chris Uppal" <chris.uppal@metagnostic.REMOVE-THIS.org> - 2012-03-16 08:54 +0000
    Re: multi-line editing/evaluation... BGB <cr88192@hotmail.com> - 2012-03-16 09:45 -0700

csiph-web