I'm writing a program which takes a string (which has invisible escape characters) and it takes those escape characters and based on which escape chars are compared to my string ptr (its being passed) it needs to color the char it corresponds to.
Like... [^ would be white. etc.
so [^lolol
Would print lolol in white.
Thanks :).
Name:
Anonymous2006-05-06 20:56
what.
Are you drawing to a terminal or what?
Name:
Anonymous2006-05-06 21:01
Not quite. But that's not related to the question atm.
Name:
Anonymous2006-05-06 21:03
Let me explain better:
string is "^1lo^2lol"
lets say ^1 was white, and blue was ^2
I need it to print so 'lo' was white and 'lol' was blue.
I just need to figure out how to color those chars seperately.
Name:
Anonymous2006-05-06 21:19
>>1
i've done this before. except i used ` instead of [.
it was lots of fun.
still no clue what your question is though. all i see is a bunch of declaratives, but not a single interrogative in the post.
Name:
Anonymous2006-05-06 21:28
Oh sorry.
Lets say white is.. float fColWhite[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
([0] being R, [1] being G, [2] being B, [3] being A)
And ^1lolol needed to be printed with fColWhite. (fColWhite is the color that ^1 escape char is)
How would I do that?
Name:
Anonymous2006-05-06 22:02
crude, yet functional: void formattyPrint.printString(string inString) {
for (int i(0); i < inString.size(); ++i) {
if (inString[i] == '^') {
normalPrint.changeColour(inString[++i]);
} else {
normalPrint.printCharacter(inString[i]);
}
}
}
Name:
Anonymous2006-05-06 22:03 (sage)
>>7
functional, assuming one disregards the GLARINGLY PAINFUL ERROR, at least.
Name:
Anonymous2006-05-07 0:37
^^^^^^^^^^^^^^^^^^^
Name:
Anonymous2006-05-07 13:05 (sage)
ge?
Name:
Anonymous2006-05-07 16:58
but what is changeColour and what is it doing (obviously passing a string)
Name:
Anonymous2006-05-07 18:00
>>11
Ask >>1, he will surely elaborate on his specific environment.
Name:
Anonymous2006-05-07 18:38
>>11
changeColour is much the same as changeColor, except written in Canadian english. As to what is it doing, it's changing the color that normalPrint normally prints in.
┌───────────────────────────────┐
│ (or A B) │
│ ┌───┐ │
input │ ┌──►│ A │──────────────┐ │ output
stream of │ │ └───┘ ▼ │ stream of
frames │ │ ▲ ┌───────┐ │ frames
──────────┼──● │ │ merge ├─┼──────────►
│ │ │ └───────┘ │
│ │ │ ┌───┐ ▲ │
│ └─────┼────►│ B │──────┘ │
│ │ └───┘ │
│ │ ▲ │
│ │ │ │
│ └───●───┘ │
│ │ │
└────────────┼──────────────────┘
│
│
data base Figure 4.6: The or combination of two queries is produced by operating on the stream of frames in parallel and merging the results.