Intel sponsors gamedev.net search:   
Adventures in Text-modeBy Twisol      
In order of no progress to done: Red, Orange, Yellow, Blue, Light blue, Green, Light green.

Last updated 2/12/09 at 12:01 am PST

Cripes! 2.0 -- See the Class Layout

Arenamatic Code w/ cConsole


Saturday, September 30, 2006
I've been trying to post 1-2 times here, once early and once late, so here's my late post.

Today I took to the task of splitting my .h files, which had class declarations AND definitions, into .h's with declarations and .cpp's with definitions. Took me a LONG while to actually figure out how to do it properly, with thanks going to P16.. wow, "P16" looks a lot like PIG.

Uhm.. I'm not sure if I want him to read that...

EDIT: Ooh, I'm going to have to start watching for when my journal viewcount hits 1337.

Comments: 0 - Leave a Comment

Link



Friday, September 29, 2006
Project 2 of the C++ workshop was unveiled.. I'm going to have to work hard to get that done. It really looks tough.. meaning, I've never done something as big as that before. Big being relative to what I have done before.

On other news, I've uploaded the [at the time] current versions of cConsole, my console-manipulation class (done but not polished, as the todo list states), and the source code and executable for "Consolian Arenamatic", my program for Project 1 of the C++ Workshop. Check the to-do list for details.

I've done away with the 'keys' string in cConsole I mentioned, and I'm working on the store. I've added two classes, armor and weapon, to hold the values for current armor and weapon ("*player.equip[0] = new armor", for example, though 'equip' isn't in player.h in the uploaded .zip), and now I just have to work on the store itself, and buying stuffs. Yay. Then I go on to the arena.

Hmm. Does anyone even read this, besides Programmer16? If you do, please comment... I feel all alone.

EDIT: I just realized the .zip had a VERY old version of the .exe! Oops!

Comments: 5 - Leave a Comment

Link



Thursday, September 28, 2006
First of all, thanks to Programmer16 for his suggestion that I let getKey() take the keys as a parameter instead of just reading the string off of cConsole. I might as well get rid of the 'keys' string now since it's redundant. Thanks P16!

The character creation stuff is nearly done, just have to add in the formula for getting the health of the player. I experimented with making a console.conArt() function that would take some collection of hexadecimal color codes (like how I use output()), a length, a width, and a point in the buffer to start outputting the semi-ASCII art. Well, it was far too difficult to code, so I'm dropping that idea.

After I finish with removing 'keys' and adding the health formula in character creation, I'm moving on to the store. I'll probably have to add "int armor" and "int weapon[3]"; into the cChar class (what I use to hold the player's data). 'armor' basically holds an integer which "means" some unique defence bonus. 'weapon' holds three values: the attack bonus of the weapon, the battle roll(s) needed to count a critical strike, and the critical strike modifier (2 or 3), which means how many more times the attack hits to count for the crit.

Oi. I think I might just make a class "armor" and a class "weapon" to hold these values, then do "player.armor = new armor" or something like that. Seems a bit easier on the brain.

Comments welcome. :)

Comments: 1 - Leave a Comment

Link



Wednesday, September 27, 2006
I made a sort of cin-esque function, except it's specifically for console-buffer type applications like mine. I'm using it in the actual project to have the player input a character name. The kewl thing about it is, not only can you set what keys you want to use (as usual), you can also set precisely where you want the input to appear at.

I'm gonna update my project progress list above my journal, and for future information, 'green' means it's done, and 'lightgreen' means it's practically perfect in my eyes. :D

Comments: 0 - Leave a Comment

Link



Tuesday, September 26, 2006
I've, like, neglected this thing. Not to mention GDNet+ expired on me. I've moved on from my Arena Battle project.. in retrospect, it was getting kind of convoluted. I'm now working on something totally new for me... Project 1 in the C++ Workshop!

No, seriously, it's new! You have to color the output, so I Googled around and found this. Encapsulating it in a class (cConsole), and setting a few functions for easy manipulation, I've created an easy interface with the console screen. I can color output with output(), and check specific keypresses with getKey().

Oh, getKey().. I just love it. I'll code-tag it here, and explain it, although all you C++ gurus out there should be able to understand it just fine. I just like explaining. :D

char cConsole::getKey()
{
    while (true)
    {
        GetNumberOfConsoleInputEvents(rHnd, &numEvents);
        if (numEvents == 0) continue;

        INPUT_RECORD *eventBuffer = new INPUT_RECORD[numEvents];
        ReadConsoleInput(rHnd, eventBuffer, numEvents, &numEventsRead);

        int i = 0;
        for (; i < numEventsRead;)
        {
            if (eventBuffer[i].EventType == KEY_EVENT)
            {
                int j = 0;
                while (j <= keys.length())
                {
                    if (eventBuffer[i].Event.KeyEvent.wVirtualKeyCode == keys[j])
                    {
                        delete eventBuffer;
                        break;
                    }
                    j++;
                }
                if (j == keys.length() + 1)
                {
                    i++;
                    continue;
                }
                else return keys[j];
            }
            else
            {
                i++;
                continue;
            }
        }
    }
}






To start with, I have a public string variable in cConsole (don't yell!) that the user can set to, say, "123". This function cycles through any events that occur until a key event occurs. Then it cycles through the 'keys' string I mentioned, checking the key event against each character in 'keys', until it finds a match or cycles the whole string. If the iteration variable 'j' is 1 more than the string length, then it didn't find a match, and it continues. Otherwise, it returns the char that was matched, so the calling function can deal with it.

I love it. :D

Comments: 2 - Leave a Comment

Link


All times are ET (US)

 
S
M
T
W
T
F
S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25

OPTIONS
Track this Journal

 RSS 

ARCHIVES
August, 2009
July, 2009
March, 2009
February, 2009
December, 2008
November, 2008
October, 2008
August, 2008
July, 2008
June, 2008
May, 2008
April, 2008
November, 2007
July, 2007
June, 2007
May, 2007
April, 2007
March, 2007
February, 2007
December, 2006
October, 2006
September, 2006
July, 2006
May, 2006
April, 2006