Jump to content

How do I make emulators?


Recommended Posts

Whats the problem with me going into graphics? I know the basics...sorta,

The "sorta" is precisely the problem. If you really want to try, you can begin with a library like SDL.

But the real problem is that if you were really serious about that you would find the info yourself, and already be at work.

And Visual Basic isn't gonna do you any good.

Learn all you can from your lessons and from other people, but you'll always have to find the most part of the info yourself. Lessons are made to get you started, to show you important points and to make you avoid the most common mistakes, but that's all.

 

Gryph, that's a nice quote :P

Link to comment
Share on other sites

  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

Win32 programing with C++ is H A R D.

I tried to learn it, but it's way to complex. You need to remember T O N S of code. here is the code for a simple empty window:

#include <windows.h>

const char g_szClassName[] = "myWindowClass";

LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
   switch(msg)
   {
       case WM_CLOSE:
           DestroyWindow(hwnd);
       break;
       case WM_DESTROY:
           PostQuitMessage(0);
       break;
       default:
           return DefWindowProc(hwnd, msg, wParam, lParam);
   }
   return 0;
}

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
   LPSTR lpCmdLine, int nCmdShow)
{
   WNDCLASSEX wc;
   HWND hwnd;
   MSG Msg;

   wc.cbSize        = sizeof(WNDCLASSEX);
   wc.style         = 0;
   wc.lpfnWndProc   = WndProc;
   wc.cbClsExtra    = 0;
   wc.cbWndExtra    = 0;
   wc.hInstance     = hInstance;
   wc.hIcon         = LoadIcon(NULL, IDI_APPLICATION);
   wc.hCursor       = LoadCursor(NULL, IDC_ARROW);
   wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
   wc.lpszMenuName  = NULL;
   wc.lpszClassName = g_szClassName;
   wc.hIconSm       = LoadIcon(NULL, IDI_APPLICATION);

   if(!RegisterClassEx(&wc))
   {
       MessageBox(NULL, "Window Registration Failed!", "Error!",
           MB_ICONEXCLAMATION | MB_OK);
       return 0;
   }

   hwnd = CreateWindowEx(
       WS_EX_CLIENTEDGE,
       g_szClassName,
       "The title of my window",
       WS_OVERLAPPEDWINDOW,
       CW_USEDEFAULT, CW_USEDEFAULT, 240, 120,
       NULL, NULL, hInstance, NULL);

   if(hwnd == NULL)
   {
       MessageBox(NULL, "Window Creation Failed!", "Error!",
           MB_ICONEXCLAMATION | MB_OK);
       return 0;
   }

   ShowWindow(hwnd, nCmdShow);
   UpdateWindow(hwnd);

   while(GetMessage(&Msg, NULL, 0, 0) > 0)
   {
       TranslateMessage(&Msg);
       DispatchMessage(&Msg);
   }
   return Msg.wParam;
}

Link to comment
Share on other sites

And don't think that everything else is just adding a few pieces of code to this program. You will need to write a lot for every thing you do.

 

However, you can have your graphics now if you will use Turbo C++. You can download the program from my tutorial. There are graphics functions in "graphics.h", and you can get keyboard input with kbhit() and getch(). Press F1 or the right mouse button for the great help provided with this compilers.

 

The functions in "graphics.h", kbhit and getch are not very good, but I am working on an header of my own. I will send it evryone who want it when I'm done.

Link to comment
Share on other sites

Yeah....*pulls out C++ class book teacher lend me*...I looked up the page on graphics...there's like 5 chapters on this and thats just the basics of it....so yeah, now I know what ya'll mean, but my teacher said that if the class does good he might end the year with 9 weeks of graphics...but idk if he was playing around

 

Edit:Somebody...I thought it was easier to use IF statments instead of using switch...whats up with that?

Edited by Drake
Link to comment
Share on other sites

I understand the switch consept since my teacher covered it in the first month of school, it was the only class I liked and payed attention to and it still is im just concentrating more on everything else, my book shows me 2 line of coding that summuns up a normal white window box, idk were to put tho, like in INT main or right after I include string and iostream...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...