Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

JeffSventora

Members
  • Posts

    525
  • Joined

  • Last visited

    Never

Posts posted by JeffSventora

  1. I developed a menu system for what is going to soon be my game. It is written in C++ and works right out of the console. Working in the console grants many limitations so I had to find a way to work around that and provide a user friendly interface. Check out what I have so far!

    **Yes, I created checkbox, pretty nifty ehh?**
    ![](http://img580.imageshack.us/img580/3020/serverx.png)

    **And if you are interested in changing colors in the console using C++ here is the file I created to do so.**
    ```
    #ifndef FUNCON_H
    #define FUNCON_H

    #include "Windows.h"
    #include "conio.h"

    // Written by Jeff Sventora
    /*

    This file was created to allow the user to change colors within the Console Screen. The SetCursor function will move the cursor to any position on the console and the ClearScreen() is a custom Cls() function because using system("pause") could get you fired ^^

    Enjoy!

    */

    //***************************************************************//
    //******************** FOREGROUND COLORS ************************//
    //***************************************************************//

    /* Lights */
    #define F_RED FOREGROUND_RED | FOREGROUND_INTENSITY
    #define F_BLUE FOREGROUND_BLUE | FOREGROUND_INTENSITY
    #define F_GREEN FOREGROUND_GREEN | FOREGROUND_INTENSITY
    #define F_YELLOW F_RED | F_GREEN
    #define F_MAGENTA F_BLUE | F_RED
    #define F_CYAN F_GREEN | F_BLUE
    #define F_WHITE F_RED | F_GREEN | F_BLUE

    /* Darks */
    #define F_DRED FOREGROUND_RED
    #define F_DBLUE FOREGROUND_BLUE
    #define F_DGREEN FOREGROUND_GREEN
    #define F_DYELLOW F_DRED | F_DGREEN
    #define F_DMAGENTA F_DBLUE | F_DRED
    #define F_DCYAN F_DGREEN | F_DBLUE
    #define F_DEFAULT F_DRED | F_DGREEN | F_DBLUE

    //***************************************************************//
    //******************** BACKGROUND COLORS ************************//
    //***************************************************************//

    /* Lights */
    #define B_RED BACKGROUND_RED | BACKGROUND_INTENSITY
    #define B_BLUE BACKGROUND_BLUE | BACKGROUND_INTENSITY
    #define B_GREEN BACKGROUND_GREEN | BACKGROUND_INTENSITY
    #define B_YELLOW B_RED | B_GREEN
    #define B_MAGENTA B_BLUE | B_RED
    #define B_CYAN B_GREEN | B_BLUE
    #define B_WHITE B_RED | B_GREEN | B_BLUE

    /* Darks */
    #define B_DRED BACKGROUND_RED
    #define B_DBLUE BACKGROUND_BLUE
    #define B_DGREEN BACKGROUND_GREEN
    #define B_DYELLOW B_DRED | B_DGREEN
    #define B_DMAGENTA B_DBLUE | B_DRED
    #define B_DCYAN B_DGREEN | B_DBLUE
    #define B_GRAY B_DRED | B_DGREEN | B_DBLUE

    static void ConCol(WORD COLOR = F_DEFAULT)
    {
    /* Sample Use */
    // ConCol(F_RED | B_BLUE);
    // ConCol() To set text back to default
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    SetConsoleTextAttribute(hOut, COLOR);
    }

    static void SetCursor(short X, short Y)
    {
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);

    COORD NewPos = {X, Y};
    SetConsoleCursorPosition(hOut, NewPos);
    }

    static void ClearScreen(void)
    {
    HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
    COORD CursorDefault = {0, 0};
    DWORD CharsWritten;
    DWORD ConSize;
    CONSOLE_SCREEN_BUFFER_INFO ScreenBufferInfo;

    if(!GetConsoleScreenBufferInfo(hOut, &ScreenBufferInfo))
    return;

    ConSize = ScreenBufferInfo.dwSize.X * ScreenBufferInfo.dwSize.Y;

    if(!FillConsoleOutputCharacter(hOut, (TCHAR)' ', ConSize, CursorDefault, &CharsWritten))
    return;

    if(!FillConsoleOutputAttribute(hOut, ScreenBufferInfo.wAttributes, ConSize, CursorDefault, &CharsWritten))
    return;

    SetConsoleCursorPosition(hOut, CursorDefault);
    }

    #endif
    ```
  2. @Navi:

    > Actually when I read that and look hard, the sprite looks like it's /in front/ of the grass not on top of it.

    Now that you mention it, it probably would look better if the grass appeared over the player's feet as well as the enemies.
  3. Very interesting read. I was completely unaware of those details. Thanks for the heads up and detailed explanation. I will definitely stay focused on this, maybe in the near future I can help out a bit to.
  4. Interesting, I completely agree, it was just the only method I could come up with from memory to evade the overhead. But surely you are correct.

    As far as the little test, I'm not exactly sure how in depth you wanted me to go, but I went ahead and defined the structure with all of the members defined, the constructor prototyped as well as the trilogy.

    ```
    struct PixelFormat
    {
    private:
        Byte iBitsPerPixel, iBytesPerPixel, iBytesPerPixel, iRloss, IBloss, iAloss, iRshift, iGshift, iAshift;
        Palette *objPalette;
        UInt32 iFormat, iRmask, iGmask, iBmask, iAmask, iReferences;
        PixelFormat *objNext;

    public:
        /* Constructors */
        PixelFormat(void);

        /* Trilogy of Evil */
        ~PixelFormat(void);
        PixelFormat(const PixelFormat & PF);
        PixelFormat & operator=(const PixelFormat & PF);
    };
    ```
  5. Hey guys, for those interested in getting a sneak peek at how I did things, I uploaded the header file (.h) for my Image class. Look in the main post's attachment section at the bottom, just above my signature.

    To use it, open up a new CLR Application in VS 2010, insert the _Image.h_ to your project. Open up _stdafx.h_ and insert the following code:

    ```
    #include #include #include
    ```
    Go into your Main.cpp and add the include for _Image.h_ (#include "Image.h"). Then in your main function add the following code:

    ```
    CImage test;
    test.ShowImage();
    ```
    Everything should be working just fine. If it is, you will see a pink critter with antennas and a body. For the game I showed off, I created another class "CSprite" which inherits the Image class, I just added variables for velocity and position to move it around. As far as events for Key Presses, all you need to do is create an Infinite loop. In the loop you use the following code:

    ```
    if(GetAsyncKeyState(VK_ESCAPE))
    {
        break;
    }
    ```
    That code will exit the infinite loop is the user hits 'Escape'. So I did that but added a check for all of the arrows and the **WASD** keys as well to move the player's avatar.

    If you have any further questions, feel free to ask away :p
  6. @Admiral:

    > It's been covered a few times [here](http://www.touchofdeathforums.com/smf/index.php/topic,72573.0.html) and [here](http://www.touchofdeathforums.com/smf/index.php/topic,350.msg758181.html#msg758181).
    >
    > Generally speaking, we're trying to avoid the overhead of object-oriented programming while remaining as small and fast readably possible.

    Just out of curiosity, why avoid OOP overhead? I mean sure, multiple instances of class constructors being called seems intense, but all it is doing is setting variables in a more organized manner.

    Lets say we have classes A and B.

    ```
    class A
    {
    private:
        int x;

    public:
        A(void)
        {
            x = 0;
        }

        A(int X)
        {
            x = X;
        }
    };

    class B : public A
    {
    private:
        int y;

    public:
        B(void)
            : A()
        {
            y = 0;
        }

        B(int X, int Y)
            :  A(X)
        {
            y = Y;
        }
    };
    ```
    In this example, the overhead you are trying to avoid is apparent. HOWEVER, I am almost pretty sure you can overcome that by creating pure virtual functions and allocating each object directly to the heap. Then at that point, the overhead is just one single pointer  :embarrassed:
  7. I'm using XNA 4.0, Lavos.

    And Genaga, I'm just contemplating on adding the animation layers like Eclipse does it, or creating Animation objects that can be placed on the map as their own entity.

    Everything is fully functional. I realized that the editor was eating up 400,000Kb memory so I sure as hell fixed that. Now I'm just running through and fixing some things. If you guys are interested I can upload a version that saves the maps as Images.
  8. Yeah Erkro, it bothers me too xP

    And Genaga, the map object has those attributes, I just need to add the ability to edit them. As far as animation, I haven't yet added it, still thinking on the best way to implement it.
  9. Recently, I've been working on an RPG Map Editor programmed entirely in C# that can save/load maps that can be used in an XNA game with the right code added. Just thought I would bring this up for some feedback and some possible ideas.

    As of right now, it can currently:

    * Place Tiles (Derp).
    * Lay tiles from any tile set, all at once.
    * Drag the cursor to place/delete tiles.
    * Built in grid with a toggle feature.
    * Lay attributes onto a tile.
    * Save the map as an image (Jpg, Gif, Bmp or Png).
    * Map Children using an Mdi Form (Edit up to 20 maps at one time)

    **Here are some screens:**
    MdiParent with tool box

    >! ![](http://img696.imageshack.us/img696/569/captureken.png)
    A Child-Map

    >! ![](http://img860.imageshack.us/img860/4792/capture1su.png)

    Any suggestions?
  10. Well the reason why the score is doing that is because initially the enemy is "dead" until you use the hotkey to bring him in. The reason why that happens is because I was just practicing with Bit Flags. Also the reason why it goes into the negatives is because the score will reach INT_MAX and then fold over into the greatest negative value. As far as the colors, they don't do anything special, but if you want, in the text files you can actually edit the pictures used in game. I basically created "Images" using text. Just make sure on the last line there is a tab and that you don't mess with the numeric values included. Thanks for the comments!
  11. In a **CLR** application make sure you have:
    ```
    using namespace System;
    ```
    ```
    Console::SetWindowSize(80, 30);
    Console::SetBufferSize(Console::WindowWidth, Console::WindowHeight);
    ```
    The max width is 80, going beyond will cause an error, I am not sure what the max height is though.
  12. Yeah, like I said, I will surely work on a completely different release with better optimization and more comments for you're guy's disposal. Just give me some time and I'll whip something cool up for you guys.

    Take note, D.J, I programmed this using the Framework Class Library in Windows, since you're using C I am honestly unsure of what accessibility you have, but hell, us programmers are good at figuring stuff out ^^

    @Robin, I started with Elysium years back, from there I followed "frozengod" to the Chaos forums (I'm sure you remember that). Then from there I migrated to Mirage and stayed there until it died and Mirage Realms picked up, I was a moderator there for a bout a week until that also died. I surely do remember you though! :p
  13. @D.J.:

    > Could you give a download link to some of us that know how to run a console application and are interested in playing your game??? Oh and it looks great by the way.

    Download link provided in the topic post. Look at the bottom of the post for controls and in the attachments for the zip. And thank you :)
  14. There's no proper place for introductions, so I figured I would do it here with a look at little game I programmed in C++. My name is Jeff, some may know me as Jsventor (although I seriously doubt it). I started working with Mirage based engines YEARS ago and then eventually gave it a break to further enhance my programming skills.

    Below are some screen shots of the game I created. It is VERY simple but still uses some advanced techniques like the implementation of doubly linked lists, polymorphism, bitwise operation/manipulation, queues, and some of the FCL's built in functions. I would have never thought that some of these techniques would ever be used in a console program. but here I am.

    Not exactly sure what I was thinking, but you play as a Wizard shooting fireballs at an Orc… in space. Killing the Orc will give you one point towards your score, the more you kill him, the more intense his AI becomes.

    Download
    [Click Me!](http://www.touchofdeathforums.com/smf/index.php?action=dlattach;topic=73012.0;attach=18695)

    **Controls**
    **W,A,S,D:** Move Avatar
    **Left, Down, Right, Up Arrows:** Shoot Fireballs
    **F1:** Toggle Enemy Visibility
    **F2:** Toggle Player Visibility
    **F3:** Toggle Enemy Movement
    **F4:** Toggle Enemy Ability to Fire

    Beware, your shots will bounce ONCE upon impact with the sides of the console, you CAN kill yourself.
×
×
  • Create New...