Seting coordinates of a character?
I''m a newbie programmer, just started learning C++ a few months ago.
Here is my dilema...
I have a programming project for school. This project is a win32 consol app. I''m using C++ for all of my programming and I''m wondering if there is a way to set a character to a certain (x, y) position on the screen.
My task is to create a gameboard (like chess) for our groups game. I have the board done, but I need a way to place characters inside the squares. This would be rather easy if there was a way to set the characters X Y coordinates and display that character at that location.
How would I do this?
Any help would be, well... helpfull. Thanks
????
HBITMAP image = (HBITMAP)LoadImage(blablabla);
HDC hdcimage = CreateCompatibleDC(mainDC);
SelectObject(mainDC,hdcimage);
BitBlt(mainDC,positionX,positionY,imageXwidth,imageYwidth,hdcimage,0,0,SRCCOPY);
The positionX and positionY are the variable that tells the location of the image.
Electron
HBITMAP image = (HBITMAP)LoadImage(blablabla);
HDC hdcimage = CreateCompatibleDC(mainDC);
SelectObject(mainDC,hdcimage);
BitBlt(mainDC,positionX,positionY,imageXwidth,imageYwidth,hdcimage,0,0,SRCCOPY);
The positionX and positionY are the variable that tells the location of the image.
Electron
"Your truth can be changed simply by the way you accept it."
Are you drawing the game with ASCII or mode 13h or something?
I know there are ways to move the ASCII cursor''s position in a win32 console app.. try looking up keywords console cursor on MSDN.
I know there are ways to move the ASCII cursor''s position in a win32 console app.. try looking up keywords console cursor on MSDN.
SetConsoleCursorPosition()
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
quote:Original post by Tjoppen#include <conio.h>...gotoxy(1,1);cout << test << endl;
The gotoxy() function is (sadly) not a standard function, so the above example will only work with the few C libraries that support it (AFAIK only the one supplied with Borland''s compilers, but perhaps a few others as well).
This is with ascii characters.
I know how to do this in windows programming, but not with a console application.
(I'm using Microsoft Visual c++ 6.0) The gotoxy didn't work,
'gotoxy' : undeclared identifier
Edited by - Krypton on January 16, 2002 1:03:32 PM
Edited by - Krypton on January 16, 2002 1:04:45 PM
I know how to do this in windows programming, but not with a console application.
(I'm using Microsoft Visual c++ 6.0) The gotoxy didn't work,
'gotoxy' : undeclared identifier
Edited by - Krypton on January 16, 2002 1:03:32 PM
Edited by - Krypton on January 16, 2002 1:04:45 PM
SetConsoleCursorPosition()! Look it up in MSDN.
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
[ GDNet Start Here | GDNet FAQ | MS RTFM | STL | Google ]
Thanks to Kylotan for the idea!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement