Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. What do you think of my small game made in Windows API RAW?

What do you think of my small game made in Windows API RAW?

Scheduled Pinned Locked Moved The Weird and The Wonderful
graphicsgame-devbeta-testingjsonquestion
12 Posts 12 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W walterhevedeich

    So you really posted it on the Hall of Shame huh. I say you've done a very good job posting it in this forum. I hope you read the intstructions above before you posted it. :-D

    Good judgment comes from experience, and experience comes from bad judgment. Barry LePatner

    OriginalGriffO Offline
    OriginalGriffO Offline
    OriginalGriff
    wrote on last edited by
    #3

    I'd say you were right - this is the right place for it!

    Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

    1 Reply Last reply
    0
    • A andyharglesis

      Here is the source code... some feedback would nice:

      #include <windows.h>
      HDC hdc;
      HWND hwnd;
      PAINTSTRUCT ps;
      bool room1 = 0;
      short constupdate()
      {
      while(1)
      {
      InvalidateRect(hwnd, NULL, TRUE);
      }
      }
      int floor;
      static int x, y;
      int jmpjmp = x+5;
      int atpos = jmpjmp;
      bool right = 1;
      bool left = 0;
      void first();
      bool keyinroom = 1;
      bool havekey = 0;
      bool inmenu = 0;
      /* Declare Windows procedure */
      LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

      /* Make the class name into a global variable */

      = "CodeBlocksWindowsApp";

      int WINAPI WinMain (HINSTANCE hThisInstance,
      HINSTANCE hPrevInstance,
      LPSTR lpszArgument,
      int nCmdShow)
      {
      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 colour as the background of the window \*/
      wincl.hbrBackground = (HBRUSH) COLOR\_BACKGROUND+7;
      
      /\* 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 \*/
             "Window's GDI Pixel Game",       /\* Title Text \*/
             WS\_OVERLAPPEDWINDOW, /\* default window \*/
             CW\_USEDEFAULT,       /\* Windows decides the position \*/
             CW\_USEDEFAULT,       /\* where the window ends up on the screen \*/
             544,                 /\* The program's
      
      A Offline
      A Offline
      AspDotNetDev
      wrote on last edited by
      #4

      I don't see why you were downvoted 4 times... this is finally the right forum for this code! In fact, it reminds me of a post I once made here in this very same forum with very similar code.

      Help a brotha out and vote Managing Your JavaScript Library in ASP.NET as the best ASP.NET article of May 2011.

      1 Reply Last reply
      0
      • A andyharglesis

        Here is the source code... some feedback would nice:

        #include <windows.h>
        HDC hdc;
        HWND hwnd;
        PAINTSTRUCT ps;
        bool room1 = 0;
        short constupdate()
        {
        while(1)
        {
        InvalidateRect(hwnd, NULL, TRUE);
        }
        }
        int floor;
        static int x, y;
        int jmpjmp = x+5;
        int atpos = jmpjmp;
        bool right = 1;
        bool left = 0;
        void first();
        bool keyinroom = 1;
        bool havekey = 0;
        bool inmenu = 0;
        /* Declare Windows procedure */
        LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

        /* Make the class name into a global variable */

        = "CodeBlocksWindowsApp";

        int WINAPI WinMain (HINSTANCE hThisInstance,
        HINSTANCE hPrevInstance,
        LPSTR lpszArgument,
        int nCmdShow)
        {
        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 colour as the background of the window \*/
        wincl.hbrBackground = (HBRUSH) COLOR\_BACKGROUND+7;
        
        /\* 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 \*/
               "Window's GDI Pixel Game",       /\* Title Text \*/
               WS\_OVERLAPPEDWINDOW, /\* default window \*/
               CW\_USEDEFAULT,       /\* Windows decides the position \*/
               CW\_USEDEFAULT,       /\* where the window ends up on the screen \*/
               544,                 /\* The program's
        
        H Offline
        H Offline
        H A Tanner
        wrote on last edited by
        #5

        Nice work;) right place though. I should test it somewhen...

        1 Reply Last reply
        0
        • A andyharglesis

          Here is the source code... some feedback would nice:

          #include <windows.h>
          HDC hdc;
          HWND hwnd;
          PAINTSTRUCT ps;
          bool room1 = 0;
          short constupdate()
          {
          while(1)
          {
          InvalidateRect(hwnd, NULL, TRUE);
          }
          }
          int floor;
          static int x, y;
          int jmpjmp = x+5;
          int atpos = jmpjmp;
          bool right = 1;
          bool left = 0;
          void first();
          bool keyinroom = 1;
          bool havekey = 0;
          bool inmenu = 0;
          /* Declare Windows procedure */
          LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

          /* Make the class name into a global variable */

          = "CodeBlocksWindowsApp";

          int WINAPI WinMain (HINSTANCE hThisInstance,
          HINSTANCE hPrevInstance,
          LPSTR lpszArgument,
          int nCmdShow)
          {
          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 colour as the background of the window \*/
          wincl.hbrBackground = (HBRUSH) COLOR\_BACKGROUND+7;
          
          /\* 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 \*/
                 "Window's GDI Pixel Game",       /\* Title Text \*/
                 WS\_OVERLAPPEDWINDOW, /\* default window \*/
                 CW\_USEDEFAULT,       /\* Windows decides the position \*/
                 CW\_USEDEFAULT,       /\* where the window ends up on the screen \*/
                 544,                 /\* The program's
          
          R Offline
          R Offline
          RobCroll
          wrote on last edited by
          #6

          You wrote all that code and didn't cut and paste! And then post it here. My vote for "Masochist Programmer" of the year.

          "You get that on the big jobs."

          F 1 Reply Last reply
          0
          • R RobCroll

            You wrote all that code and didn't cut and paste! And then post it here. My vote for "Masochist Programmer" of the year.

            "You get that on the big jobs."

            F Offline
            F Offline
            Firo Atrum Ventus
            wrote on last edited by
            #7

            RobCroll wrote:

            My vote for "Masochist Programmer" of the year.

            ROFL :laugh:

            A hidden needle is way more effective than an unsheathed sword.

            1 Reply Last reply
            0
            • A andyharglesis

              Here is the source code... some feedback would nice:

              #include <windows.h>
              HDC hdc;
              HWND hwnd;
              PAINTSTRUCT ps;
              bool room1 = 0;
              short constupdate()
              {
              while(1)
              {
              InvalidateRect(hwnd, NULL, TRUE);
              }
              }
              int floor;
              static int x, y;
              int jmpjmp = x+5;
              int atpos = jmpjmp;
              bool right = 1;
              bool left = 0;
              void first();
              bool keyinroom = 1;
              bool havekey = 0;
              bool inmenu = 0;
              /* Declare Windows procedure */
              LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

              /* Make the class name into a global variable */

              = "CodeBlocksWindowsApp";

              int WINAPI WinMain (HINSTANCE hThisInstance,
              HINSTANCE hPrevInstance,
              LPSTR lpszArgument,
              int nCmdShow)
              {
              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 colour as the background of the window \*/
              wincl.hbrBackground = (HBRUSH) COLOR\_BACKGROUND+7;
              
              /\* 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 \*/
                     "Window's GDI Pixel Game",       /\* Title Text \*/
                     WS\_OVERLAPPEDWINDOW, /\* default window \*/
                     CW\_USEDEFAULT,       /\* Windows decides the position \*/
                     CW\_USEDEFAULT,       /\* where the window ends up on the screen \*/
                     544,                 /\* The program's
              
              R Offline
              R Offline
              Ravi Sant
              wrote on last edited by
              #8

              counter voted to 4! It indeed belongs to hall of shame, though has some strain on eyes while scrolling!

              // ♫ 99 little bugs in the code, // 99 bugs in the code // We fix a bug, compile it again // 101 little bugs in the code ♫

              1 Reply Last reply
              0
              • A andyharglesis

                Here is the source code... some feedback would nice:

                #include <windows.h>
                HDC hdc;
                HWND hwnd;
                PAINTSTRUCT ps;
                bool room1 = 0;
                short constupdate()
                {
                while(1)
                {
                InvalidateRect(hwnd, NULL, TRUE);
                }
                }
                int floor;
                static int x, y;
                int jmpjmp = x+5;
                int atpos = jmpjmp;
                bool right = 1;
                bool left = 0;
                void first();
                bool keyinroom = 1;
                bool havekey = 0;
                bool inmenu = 0;
                /* Declare Windows procedure */
                LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

                /* Make the class name into a global variable */

                = "CodeBlocksWindowsApp";

                int WINAPI WinMain (HINSTANCE hThisInstance,
                HINSTANCE hPrevInstance,
                LPSTR lpszArgument,
                int nCmdShow)
                {
                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 colour as the background of the window \*/
                wincl.hbrBackground = (HBRUSH) COLOR\_BACKGROUND+7;
                
                /\* 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 \*/
                       "Window's GDI Pixel Game",       /\* Title Text \*/
                       WS\_OVERLAPPEDWINDOW, /\* default window \*/
                       CW\_USEDEFAULT,       /\* Windows decides the position \*/
                       CW\_USEDEFAULT,       /\* where the window ends up on the screen \*/
                       544,                 /\* The program's
                
                0 Offline
                0 Offline
                0bx
                wrote on last edited by
                #9

                Coding like this will increase your workload exponentially for every improvement / new feature you like to add to the game, until it becomes completely impossible to add anything to the project. Soon you'll lose interest unmanageable project, and start the entire cycle with the next half-assed game. So yes, eat your programming vegetables before you start with the cake.

                andyharglesis wrote:

                but it's certainly better than no game at all, correct?

                I guess that depends on how old you are. When a 5 year old paints blue clouds on a white sky, he still deserves a pat on the back. If an 18 year old does this, you would either think he's mentally challenged or just lazy. Same analogy: If you're just starting out and want to express your creativity by making games, that's great, good job. Will I play it? No, because I already can see what it does and it's not really that interesting. But, if you're already programming for 3-10 years you're just being "lazy" in the sense that you don't show any interest in what you're doing. Maybe you're more into game design, instead of actual programming? If that's the case, you will have a more fun in the modding/lvl editing community. Or, you can check out toolkits like GameMaker, where you already have an engine and a framework that can handle complete game projects.

                Giraffes are not real.

                1 Reply Last reply
                0
                • A andyharglesis

                  Here is the source code... some feedback would nice:

                  #include <windows.h>
                  HDC hdc;
                  HWND hwnd;
                  PAINTSTRUCT ps;
                  bool room1 = 0;
                  short constupdate()
                  {
                  while(1)
                  {
                  InvalidateRect(hwnd, NULL, TRUE);
                  }
                  }
                  int floor;
                  static int x, y;
                  int jmpjmp = x+5;
                  int atpos = jmpjmp;
                  bool right = 1;
                  bool left = 0;
                  void first();
                  bool keyinroom = 1;
                  bool havekey = 0;
                  bool inmenu = 0;
                  /* Declare Windows procedure */
                  LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

                  /* Make the class name into a global variable */

                  = "CodeBlocksWindowsApp";

                  int WINAPI WinMain (HINSTANCE hThisInstance,
                  HINSTANCE hPrevInstance,
                  LPSTR lpszArgument,
                  int nCmdShow)
                  {
                  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 colour as the background of the window \*/
                  wincl.hbrBackground = (HBRUSH) COLOR\_BACKGROUND+7;
                  
                  /\* 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 \*/
                         "Window's GDI Pixel Game",       /\* Title Text \*/
                         WS\_OVERLAPPEDWINDOW, /\* default window \*/
                         CW\_USEDEFAULT,       /\* Windows decides the position \*/
                         CW\_USEDEFAULT,       /\* where the window ends up on the screen \*/
                         544,                 /\* The program's
                  
                  P Offline
                  P Offline
                  Pete OHanlon
                  wrote on last edited by
                  #10

                  I really wish you hadn't posted this here. People have been having fun at your expense suggesting that you post it in a forum that is specifically aimed at poor examples of code, and that's not fair on you. There's not a developer here who hasn't, at one stage or another, produced an absolute abomination of a program when they view it later on. Please, remove the code because they've done you no favours here.

                  Forgive your enemies - it messes with their heads

                  My blog | My articles | MoXAML PowerToys | Mole 2010 - debugging made easier - my favourite utility

                  1 Reply Last reply
                  0
                  • A andyharglesis

                    Here is the source code... some feedback would nice:

                    #include <windows.h>
                    HDC hdc;
                    HWND hwnd;
                    PAINTSTRUCT ps;
                    bool room1 = 0;
                    short constupdate()
                    {
                    while(1)
                    {
                    InvalidateRect(hwnd, NULL, TRUE);
                    }
                    }
                    int floor;
                    static int x, y;
                    int jmpjmp = x+5;
                    int atpos = jmpjmp;
                    bool right = 1;
                    bool left = 0;
                    void first();
                    bool keyinroom = 1;
                    bool havekey = 0;
                    bool inmenu = 0;
                    /* Declare Windows procedure */
                    LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

                    /* Make the class name into a global variable */

                    = "CodeBlocksWindowsApp";

                    int WINAPI WinMain (HINSTANCE hThisInstance,
                    HINSTANCE hPrevInstance,
                    LPSTR lpszArgument,
                    int nCmdShow)
                    {
                    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 colour as the background of the window \*/
                    wincl.hbrBackground = (HBRUSH) COLOR\_BACKGROUND+7;
                    
                    /\* 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 \*/
                           "Window's GDI Pixel Game",       /\* Title Text \*/
                           WS\_OVERLAPPEDWINDOW, /\* default window \*/
                           CW\_USEDEFAULT,       /\* Windows decides the position \*/
                           CW\_USEDEFAULT,       /\* where the window ends up on the screen \*/
                           544,                 /\* The program's
                    
                    D Offline
                    D Offline
                    Dimitrios Kalemis
                    wrote on last edited by
                    #11

                    I really like your program. I do not think it should be in the Hall of Shame, or at least, it shouldn't, had the SetPixel code blocks been inside functions. But that might have hurt performance ever so slightly, and we might not want that. All and all, it is a very interesting and useful project you have here. I have a question. In the beginning of your program, you define the function constupdate(), but you do not seem to be using it anywhere. What am I missing?

                    1 Reply Last reply
                    0
                    • A andyharglesis

                      Here is the source code... some feedback would nice:

                      #include <windows.h>
                      HDC hdc;
                      HWND hwnd;
                      PAINTSTRUCT ps;
                      bool room1 = 0;
                      short constupdate()
                      {
                      while(1)
                      {
                      InvalidateRect(hwnd, NULL, TRUE);
                      }
                      }
                      int floor;
                      static int x, y;
                      int jmpjmp = x+5;
                      int atpos = jmpjmp;
                      bool right = 1;
                      bool left = 0;
                      void first();
                      bool keyinroom = 1;
                      bool havekey = 0;
                      bool inmenu = 0;
                      /* Declare Windows procedure */
                      LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);

                      /* Make the class name into a global variable */

                      = "CodeBlocksWindowsApp";

                      int WINAPI WinMain (HINSTANCE hThisInstance,
                      HINSTANCE hPrevInstance,
                      LPSTR lpszArgument,
                      int nCmdShow)
                      {
                      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 colour as the background of the window \*/
                      wincl.hbrBackground = (HBRUSH) COLOR\_BACKGROUND+7;
                      
                      /\* 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 \*/
                             "Window's GDI Pixel Game",       /\* Title Text \*/
                             WS\_OVERLAPPEDWINDOW, /\* default window \*/
                             CW\_USEDEFAULT,       /\* Windows decides the position \*/
                             CW\_USEDEFAULT,       /\* where the window ends up on the screen \*/
                             544,                 /\* The program's
                      
                      M Offline
                      M Offline
                      Mark Bunds
                      wrote on last edited by
                      #12

                      What you have done here is what I used to call "brute-force" programming, since it was easier for me to begin with a "hard map" of repetitive data that I could use to hammer out working code, however inelegant. Later, I would identify the patterns, and commit the raw data statements to configurable loops which I would then integrate with the rest of my spaghetti. It took YEARS for me to learn to plan ahead, and when I least expected it, here comes OOP, Abstraction, Polymorphism, Inheritance, and all that that implies...So back to square one, and I found myself forced to embrace the Evil that is Microsoft. Your little program is FAR ahead of what I was doing at your age, because the tools you are using simply didn't exist back then. Graphics? We didn't need no stinkin' graphics!!! We had 6x9 hardware-generated character sets, all upper case, 40 columns, and two damn lines, if we were lucky. Ever tried to play Donky Kong on a line-printer? So forgive the harsh criticism doled out by some of these coders, keeping in mind that these forums host some of the best and most experienced software engineers on the planet, and that as a general rule engineers are not commonly known for their tact, social skills, or personal hygiene. Add to that the fact that many of these people make their living undoing the nightmares passed down to them from, shall we say, "less than marginally competent" programmers, and you can understand why some of them might seem unkind. Just listen to them, and avoid doing things that will get you banned, and before you know it your programming skills will increase exponentially, earning you a coveted spot where you can expect to receive unkind criticism for even the most brilliant code. They are, at least, responding with suggestions; in my opinion it is far worse to have your posts go entirely ignored. As long as you keep learning, refusing to be discouraged, and are capable of grasping the abstractions involved in advanced coding, while being able to tell the difference between unexpected behavior caused by your code vs. unexpected behavior induced by Microsoft bugs, YOUR generation will construct the applications that MY generation NEVER dreamed possible.

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups