Click here to Skip to main content
Click here to Skip to main content

WTL SeaBattle game

By , 12 Aug 2004
 

Introduction

WTL is relatively unknown library for most of C++ developers. Even in its current state (with no official Microsoft support as far as I know) it could compete with MFC as tool for development GUI applications a especially small standalone applications. It is template library and if you design your application right, then it would depend on minimal or none other dll. So I decided to write WTL application just for sake of experience to see how hard to do it. It turns out to easy enough for a programmer with experience in MFC and WinAPI. Most of the classes match names of MFC classes serving the same purpose. And I did not have to wonder if I got right version of MFC dlls on any other machine where I copied my application. I wanted to do something which would not be too boring, so it was a logical choice to write something funny and useless: a game. WTLSeaBattle is simple version of widely known game “Sea Battle”, it sole purpose is to give an example of dialog based WTL application.

Building Environment

This application was developed using VC++ 6.0 SP6 and WTL70, and tested under Windows XP.

Application Description

WTLSeaBattle is dialog-based application written using WTL. Its main class is CMainDlg (files maindlg.*) which deals with managing controls in dialog, “battle field” classes and communications between objects inside application. Classes CMyShips (MyShips.cpp) and CEnemyShips (EnemyShips.cpp) implement player’s and computer’s game fields respectively. CMyShips and CEnemyShips derived from common base class CDisplayAreaWnd which contains common functionality. CMyShips allows user to place ships, CEnemyShips places computer’s ships and handles calculation of next “shot” during game.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Gregory Elbert
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralAbout an error of the source Game WTL Sea Battlememberjedimastervn22 Oct '06 - 7:47 
in the Source of the game WTL Sea Battle , when I download the source of the game and run, it has an error : Details :
 
C:\Documents and Settings\pc1\Desktop\WTLSeaBattle\WTLSeaBattle.rc(10) : fatal error RC1015: cannot open include file 'atlres.h'.
 
Demo Game runs very good, but the source can't run.Please show me how to run the source or the source has an error??
If you could, could you show me HOW TO DESIGN A GAME LIKE SEA BATTLE???
I very like this game, but i don't know how to make it? Please show me, thanks a lot
GeneralRe: About an error of the source Game WTL Sea Battle PinmemberGregory Elbert23 Oct '06 - 10:37 
Hi,
atlres.h is (or used to be) part of ATL or WTL install. Unfortunately Frown | :( I do not have WTL and ATL installed so I can not confirm which library it belongs.
Game design is relatively simple: It is "dialog" type application , which has two custom controls (playing fields) and set of buttons to drive game process. Custom controls have common base which is responsible for painting and counting hits. Derived class in custom controls provide customization for "player" and "computer" fields (something like generating hit for computer or processing mouse click from user).
GeneralRe: About an error of the source Game WTL Sea Battle Pinmemberjedimastervn25 Oct '06 - 7:48 
Hi,
may I ask you some thing?
I just download WTL and install but it still has that error when run the source code.What should I do to fix that error? Please show me.i'm a newbie and i don't know much about how to fix Sigh | :sigh: .
You don't have WTL and ATL, how can you design game Sea Battle??
I really don't know.D'Oh! | :doh:
If you have guide or faq (show the way to design Game by Visuall C++ ), please Send me,I'm really really want to make game by Visual C++, especially game Sea Battle.I very love this gameSmile | :) . If you have, please send to me.Thanks.Thanks a lot.
My email :
pashamohamed@gmail.com
pacsua2003@yahoo.com
GeneralRe: About an error of the source Game WTL Sea Battle PinmemberGregory Elbert1 Nov '06 - 8:28 
I have written this game a few years ago. ATL and WTL are must to be able to compile. Knowledge of object oriented programing will very helpful. I do not have any guide or FAQ, game is simple enough, so if you can get ATL and WTL, compile game, then you should be able to debug code and understand how it works.
GeneralRe: About an error of the source Game WTL Sea Battle PinmemberPandeydwr6 Jul '07 - 2:14 
hi
my self amit will u teach me ??plz how can we use this site ??D'Oh! | :doh:
 
Amit Pandey
pandeyamitdwr@rediffmail.com

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 13 Aug 2004
Article Copyright 2004 by Gregory Elbert
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid