Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Mar 2011
Offline Last Active Dec 13 2014 09:03 PM

Posts I've Made

In Topic: Crash with <unable to read memory> error

01 December 2014 - 09:26 AM

Ok i fixed it, thank you. Turns out I can't access with -> instead I need to use (dot). 


my code had the following:

GameMap* Map;
Map->CreateMap(5, 5);

... and a like.


now it MUST be

GameMap Map;
Map.CreateMap(5, 5);

Why is this?

In Topic: How to get correct coords of the sprite

31 October 2014 - 09:21 AM

It may be difficult to explain so take a look at these two screenshots


This one is when mouse is outside of the region that is a square 96x96 and is positioned to render windows 0,0 (but I positioned camera differently and zoomed out, as i have shown in the code)




And this one is when the mouse is in the region, original one (that is the square region from 0,0 to 96,96), that is placed just under the 'file' menu, not the actual, top left grid tile.




What I wanted is to have marker tile like in second screenshot when I hover over the tile, regardless of camera settings. So, from there, I guess my problem is getting info on where the actual sprite is and its current size.

In Topic: math problems

24 April 2014 - 07:34 PM



Or just base your math on the simple idea that your map is a rectangular grid rotated by 45° and 60°, transform your mouse coordinates accordingly and you should get the same result


Wouldn't this actually be more complicated? I would need to create regular greed and rotate it 45 degrees, and than additionally transform mouse coordinates. Seems interesting but I am not quite sure how I would handle data in this case. Would I save out all data as if it was square greed and transform it on run-time?

In Topic: math problems

23 April 2014 - 02:41 PM

This is all completely 2D stuff. What I did is, I created grid using one sprite and simply placing it on calculated X and Y coordinates to form a grid.


I am looking into point in polygon stuff, but I am not sure how to do this yet. This is what I am testing with

// triangle to test against
sf::ConvexShape hex;
hex.setPoint(0, sf::Vector2f(0, 0));
hex.setPoint(1, sf::Vector2f(96, 0));
hex.setPoint(2, sf::Vector2f(0, 48));

// check coordinates if inside the triangle
if(Mouse.x >= hex.getPoint(0).x && Mouse.y >= hex.getPoint(0).y)
  if(Mouse.x <= hex.getPoint(1).x && Mouse.y >= hex.getPoint(1).y)
    if(Mouse.x >= hex.getPoint(2).x && Mouse.y <= hex.getPoint(2).y)
	diamond.setPosition(0, 0); // this is tile marker - it will highlight the tile mouse pointer hovers over

Something is off since I am still in rectangle calculation and not triangle. Am I on the right track?


EDIT: I found this - http://www.geeksforgeeks.org/how-to-check-if-a-given-point-lies-inside-a-polygon/ - looks close to the first reply, and this does answer my question. Thanks for help everyone.

In Topic: compile windows code on unix

23 December 2013 - 01:07 PM



Unless I understood proanim's question wrong, he's not looking to compile a windows program that works on unix, he's looking to build windows executables with a unix machine as build server.

Is that correct, proanim? 


The idea was to compile program remotely from unix build server, which will run on windows, but later be ported to linux and mac. And, program is supposed to have both directx and opengl included not just one (for windows version).