OK, Not really a Game... But, Close!

This is a discussion on OK, Not really a Game... But, Close! within the Game Programming forums, part of the General Programming Boards category; What I have so far is 2 html pages. The first one uses Javascript to open the second at full ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    56

    OK, Not really a Game... But, Close!

    What I have so far is 2 html pages. The first one uses Javascript to open the second at full screen, maximized, no scroll, no sizing, etc.

    The page that is opened uses Javascript to embed .wav files that are accessed with onclick. I used imagemap to specify the click areas on my jpeg.

    My question is;
    Can I turn these two pages and all the included graphics and audio resources into an .exe using C++?

    I have MSVC++ standard... But... am pretty clueless to get it to do anything outside of a step by step tutorial. Any suggestions on where to turn to get tutorials on turning html into .exe's?

    Thanks,

    Grump.

  2. #2
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    Well it doesn't exactly work that way. You can call HTML a scripting language for web browsers. C++ is a programming language. You can't convert a script directly into a program. (Well, some instinces you can, but not in this case).

    The only way I can think of is to learn a sound API and a graphics API and just make a clone of your webpage. That would be a MAJOR waste of time though.

    Heck, there may be a HTML->C++ converter somewhere out there, but you'd still have to use some kind of graphics API, sound API, etc. with that.

    I suggest if you have a webpage that does fine for its purpose, leave it a webpage.

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    56
    Actually, I used html and java out of frustration. I couldnt figure out how to make things work in msvc. It seems like it should be simple enough to click a defined region in a graphic and have an event occur....

    But, my limited newbie knowledge of c++ and other coding made it a herculean task.

    So I created a jpeg, did an image map, and found some java snippets to do the work. But, I couldnt find the snippet to make a window open without all the ie doohickeys... LOL! I had to call the window from another html file using the onload function.

    The first html is used just to get the second window to open in a maximized state without the toolbar and address bar.

    I thought maybe I could use an E-book html compiler. But it just crashes or show a noninteractive jpeg when I try to go that route. So I dont think that would be an option.

    From my limited understanding of MFC Classes? and all the buttons I see in MSVC, it seems as if I am lacking only a few simple instructions to tell MSVC what to do with the stuff I want to load into it.

    I know I can load graphics and sounds, I know I can define areas of clickability, and I know I can make those clicks cause a .wav to fire... or even a 3d animation to occur....

    My problem is in the 'how'.

    When I first got the ms compiler I was able to load a graphic into a win32 app and even get a button to be clickable and display text alluding to the fact that I wished I could make the button do more.

    I already have my coordinates mapped on the graphic, so if I could load it into a win app and define the click areas... I would be home free.... sort of.

    I am hoping that maybe someone has seen a template of sorts, or a tutorial that delved into this kind of limited imteractivity. And maybe they could pass that info along.

    I initially tried to use a large animated gif as my background, but found that once I started mapping it for interactive clicking, the animation would stop after the first click. Thats why I went with a Jpeg... Now that I have the two pages set up. I can access the first one through a shortcut, which in turn opens my second yet primary page. It's sloppy.

    If I have to stay with a static background... I guess I could GIMP it into a 3d looking background. But, my GIMP seems to crash a lot when I work on large images... which in itself is outside the scope of this post... so to restate the issue;
    I want to load a imagemapped graphic approximately (800X600) in size. Define clickable areas. And make those clicks trigger a wav or mp3.

    And... perhaps leave open the option for even more interactivity later on down the road.

  4. #4
    mov.w #$1337,D0 Jeremy G's Avatar
    Join Date
    Nov 2001
    Posts
    704
    Im not sure just how much you know about the windows api - message handling and etc. IF you know how to display an image in the window, and you understand how Message Handlers work this could be your solution:

    Found from MSDN: http://msdn.microsoft.com/library/de...BUTTONDOWN.asp
    WM_LBUTTONDOWN Notification

    --------------------------------------------------------------------------------


    The WM_LBUTTONDOWN message is posted when the user presses the left mouse button while the cursor is in the client area of a window. If the mouse is not captured, the message is posted to the window beneath the cursor. Otherwise, the message is posted to the window that has captured the mouse.

    A window receives this message through its WindowProc function.


    Syntax

    WM_LBUTTONDOWN

    WPARAM wParam
    LPARAM lParam;

    Parameters

    wParam
    Indicates whether various virtual keys are down. This parameter can be one or more of the following values.
    MK_CONTROL
    The CTRL key is down.
    MK_LBUTTON
    The left mouse button is down.
    MK_MBUTTON
    The middle mouse button is down.
    MK_RBUTTON
    The right mouse button is down.
    MK_SHIFT
    The SHIFT key is down.
    MK_XBUTTON1
    Windows 2000/XP: The first X button is down.
    MK_XBUTTON2
    Windows 2000/XP: The second X button is down.
    lParam
    The low-order word specifies the x-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.

    The high-order word specifies the y-coordinate of the cursor. The coordinate is relative to the upper-left corner of the client area.


    Use the following code to obtain the horizontal and vertical position:

    xPos = GET_X_LPARAM(lParam);
    yPos = GET_Y_LPARAM(lParam);

    You can also use the MAKEPOINTS macro to convert the lParam parameter to a POINTS structure.
    Basicly in your message handler when evre there is a left click grab the coordinates of the click (relative to your window).

    With this information you can create yourself a "image map".

    basicaly you need an array of rectangles as your image map (or more comples shape, but that will be fore you to define)

    RECT hotspots[10];

    Fill out your hot spots with what ever coordinates match your image. When ever there is a left mouse click, loop through the array, and test to see if the x,y coord of the mouse is inside any of the RECT areas. If so, you clicked a hot spot - do what ever now.


    perhaps it might be helpful to make a struct with RECT hotspot and function pointer to what to do when that hotspot is clicked ie:
    Code:
    struct IMAGEMAP {
         RECT hotspot;
         lpfn ActionPointer;
    }; // psuedo
    Anyways, hope that is helpful.
    c++->visualc++->directx->opengl->c++;
    (it should be realized my posts are all in a light hearted manner. And should not be taken offense to.)

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    56
    That sounds like what I need, I will save this thread to my HD and try to figure out how it all works.... My brain is not able to compile all the information at once... LOL!

    I just wish I knew more about how c++ and the msvc compiler works. As it is, I feel way behind the curve. As I struggle to understand C++, .net is being developed, Dx and OpenGL are growing, and I keep finding more and more that I dont know... Verse, Python, and all the networking code, etc., etc..

  6. #6
    Registered User Tekime's Avatar
    Join Date
    Aug 2003
    Posts
    1
    Just to throw it out there, HTML is not a scripting language. It's a markup language -- it defines the structure and layout of a web page but has no interactive elements. It shares very little with a true programming language: no variables, no control structures, no events... it is static content.

    JavaScript, on the other hand, is a scripting language, but I think you would be hard pressed to find a program which could convert it over to C++. The two languages are extremely different, and operate on very different premise. Also, Java and JavaScript are two completely different animals. If your 'program' is written in Java, there may be some way to move it over to C++ since Java is far closer to a high-level language than JavaScript.

    Just thought I would try to put a little perspective on why your request might be a little bit imopssible. Good luck tackling this problem though!

  7. #7
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644
    Originally posted by Tekime
    Just to throw it out there, HTML is not a scripting language. It's a markup language -- it defines the structure and layout of a web page but has no interactive elements. It shares very little with a true programming language: no variables, no control structures, no events... it is static content....
    HyperText Markup Language is what HTML stands for (I was just making Tekime's point stronger).

  8. #8
    Banned frenchfry164's Avatar
    Join Date
    Oct 2001
    Posts
    1,552
    I said that it's "like" a scripting language for simplicity. I knew it was a markup language.

    About your statement of being behind the curve. Dx and OpenGL aren't growing, they are both already matured, and OpenGL has actually outgrown itself (Which is why I'm excited about OGL2). .net is only important if you are a slave of Microsoft or are working for a company who are slaves to Microsoft. Python isn't server script, it is a general purpose scripting language.

    Trust me, you are not behind. Unless you want to work at some software company like right now. Just keep at it, read articles and tutorials off the net, you'll get good at it.

  9. #9
    Registered User
    Join Date
    Aug 2003
    Posts
    56
    Thanks F-fry...

    As for the other stuff, I didnt necessarily mean a straight conversion of html to c++. But maybe coding around the html. But that even sounds hinky to me... LOL! I was more looking for other insights.

    I kinda took a break from the c++ stuff. The MSVC 6 compiler kinds scared me off LOL! I have been tinkering with 3d modelling and now that is getting complicated as well.

    So, I went back to 2d graphics and html manipulation. But now that I have kinda used the html as a template. I can see the nature of what I need to learn. I think I need classes, it seems it will take 6-months to a year to get through the basic crap that can be picked up in a couple weeks from the web tutorials available....

    I cant really imagine wasting good valuable time learning what a window is, and how to resize it... LOL! But, it seems like to get to the deeper coding classes you gotta take the seemingly useless prerequisite courses.

    Oh well, I'll just go back and forth until I get more understanding.

    Thanks for the info guys.

    Grumpy
    LOL!
    http://workinprogress.0catch.com

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. craps game & dice game..
    By cgurl05 in forum C Programming
    Replies: 3
    Last Post: 03-25-2006, 06:58 PM
  3. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 12:32 PM
  4. open() and close()
    By SoFarAway in forum C Programming
    Replies: 3
    Last Post: 04-08-2005, 01:16 PM
  5. Ghost in the CD Drive
    By Natase in forum A Brief History of Cprogramming.com
    Replies: 17
    Last Post: 10-12-2001, 05:38 PM

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