|
Excuse me for asking the obvious, but are you trying your project in a Unicode-enabled platform (NT 4.0/2000/XP)?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yes, I'm using 2000. All of the other UNICODE functions seem to be working correctly...
-Scott
|
|
|
|
|
Hi
could you help me who to print text in "Arial CE" 12px ? ( in map mode MM_HIMETRIC).
I use CFont::CreateFontIndirect, but I don't which font size have to I set.
Wiizi
|
|
|
|
|
Use CreatePointFont or CreatePointFontIndirect and pass the printer DC.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Previous answer assumes that you're going to create 12 point font. However, px from your post suggests pixels. 12 pixels on the printer is too small - you'll get little rectangles instead of words.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Sorry, I need print font which has same size as on all printers.
Wiizi
|
|
|
|
|
OK - that's why you need to express the font size in points. CreatePointFont[Indirect] will do the job nicely.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
what is the importants of learning the bitwise command? Does it come in handy latter on in programming? "Its slightly comfusing," But if it is an important thing to learn, i dont mind learning it, vise versa.
Thanks all
~SilverShalkin
Rose tip dew berries, surounds the warmth of deference realms.
Lead the life in fantasy. Where life at end is life just starting.
|
|
|
|
|
Ever worked with window styles?
Any time you have to deal with a bit mask, you will have to use the bit operators.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
Actually i havent done much with window styles. But, im learning what i need to make an Engine that will help me program a game, and it will be in windows. "I guess ill give it a shot "
Also,...
If i was programming an engine in windows, do i have to use mfc? "I dont think so, my opinion, but what would be easiest, or better?"
Thanks for your help!
~Silvershalkin
|
|
|
|
|
No you don't have to program your engine in MFC.
Actually your game engine IMO should be done in C for performance reasons. C++ allows easier/better implementation and design, but less performance i'd think anyway.
Depends on what your engine is gonna do...?
Flight simulator...? IMO....absolutely C and maybe even inline where you feel comfortable.
Board games like tic tac toe or battle ship, something with less intensive AI, Graphics and such...MFC would suffice.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
Actually your game engine IMO should be done in C for performance reasons. C++ allows easier/better implementation and design, but less performance i'd think anyway
C++ can be slower than C, but not always. For instance, if you use virtual functions it will slow down your application. But IMHO you should not give up classes, templates etc. If nothing, you can use C++ "as better C".
I vote pro drink
|
|
|
|
|
I agree for the most part, unless performance is a serious issue...I had no idea what kind of game was being developed so I couldn't really give a definte answer.
I've personally experienced code which was totally enhanced when converted to C++ because you think in a different mindset when OOP as compared to procedural C.
As far as the game is concerned I suppose it's a matter of opinion...if you like the safety and clarity of C++ and don't mind losing a few clocks it's definetly the way to go.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Other than the "this" issue (which in many cases can improve speed given that it is passed around in ECX instead of on the stack and if you don't run out of registers during optimization), I have to agree that C++ can gernerally slow things down.
In some cases it is sloppy code such as using the C3dVector + operator between two vectors when all you really need to do is add a single value to one of the coordinates.
But I have also seen other performance problems usually involving templates. (Hint, those STL algorithms that some people love and adore can be drastically slower than hand-written loops. And I am not talking about hand optimized loops either.)
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
When i say engine, i mean, i use it to build the game "I know you know that." like use it to build a 2D game. its not a first person shootup or anything, "i would use c++ to do that"
So,.. your opinion on, should i use MFC or not, i think i should "personaly"
Thanks
~SilverShalkin
Cant think bad when it comes to learning
|
|
|
|
|
If your game is just a single window I would avoid MFC, because it's not really nessecary and still carries quite a bit of overhead.
I imagine you save a bit of time avoiding the
CDC, CString etc...classes and just use SDK handles and such without much more effort on your part.
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
HockeyDude wrote:
I imagine you save a bit of time avoiding the
CDC, CString etc...classes and just use SDK handles and such without much more effort on your part.
What exactly is the SDK? "I am new, not stupid, just havent learned it yet"
But if you could tell me, i can look it up and learn how,
Thanks!
~SilverShalkin
The color swirl black on blue
Tips of white, like angels hue
touch is soft and full of life
The Rose lay still, on thee ice
Dustin Tigner
|
|
|
|
|
It stands for System (or Software) Developer's Kit. In this context, it refers to the native API (Application Programming Interface) handles (like HDC, HPEN, etc.) and functions.
|
|
|
|
|
SDK-Software development kit
It's ummm basically the generic windows functions stored in the user32/gdi32/kernel dll's (i think).
Using C and the SDK will allow more direct control over what goes on around you. One abstraction level lower than what MFC provides (I think is how you would describe it) someone will coreect me if i'm wrong.
MFC is slower and clunky because it does it's own tests and such before calling the windows API(SDK) functions.
Once you understand what MFC is and how to use it...it makes sense in most cases, but for single window apps...I would say go will C/SDK programming. However if all you've done is use Classwizard and tools, creating your message pump and handler function and class registration might be a little more verbose than what your used to.
Try looking for simple SDK examples and you'll see what I mean.
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
very important for working with 'non-uniform' variable sizes through your code. For instance, if you want to combine two 8 bit chars into a 16 bit int you could use the MAKEWORD (a,b) macro provided in win32. But if you look at the source for this macro it uses bitwise operators to do so (actually uses a SHIFT and an OR):
WORD MAKEWORD(
BYTE bLow,
BYTE bHigh
);
MAKEWORD(a, b) \
((WORD) (((BYTE) (a)) | ((WORD) ((BYTE) (b))) << 8))
And many many other important uses.
- Merle
|
|
|
|
|
I can't make the my Activex control get focus in Word/Excel while using Normal view. When I turn view mode to design view it works.
Any suggestions ?
|
|
|
|
|
|
Declare variable once in .cpp file:
int g_Var;
and define it in h-file:
extern int g_Var;
Variable will be available in the file where it is declared and in all .cpp files where h-file is included.
If you include h-file with extern definition to .cpp file with the same variable, it's OK for compiler:
extern int g_Var;
int g_Var;
The same with functions:
// .cpp file:
void MyFunction()
{
// ...
}
// .h file:
extern void MyFunction();
|
|
|
|
|
Hi all,
I am attempting to use a deque as a frame buffer reading data from a serial port. When the entire frame is received, I want to use the frame buffer (the deque) to write the contents of the deque to a file, enpty the deque and start collecting data for the next frame.
The problem I am having is in writing the contents of the deque to a file. I have some experience writing to files, but I am unsure how to do this using a deque. How do I write the contents of the deque to a file??
If anyone has done this before (which I'm sure many have) could you give me a few hints.
Thanks
Merle
|
|
|
|
|
This writes a deque of int s to a file, one int per line. The extension to other types is straightworward (define the corresponding operator << ):
deque<int> dq;
...
ofstream ofs("whatever.out");
for(deque<int>::const_iterator it=dq.begin();it!=dq.end();++it){
ofs<<(*it)<<endl;
}
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
PS: There are other, more STL-intensive ways to do this, involving inserters and stuff like that. I hope Christian will cover these subjects in his upcoming STL tutorials.
|
|
|
|