|
Thanks for the two suggestions and the link.
I think that I might have over stated the 'seriousness' of my attempts at a graphics program.
My approach is very simple.
I have designed some image lists comprising a number of bitmaps to represent the orientation of each shape.
I simply randomly select an imagelist and bitmap and use this to draw to the window view.
Since the format of the Tetris program is to simply draw the image advancing/rotating/moving side to side it does not involve any complex graphics manipulation.
I simply use BitBlt.
My problem is the type of VC++ application I should define so that I can have a control loop somewhere that generates these random shapes and dispatches them to be drawn.
I defined a straight forward SDI application and tried to use it as my base, but I do not know where my control loop should be placed.
Is this the right kind of application for this type of program ? or do I need another type WIN32 etc ?
As I say, my problem is not realy knowing the windows/MFC generated environment.
Any advice would be very welcome.
|
|
|
|
|
The trick is for a game processing loop, is that you want to update your graphics after all of the input has been processed.
In MFC, the processing loop is hidden from you, but you could always override the PretranslateMessage function, but that could get a little messy. Other than that, I am not an MFC guru so I do not know the simple way to change the message processing loop in MFC.
If you go for a plain Win32 implementation, that would be a lot easier. Your message pump should look something like this:
while (TRUE)
{
if (PeekMessage( &m_msg, NULL, 0, 0, PM_REMOVE))
{
if (WM_QUIT == m_msg.message)
{
break;
}
if(!PreTranslateMessage(&m_msg))
{
::TranslateMessage(&m_msg);
::DispatchMessage(&m_msg);
}
}
else
{
OnUpdateFrame();
}
You should use PeekMessage because GetMessage blocks until a message becomes available. There are other things that I omitted from this loop that will help your idle processing and when the game is paused.
If you are adventurous, and understand C++ templates, you may want to checkout WTL. I wrote a full version of Tetris in DirectX for this, and there is a base window that you could use to start your version.
I also wrote a class that is a modified gameloop for WTL, so you would not have to mess with this. This code can be found here: WTL GameLoop[^], and my Tetris game can be found here: Tetris[^]
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Who has C/C++ experience about 3-4 years with experience with: Win32, MFC, Javascript, and Visual basic inlcuding, HTML, CSS, Java, Open GL, some Perl, some PHP, some assemebly, some directx type api stuff. What would be the adverage yearly income on a starting position of someone with those following skills. Thats with only some college education no degrees as of yet.
- LiquidKnight
|
|
|
|
|
Um maybe 20k to 25k if you're lucky
|
|
|
|
|
Even with a very high level of C++ experience?
- LiquidKnight
|
|
|
|
|
Benny is right on. If your 3-4 years experience is work experience (and not "playing" at home), maybe a bit more. You don't start into the serious money until you have several projects under your belt and can demonstrate all of the skills not directly related to writing code (like doing software requirements/design docs, working in a team environment, generating formal test procedures, user documentation and follow up support including program updates and associated paper work). This is especially true for government contracts - a lot more time is spent on the paper work than actual coding. When I stated out (25 yrs ago), I was making about 14K a year. In six years, that figure just about tripled. This was in OS & compiler design and not application programming.
Steve
|
|
|
|
|
It depends on the kind of experience.
Somebody who knows STL inside out and every nuance of the C++ Standard might be good but if he doesn't have experience of building MFC GUI apps talking to a database then his experience doesn't have much commercial value to my company.
Michael
The avalanche has started, it's too late for the pebbles to vote.
|
|
|
|
|
It depends on what type of experience.
Usually companies do not like to count hobby programming as years of experience, so unless you can show an employer your practical, full-time experience, they are likely to pass you by. You will have an easier time getting a job with a college degree than without, especially in this economy.
With that said, you could probably get a job for about 20 - 25,000 dollars, and once you get a degree, 40 - 50,000 a year.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
It would all depend on how much commerical experience you had with each technology. If you had 3-4 years of commercial MFC/WIN32/C++ experience then I'd probably be paying £18k-25k in the current market.
A lot would depend on the skillset and experience value to my company.
Michael
The avalanche has started, it's too late for the pebbles to vote.
|
|
|
|
|
Hiya does anyone have any tutorials or links on using C++ with SQL. I know C++ already but want to learn SQL. I will be using Visual C++ 6.0.
All I know is there is a header file called sql.h.
Thanks for any help..
grahamoj.
|
|
|
|
|
see ADO or DAO . ADO is a COM-based interface; DAO has an MFC interface (CDAORecordset and friends)
-c
Fractals
|
|
|
|
|
I am developing a MFC Document/view application which only has one document type and one view type. Up until now I have developed it as a SDI style application. However, I now wish to create two different "versions" of the application: the SDI version, and a MDI version which supports multiple views and documents in one frame window.
My question is: is there any way that i can use the same functionality from my original SDI-Frame class in the new MDI application or subclass from it in order to not lose all functionality, toolbars, menus, etc? The reason I'm thinking subclassing is because i need both the SDI frame and the MDI frame to be functional in the same project: ie I can't just convert it, I need to keep the SDI functionality and also extend it for a MDI application.
Thanks very much
Ben
|
|
|
|
|
I have a question, obviously, I have a MDI application with three different document templates. I simply want to launch a specific one from a menu option. How would one go about launching a certain document/view?
Thanks
Michael Shuster the 1st
|
|
|
|
|
CMultiDocTemplate::OpenDocumentFile
|
|
|
|
|
I acutally got that far, I jsut do not know what to use for a parameter. It is asking for a path name string but i want to load a template. Forgive me if I am missing something obvious
|
|
|
|
|
Call CDocTemplate::OpenDocumentFile and pass it NULL. The MSDN says this causes it to create a new document.
Chris Richardson
C/C++ Include Finder[^]
|
|
|
|
|
hmmm, that did not seem to work. I can not pass it the value of Null. It returns the following error:
error C2512: 'CDocTemplate' : no appropriate default constructor available
Plus I want to actually pick which document templat opens. I have three, and I want a specific one to open.
Any other suggestions or maybe you could refer me to where you read that at.
|
|
|
|
|
Sounds like you need to make use of the undocumented MFC class CDocManager. When you call AddDocTemplate() in InitInstance(), the template pointer is handed off to the m_pDocManager object, which is part of your CWinApp object. You can use this to iterate the CDocTemplates registered in your application and call OpenDocumentFile(NULL) on your CMultiDocTemplate object.
This should create an empty document of the required type.
See MFC files DOCMULTI.CPP line 114 and DOCSINGL.CPP line 88 for the functions in question.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Hi,
I have some ownerdraw listbox controls with custom background color. All works well, but on Windows XP they show a white border (1 pixel thick around client area, the middle is painted with my custom backgound). Looks really ugly and I dunno what I'm doing wrong...
I have this on XP only (default desktop theme), not on Win9x. Can anyone help?
Thanks for feedback, Moak
|
|
|
|
|
You can turn off themes for the control, to go back to the pre-XP behavior.
SetWindowTheme ( hwndList, L"", L"" );
--Mike--
Looks like I picked the wrong week to stop sniffing glue.
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Is there another possibility? perhaps I'm doing something wrong and causing the white border by wrong WinAPI use?
basically, I like to use themes, e.g. XP scrollbars look nice and I also want to respect the user's look&feel.
Greets, Moak
|
|
|
|
|
Hi,
U can use CRecordset class for doing things related to database like adding update and delete. First u have to create DSN and create a new class with CRecordset as the base class and proceed with creating a pointer to the object.
Try that.
Satya
|
|
|
|
|
That time has come again where I have a project that I have to document for a government cutomer. Currently my company doesn't have any tools for generating documentation and I have been investigating what is out there.
I haven't found any tools that could even help as most of them just give you the most basic of info like all the class names.
If you have any good tools that I might try please let me know.
Also, I'm thinking about coming up with my own tool and would like to try and get a bunch of the pieces from code that is already out there...any ideas on a good app to start from or modules I could use to get a good start on this?
Thanks,
Jim
|
|
|
|
|
A lot of people like the tool that this[^] article shows how to use.
Chris Richardson
Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith
|
|
|
|
|
Chris, Thanks for the link. That is a pretty good tool, would have been more useful it I would have known "how" to document my code in its standard (like most of the tools that I have found).
I think I'm going to use it and as time goes by my code should get up to speed with it.
Again, thanks.
Jim
|
|
|
|