|
I would be interested in programming a simple game. However, beyond the basics I wouldnt know where to start with Graphics. I can add bitmaps to a dialog for instance, maybe move them around from place to place, show/hide them, but don't know where you would start for anything more complicated like animation, or detecting the state of game objects. Im talking something like a tetris clone, or maybe something like theme park, so im not thinking openGL or anything flash like that.
Can anyone give me a few pointers of where i would start, or any resources - there seems surprisingly little out there.
Thanks in advance,
Chris
|
|
|
|
|
Even for 2D, you would be better served to use DirectX - it simply gives you more options and control over things that GDI hides from you. I'd recommend the book 'Tricks of the Windows Game Programming Gurus' by Andre LaMothe as a tour of all aspects of writing a game using DirectX, but in 2D.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Does anyone have any opinions on using the STL... Is there any reason not to use it? I seem to spend a lot of time implementing things like linked lists, but have recently started using the STL. A lot of people take the view that there is no point reinventing the wheel and making things harder for yourself. Although I do like to know exactly how my programs work, am I really just creating more work for myself.
Secondly, should I be able to get at the STL in a console app. Im thinking maybe I need to include some header files, which ones might they be?
Finally, whilst Im here can I also ask whats the difference between including things with < and >, and in speech marks...
thanks
ben
|
|
|
|
|
It's great. However, you might want to check out http://www.stlport.org since there are some bugs etc. in M$'s impementation.
|
|
|
|
|
I too have recently started using the STL. To use it in a console app you include the appropriate header file(s) (e.g. vector, map, string, etc.) using the angled brackets. The .h is not used when naming STL header files.
The difference between using angled brackets and quotation marks is easy. If an include file is in quotation marks the compiler reads it from the current directory. If it is in angled brackets the compiler searchs the include path for the file.
>>>-----> MikeO
|
|
|
|
|
One correction - when #include'ing a file in quotes, if the file isn't in the current directory, the preprocessor then searches the INCLUDE path.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
I think you're right on the money. It's great that you've taken the time to understand how a linked list is implimented, but now you should go on to use the STL. It is an awesome set of tools, the more I learn about it, the more I wish I had time to learn about it.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I recommend Hewlett Packard implementation, it is free and - that's my opinion - better then Ms implementation.
Use STL and save money. Just like when writing 3d applications, use fe.: OpenGL or DirectX.
|
|
|
|
|
Hi.
> Finally, whilst Im here can I also ask whats the difference between including things
> with < and >, and in speech marks...
Easy:
#include <stdio.h> searches stdio.h in the defined include directories while
#include "stdio.h" searches the file first in the current directory and then in the standard include dirs.
Thus, use <> for standard files or standard modules you use often and "" for your own files the current project.
Karl
Pseudocode is code to demonstrate a concept, not designed to be run.
Like certain Microsoft software.
|
|
|
|
|
Hello,
I would like to stop a service programatically, do you know how to do it?
As always, thank you very much.
|
|
|
|
|
Use OpenService to obtain a service handle. Then, call ControlService with SERVICE_CONTROL_STOP control code.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
With
BOOL ControlService(
SC_HANDLE hService, // handle to service
DWORD dwControl, // control code
LPSERVICE_STATUS lpServiceStatus // status information
);
Good Luck!!!
Carlos Antollini.
|
|
|
|
|
Hello,
ENVIRONMENT:
Win2k
MVC++6 (sp.4)
simple WIN32 app: not MFC.
I would like to avoid the user to be able to press any "system key" (ALT+TAB, CTRL+SHIFT+ESC...).
I have a MFC application that does this very fine, but the problem I've found is that I get the keyboard controlled but I cannot ensure that the user won't use any of those keys while my application is being initialized. (it's slow because first I must wait for a service to start) (that app is an MFC one).
I've thought of trespassing the code that is now in my application to a service of my own in order to use the same but before the user has logged in.
The trouble is that I don't know how to avoid the error "undeclared identifier" with:
LPKBDLLHOOKSTRUCT and WH_KEYBOARD_LL (they are defined in winuser.h but I've added this header and nothing has changed)
could you give me an advice?
As always, thank you very much for your help.
|
|
|
|
|
The definitions you're trying to access are in the #if/#endif block:
#if (_WIN32_WINNT >= 0x0400)
#endif
Add the following line before #include <winuser.h> :
#define _WIN32_WINNT 0x0400
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
first of all let me thank you your help, but I'm a novice and I'm still having some problems:
if I define the _WIN32_WINNT 0x0400 then I get 36 errors that are like:
UNRESOLVED EXTERNAL SYMBOL __imp__SetWindowsHookExA@16
UNRESOLVED EXTERNAL SYMBOL...
If I try to include the winuser.h in the same cpp file then I get errors in the winuser.h ile (I think I must be missing some header file again)
Do you know what's happening?
At last, thank you again.
|
|
|
|
|
To avoid linker errors, add user32.lib to the list of libraries your project uses (Settings/Link/Object & library modules).
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
So... it seems like you want your app and prevent the user from shutting it down while it slowly starts up, right?
If this is what you want, let me suggest a better way. Simply display some sort of splash screen that indicates the progress of the startup. This will make the initial wait more tolerable and give the user feeback as to what's going on.
I just don't think you should take away the user's ability to shut your (or any other) app down. Imagine if it was done to you how you'd feel.
Regards,
Alvaro
|
|
|
|
|
I have loaded a dll in one thread, and then released it from the other thread. I am getting errors some times. is this is possible to load a dll in one thread and then releasing from the other thread. the handle of the dll is on the global scope.
|
|
|
|
|
Standard or mfc extension dll?
|
|
|
|
|
I'm trying to code a little utility to save icon positions but I'm
getting errors with my code. Can anyone see what I'm doing wrong?
Heres the code:
//----------------------------------------------------------------------------------------------------------
void StoreIconPositions()
{
//get screen dimensions
int cX = GetSystemMetrics(SM_CXSCREEN);
int cY = GetSystemMetrics(SM_CYSCREEN);
//convert to a string
string FileName = itos(cX) + itos(cY) + ".txt";
//try and open the file. If fail then we create a new file
ofstream out(FileName.c_str(), ios::trunc);
//get handle to desktop
HWND hwndLV = GetTopWindow(GetTopWindow(FindWindow("ProgMan",
NULL)));
//get number of items
int nMaxIcons = ListView_GetItemCount(hwndLV);
for(int nItem = 0; nItem < nMaxIcons; nItem++)
{
char IconName[MAX_PATH];
POINT pt;
//**************THIS IS WHERE IT CRASHES***********//
// Get the name and position of a listview item.
ListView_GetItemText(hwndLV, nItem, 0, IconName, MAX_PATH);
ListView_GetItemPosition(hwndLV, nItem, &pt);
// Save the name and position
out << IconName << endl << pt.x << endl << pt.y << endl;
}
return;
}
//----------------------------------------------------------------------------------------------------------
Thanks for any help.
fup
|
|
|
|
|
You are passing a pointer to another process (Explorer). The pointer in your app's process space cannot be used in another process, thus the crash.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
So what do I have to do to resolve this problem Mike?
|
|
|
|
|
The way I've seen described is to write an in-process COM server with one object. You also write a separate EXE which calls SHLoadInProc() to have the shell create your COM object. Once that's done, your COM object is running in the shell's process space, and you can then do what you want. The user runs the EXE, and the COM object saves the icon positions.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
I have done an alarm app.... a dialog box apears on alarm but if I have focus on another
window the box is in the background!
how??
I use MFC and don't want win32 code help!!
/*
BETA
*/
|
|
|
|
|
Use SetWindowsPos with HWND_TOPMOST.
Regards.
Carlos Antollini.
|
|
|
|