Jump to content

  • Log In with Google      Sign In   
  • Create Account

Calling all IT Pros from Canada and Australia.. we need your help! Support our site by taking a quick sponsored surveyand win a chance at a $50 Amazon gift card. Click here to get started!


EpicCupcakes

Member Since 12 Feb 2012
Offline Last Active Jun 08 2014 11:32 PM

Topics I've Started

Rotate a grid of points

09 February 2013 - 10:01 PM

Right now I am trying to rotate a grid of individual points on the grid's center, to make it spin around its center like a top. However, all I've managed to do is make the grid orbit that point in a circle. How would I go about actually making an entire grid of points rotate around a central axis?


Innaccurate Mouse

04 February 2013 - 07:12 PM

Edit: I apologize for the misleading post title. I mean to type "Innacurate Draw Positions in DX9".

 

Hello, all. I'm working on a simple project involving drawing a grid using the DirectX 9 API, and I've run into a problem where the position of shapes drawn to my window don't match up to the position my mouse is (supposedly) in. I'm using this code to retrieve my mouse position:

 

    POINT point;
    GetCursorPos(&point);
    ScreenToClient(givenhwnd, &point);

 

but when I draw a shape to any specific area, my mouse shows it as being about 10 pixels off in either direction. Strangely, this only happens the further away from the topleft corner of the window. This is making hit testing my grid hell. I'm not sure if my problem lies in my backbuffer size(1024x768), or in my inability of use AdjustWindowRect correctly (I'm sure I haven't), or whether I should use AdjustWindowRectEx instead, but any help that would be greatly appreciated.

 

Here are my AdjustWindowRectEx and CreateWindowEx calls.

	RECT rect = {0,0, gnBackBufferWidth, gnBackBufferHeight};
	AdjustWindowRectEx(&rect, GetWindowLong(m_hwnd, WS_OVERLAPPEDWINDOW), FALSE, NULL);

	    m_hwnd = CreateWindowEx (
           0,                  
           szClassName,       
           "Grid App",     
           WS_OVERLAPPEDWINDOW,
           CW_USEDEFAULT,      
           CW_USEDEFAULT,     
           rect.right,               
           rect.bottom,               
           HWND_DESKTOP,      
           NULL,             
           hThisInstance,      
           NULL               
           );

Is XML non-programmer friendly?

08 December 2012 - 12:35 PM

Hello all.

In preparation for a game I'm making that has quite a large dialogue/visual novel portion to it, I've decided that I needed a way for non-programmers(writers, artist and authors) to manipulate screen elements and create scenes and dialogue without having to learn a high-level coding language like C++ or Java. This has led me to begin designing a scripting language to fit the needs of those authors and writers.

However, roaming around on the internet, I've heard of XML and how it is said to shorten the time spent making text parsers and custom scripting languages.I am interested in adapting XML for my project, but there is an important question that I have: Since my goal is to allow a non-programmer with no prior knowledge of programming or scripting languages to write his or her dialogue and scenes in a text file, would XML be too complicated or difficult for them to work with? How complicated would the syntax the author has to learn be?

If anyone with experience with using XML in C++ could answer these, it would be greatly appeciated. Thanks.

Need application to graphically plot 2D paths

07 September 2012 - 06:28 PM

Hello, all.
I am currently working on a simple 2D card game and I want to add some simple animations to it. All I want is to move the cards along a curved or circular path in order to add a bit of flair to the game when the player draws a card. Does anyone know any programs that would allow me to plot that path graphically and then create a file with that path's data that I can use in my code?

Container Access Problem

12 August 2012 - 01:31 AM

I've been having a small problem with containers in C++, mainly the "list" container. I've been trying to cycle through a list using an iterator and delete items with a certain criteria, but I've been having problems using the list's "erase" and "remove" functions to delete those items from the list. I don't know if I'm misusing the functions or if the list is simply not maid for jobs like this.

Here's the code I've been running:

#include <iostream>
#include <list>
using namespace std;
class SayProcess
{
    public:
    SayProcess(){}
    void Say()
    {
	    cout << "Say" << endl;
    }
    ~SayProcess()
    {
	    cout << "Deleted" << endl;
    }
};
int main()
{
    SayProcess s1;
    SayProcess s2;
    SayProcess s3;
    list<SayProcess> List;
    List.push_back(s1);
    List.push_back(s2);
    List.push_back(s3);
    list<SayProcess>::iterator it = List.begin();
    for(; it != List.end(); it++)
    {
	    (*it).Say();
	    List.erase(it);
    }
    cout << "List Completely Deleted!" << endl;
    char x;
    cin >> x;
    return 0;
}

This is a simplified version of the code that is broken, but it has the same problems. I was hoping to simply have the loop print out each Process's message and then erase the Process from the list, but it's not working the way I had intended.

When run, this code will repeatedly print the SayProcess's two messages, the "Say" function's message and the destructor's message until infinity. The fact that it is repeatedly calling the destructor confuses me. Is it copying the item somehow?

I feel as if the problem is in my understanding of how either lists or iterators work, but I don't know enough about their design to tell why, and MSDN has been unhelpful. Can anyone help out by telling me what I'm doing wrong?

PARTNERS