I am in need of help, need C++ guidance

This is a discussion on I am in need of help, need C++ guidance within the C++ Programming forums, part of the General Programming Boards category; @ MacGyver Stop asking questions that indicate you have no desire to learn on your own. You can't just jump ...

  1. #31
    Registered User
    Join Date
    Aug 2007
    Posts
    16
    @ MacGyver
    Stop asking questions that indicate you have no desire to learn on your own. You can't just jump into writing random programs. You'll suck at it, and people will dislike you. I'd be more concerned with the first consequence and probably disregard the latter. Start at the basics and learn "Hello, world" using C++ first. Move from there.
    do you honestly think that i am some loser who DOES want everyone to do all my work for me? I am not trying to start the project quite yet, to clear things up, i am trying to gather as much info as i can before i start the project, mkay? :\
    I admit, i am new to c++, i dont understand ANY of it atm, (obviously) But that is why i am doing a lot of work to go to other websites who do the same thing you guys do, im taking note of many things, and i am learning a bit more, so dont think i dont want to learn, because i do, and i AM capable.

    @ cyberfish
    Can you explain that more thoroughly? I don't understand :\
    4 and 7? what are they supposed to mean?

    @ msp
    I am sorry, but i do not have any money :\
    As of now, i am trying to find people who would give about an hour a week devoted to helping me, not that hard right? But as i promise all of my current...."employees", i WILL pay them their share if we do hit it big, understand?

    @matsp
    Yes, we are talking windows, a box computer in my room (offline), 512mB of ram, 80G of hd space, 64mB video card, not that slow, but not as fast as i would like
    I do want full color(ic) but i can start off in crappy 8-bit black and white....and gray. it will be easier, but i'll try to do something colorful for the menu....which is what i need to work on first. Any one want to assist me? :\

    @cornedBee
    @_@

    @simpleid
    What is HSB?? I'll check out the code, defiantly, i'll just figure out where it would go and how it works
    if i knew how to make a formula for making the html colors (000000-ffffff) I would.

    @everyone
    thanks for your replys, keep 'em comin

  2. #32
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I didn't say you need to use 8-bit grayscale, simply that you probably don't really need the full "truecolour" spectrum to do a chess-game.

    As to what HSB stands for, try:
    http://en.wikipedia.org/wiki/HSB

    In this instance, I think it's referring to:
    http://en.wikipedia.org/wiki/HSV_color_space

    The latter contains a conversion algorithm for HSV -> RGB conversion, so with that, you should be able to write a C/C++ program to draw a colourwheel (which, no offense, may be a better starting project for learning C/C++ and Windows programming than a chess-game - the latter is quite a complex subject!)

    --
    Mats

  3. #33
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    Here's a little information for you in detail:


    0x00000000 -> 0xRRGGBBAA
    (24 bit color, 32 with alpha, but there's always 32 bits you just don't access them.)

    quick and dirty way to get all colors:
    Code:
    for (int r = 0; r<256; ++r)
    for (int g = 0; g<256; ++g)
    for (int b = 0; b<256; ++b)
    {
    	cout << r << ":" << g << ":" << b <<endl;
    }
    All pure tones always have one value at 255, and one at 0, and the other ranges... all pure tones are:

    n = rising from 0 -> 255
    x = falling from 255 -> 0

    Action -> Result -> Next Step

    255, n, 0 -> 255, 255, 0 ->
    x, 255, 0 -> 0, 255, 0 ->
    0, 255, n -> 0, 255, 255 ->
    0, x, 255 -> 0, 0, 255 ->
    n, 0, 255 -> 255, 0, 255 ->
    255, x, 0 -> 255, 0, 0


    that's the algorithm to generate pure tones, i developed a formula and application to execute this and store the values in an array, that is what you'll find i gave the code for on the thread i linked you to.

    to go from here to HEX (0xRRGGBBAA) is described in the thread. in case you never made the connection:
    HEX values are really stored in an INTEGER, hence an INT is 32 bits, and 32 bit for true color...
    hence also 256 color values per color, 0->255 is how much space the binary equivalent of 0xFF allows for...

    1111 1111
    ->
    128 - 64 - 32 - 16 :: 8 - 4 - 2 - 1

    256-1 (since we start from 0) = 256 values


    just fyi, you can assign values like so if you wanted,

    int i = 0xFF; // same as i = 256... heh

    hex values are -just- numbers in a different base, so you can use decimal values to do all the work, don't get stuck on the HEX FORM of the number.
    Last edited by simpleid; 08-16-2007 at 12:36 PM.

  4. #34
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Quote Originally Posted by Chessman.exe View Post
    @ MacGyver

    do you honestly think that i am some loser who DOES want everyone to do all my work for me? I am not trying to start the project quite yet, to clear things up, i am trying to gather as much info as i can before i start the project, mkay? :\
    I think you're rushing things way ahead of yourself and expecting a lot more help than you should get. A loser? No, hopefully not. More just someone who's so terribly impatient that he wants to keep asking questions he won't truly understand.

    Quote Originally Posted by Chessman.exe View Post
    I admit, i am new to c++, i dont understand ANY of it atm, (obviously) But that is why i am doing a lot of work to go to other websites who do the same thing you guys do, im taking note of many things, and i am learning a bit more, so dont think i dont want to learn, because i do, and i AM capable.
    I think you're not interested in learning correctly. If at the end of the day you still don't know understand a thing because it's too complicated and you're taking a huge shortcut, then you're not really learning.

    Take the time to start from scratch. Go write a "hello world" program. Eventually write a program to tell if a word is a palindrome. Eventually you'll see writing a chess game is no cakewalk if you've never written anything in C++ before. The logic of the game itself will be extremely difficult if you're still stuck on language details, not to mention the GUI, and then the AI.

    We're telling you to put this project on hold, not because we hate chess, but because we know what it's like to want to make something that appears simple right before you start learning a language.

  5. #35
    Registered User
    Join Date
    Aug 2007
    Posts
    16
    I didn't say you need to use 8-bit grayscale, simply that you probably don't really need the full "truecolour" spectrum to do a chess-game.
    :\
    im not making a chess game, but im thinking it would be a bit easier to go with black and white.

    @macgyver
    still not making a chess game, i was just refering to the game....
    You are right, i should take my time, but i really am excited to start this project, I really cant wait to start and finish, which is why i am not taking a lot of time to google search, i should, but i dont know what to look for when i do search.

  6. #36
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    http://www.wxwidgets.org/manuals/sta...wxcolourdialog

    This is a prebuild control to choose colors that comes in a so called library. I think that is meant by "color wheel".
    You need to download that library and to understand how to make a program what is capable to use its functions. It's all explained on that web site.
    Try to show a window with it and place that colour chooser in it.

    This is a very small step referring to the description of your project. But it will show you quite well how hard it can be without having the basics other people learn years for.

  7. #37
    Registered User
    Join Date
    Aug 2007
    Posts
    16
    O.O cool, thanks a lot.

  8. #38
    Registered User
    Join Date
    Nov 2006
    Posts
    519
    for what? YOU will have all the work figuring out how to get a silly colour control to finally show up

  9. #39
    Sanity is for the weak! beene's Avatar
    Join Date
    Jul 2006
    Posts
    321
    Well, u can start right here at this website, just look on the tutorials. Thats where i started about 14 months ago, and i'm just starting to get a grips with graphics programming now.

  10. #40
    Registered User
    Join Date
    Aug 2007
    Posts
    16
    eh, thanks for showing me the site, i'll try to figure out HOW it works <_< but i guess it isn't gonna be a snap, i actually just looked at some of the tutorials here, i forgot they were here, so yeah. I actually have a windows executable window showing up, and now i can not figure out how exactly to modify it, where to modify it, and...well, how to modify it, so i'll check that out in the tuts, thanks guys, im still open to suggestions and help.

  11. #41
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Quote Originally Posted by MacGyver View Post
    Yeah, and I want a deathray. You going to devote your life to making it for me?
    A Deathray Engineer, who hasn't got his own deathray - nor made is own. That's ludicrous!

  12. #42
    Registered User
    Join Date
    Jul 2006
    Posts
    162
    a deathray... - an engineer gone mad. i hesitate to wonder what you'd do with it. the coolest scrambled eggs ever?

  13. #43
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Quote Originally Posted by zacs7 View Post
    A Deathray Engineer, who hasn't got his own deathray - nor made is own. That's ludicrous!
    But it won't work! Help me fix it!!!!!!!111111111oneoneoneone



    Quote Originally Posted by simpleid View Post
    a deathray... - an engineer gone mad. i hesitate to wonder what you'd do with it. the coolest scrambled eggs ever?
    You think I'm crazy, huh? Is that it? Huh? You think I can't build a deathray? I'll show you. I'LL SHOW YOU ALL!!!!

    *pulls at the hair from his toupe and orders his army of bots to continue work on the death ray*



    LOL.

  14. #44
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,892
    We definitely don't want to encourage MacGyver in his plans, I think.

    Thread has lost its purpose.

    Edit: Reopened for on-topic discussion.
    Last edited by CornedBee; 08-18-2007 at 04:14 PM.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  15. #45
    Registered User
    Join Date
    Aug 2007
    Posts
    16
    im trying to stay on topic soo...

    i found a trial program where i can find the codes, i found out how to make a menu, but i need help. I kinda found out how to make buttons, but i will inquire about that later.

    for now, i need to know something.

    Can you just put "words here" in the place where i can see it in the windows app...ya know, so when i compile it into an executable or whatever, i will see a grey background, and the "words here" in the window.

    also, where would i change the background?(color) thanks in advance.




    Code:
    #include <windows.h>
    
    
    
    /*  Declare Windows procedure  */
    
    LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
    
    
    
    /*  Make the class name into a global variable  */
    
    char szClassName[ ] = "WindowsApp";
    
    
    
    int WINAPI WinMain (HINSTANCE hThisInstance,
    
                        HINSTANCE hPrevInstance,
    
                        LPSTR lpszArgument,
    
                        int nFunsterStil)
    
    
    
    {
    
        HWND hwnd;               /* This is the handle for our window */
    
        MSG messages;            /* Here messages to the application are saved */
    
        WNDCLASSEX wincl;        /* Data structure for the windowclass */
    
    
    
        /* The Window structure */
    
        wincl.hInstance = hThisInstance;
    
        wincl.lpszClassName = szClassName;
    
        wincl.lpfnWndProc = WindowProcedure;      /* This function is called by windows */
    
        wincl.style = CS_DBLCLKS;                 /* Catch double-clicks */
    
        wincl.cbSize = sizeof (WNDCLASSEX);
    
    
    
        /* Use default icon and mouse-pointer */
    
        wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
    
        wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
    
        wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
    
        wincl.lpszMenuName = NULL;                 /* No menu */
    
        wincl.cbClsExtra = 0;                      /* No extra bytes after the window class */
    
        wincl.cbWndExtra = 0;                      /* structure or the window instance */
    
        /* Use Windows's default color as the background of the window */
    
        wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
    
    
    
        /* Register the window class, and if it fails quit the program */
    
        if (!RegisterClassEx (&wincl))
    
            return 0;
    
    
    
        /* The class is registered, let's create the program*/
    
        hwnd = CreateWindowEx (
    
               0,                   /* Extended possibilites for variation */
    
               szClassName,         /* Classname */
    
               "Windows App",       /* Title Text */
    
               WS_OVERLAPPEDWINDOW, /* default window */
    
               CW_USEDEFAULT,       /* Windows decides the position */
    
               CW_USEDEFAULT,       /* where the window ends up on the screen */
    
               544,                 /* The programs width */
    
               375,                 /* and height in pixels */
    
               HWND_DESKTOP,        /* The window is a child-window to desktop */
    
               NULL,                /* No menu */
    
               hThisInstance,       /* Program Instance handler */
    
               NULL                 /* No Window Creation data */
    
               );
    
    
    
        /* Make the window visible on the screen */
    
        ShowWindow (hwnd, nFunsterStil);
    
    
    
        /* Run the message loop. It will run until GetMessage() returns 0 */
    
        while (GetMessage (&messages, NULL, 0, 0))
    
        {
    
            /* Translate virtual-key messages into character messages */
    
            TranslateMessage(&messages);
    
            /* Send message to WindowProcedure */
    
            DispatchMessage(&messages);
    
        }
    
    
    
        /* The program return-value is 0 - The value that PostQuitMessage() gave */
    
        return messages.wParam;
    
    }
    
    
    
    
    
    /*  This function is called by the Windows function DispatchMessage()  */
    
    
    
    LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
    
    {
    
        switch (message)                  /* handle the messages */
    
        {
    
            case WM_DESTROY:
    
                PostQuitMessage (0);       /* send a WM_QUIT to the message queue */
    
                break;
    
            default:                      /* for messages that we don't deal with */
    
                return DefWindowProc (hwnd, message, wParam, lParam);
    
        }
    
    
    
        return 0;
    
    }

Page 3 of 4 FirstFirst 1234 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need some guidance.
    By Kinto in forum C Programming
    Replies: 10
    Last Post: 05-31-2009, 12:02 AM
  2. Guidance, please.
    By mattagrimonti in forum C Programming
    Replies: 2
    Last Post: 11-26-2008, 07:50 AM
  3. need guidance to connect to serial port
    By gnychis in forum Linux Programming
    Replies: 1
    Last Post: 06-02-2005, 10:10 AM
  4. Audio guidance.
    By Sebastiani in forum Windows Programming
    Replies: 6
    Last Post: 12-22-2002, 08:14 AM
  5. advice and possibly guidance
    By nazri81 in forum C++ Programming
    Replies: 3
    Last Post: 11-07-2002, 09:19 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21