I would not recommend the compiler. gcc or clang are good alternatives, though there doesn't seem to be a trivial way to use either with MSVC.
Popular IDEs you can use them with are Code::Blocks and CodeLite. Perhaps also QtCreator.
Geany might also be a lightweight alternative.
[QUOTE=Niteshifter;33330847]You'll need to have it check if the sides that are adjacent to the corners are free and if they are, then you can move to that location ie: if the top square is free and the left square is free, then the top-left square can be moved to (providing it's also free).[/QUOTE]
Alright thanks for all the help.
[QUOTE=ZeekyHBomb;33329910]Vanish? You're not declaring them as locals, are you?[/QUOTE]
Yes, and I am aware that's the cause of the problem. I just want to know how I can access the variables created in the Player::Player() function inside of the Player's Player::tick() function without having to make the sprite a public var of the Player class, if that's even possible.
[b]Edit:[/b] not enough Player in that sentence
...Make the sprite a private member, then?
[QUOTE=jalb;33222273]No where do they mention strings. Nor do they reassure what I've asked.
I appreciate the help but MSDN was my first stop. After much googling it also seems that volatile with std::string is a bit of a mystery. I think I'm fine without volatile but I was hoping for some reassurance here because I don't completely understand the nature of multithreading.[/QUOTE]
This should explain the problem you are seeing:
[url]http://www.gamedev.net/topic/479776-volatile-class-to-class/[/url]
The compile error is caused by the library functions for std::string not being designed to support volatile. I think this is typical of most classes because changes in state could access more than one internal value and doing this without a lock will cause race conditions.
Now, to hopefully help with any confusion you have about using std::string across threads. I believe all of the c++ standard library classes support multi-threaded reading but require synchronized writing. If the data is immutable, ie. initilize and never change it, multiple threads can read from it with no problem. If you need to continuously update the object while simultaneously reading from it in other threads, you must guard [B]all[/B] access to the object with a lock. Not doing so risks a crash, corruption or other undefined behavior.
Oh, that does clear things up. Thank you. Reading that thread makes me realize I have a lot to learn about multithreading.
How much slower would it be to have a table full with objects with draw functions and call them in a loop instead of hardcoding the draw functions?
I mean something like this: (In this case, Lua)
[code]
local obj = {}
obj[1] = {name="Foo", draw= function() --[[ Draw fes type here ]] end}
obj[2] = {name="Bar", draw= function() --[[ Draw baz type here ]] end}
for k,v in pairs(obj) do
v.draw()
end
[/code]
vs.
[code]
local obj = {}
obj[1] = {name="Foo", type="Fes"}
obj[2] = {name="Bar", type="Baz"}
for k,v in pairs(obj) do
if v.type == "Fes" then
-- Draw fes type here
elseif v.type == "Baz" then
-- Draw baz type here
end
end
[/code]
I am making a top down tile based game using xna and was wondering if anyone could help me on how to make tile based shadows, like Thermadyle [url]http://dl.dropbox.com/u/23797593/newlight.png[/url]
Thanks
Can someone with matrice experience give me a hand?
I currently have this code to add movemnt and rotation:
[cpp]
void PlayerClass::HandleEvents(sf::Event &Event)
{
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == WindowSettings::controls.TurnClockwise))
d3sprite->rotation.y += 90.f;
if((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == WindowSettings::controls.TurnCounterClock))
d3sprite->rotation.y -= 90.f;
}
void PlayerClass::Update()
{
float speedMulti = 0.002f;
if(sf::Keyboard::IsKeyPressed(WindowSettings::cont rols.Jump))
speedMulti = 0.1f;
if(sf::Keyboard::IsKeyPressed(WindowSettings::cont rols.Up))
d3sprite->position.z -= speedMulti * engine->App.GetFrameTime();
if(sf::Keyboard::IsKeyPressed(WindowSettings::cont rols.Down))
d3sprite->position.z += speedMulti * engine->App.GetFrameTime();
if(sf::Keyboard::IsKeyPressed(WindowSettings::cont rols.Left))
d3sprite->position.x -= speedMulti * engine->App.GetFrameTime();
if(sf::Keyboard::IsKeyPressed(WindowSettings::cont rols.Right))
d3sprite->position.x += speedMulti * engine->App.GetFrameTime();
d3sprite->Update(engine->App.GetFrameTime(), true);
}
[/cpp]
And this to update matricies and such
[cpp]
void d3Sprite::Update(float deltaTime, bool blah)
{
if(alphaAmount < 0.0f) alphaAmount = 0.0f;
if(alphaAmount > 1.0f) alphaAmount = 1.0f;
if(rotation.y > 1.0f)
{
rotating = true;
rotation.y -= 0.5f * engine->App.GetFrameTime();
mRotation.y += 0.5f * engine->App.GetFrameTime();
}
else if(rotation.y < -1.0f)
{
rotating = true;
rotation.y += 0.5f * engine->App.GetFrameTime();
mRotation.y -= 0.5f * engine->App.GetFrameTime();
}
else
{
mRotation.y += rotation.y;
rotation.y = 0.0f;
rotating = false;
}
if(rotating == false) mPosition = position;
else position = mPosition;
glm::mat4 modelRotate = glm::rotate( glm::mat4(1.0f), mRotation.y, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 modelTranslate = glm::translate(
glm::mat4(1.0f), mPosition);
//modelTranslate = modelRotate * modelTranslate;
modelMatrix = modelTranslate * modelRotate;
if(blah)
{
glm::mat4 lookAtCam = glm::lookAt(
glm::vec3(mPosition.x, mPosition.y + 3, mPosition.z + 5 ), // Camera is here glm::vec3( 0, 0, 5 );
glm::vec3( mPosition.x, mPosition.y, mPosition.z ), // and looks here : at the same position, plus "direction"
glm::vec3( 0, 1, 0 ) // Head is up (set to 0,-1,0 to look upside-down)
);
glm::mat4 rotationCamera = glm::rotate( glm::mat4(1.0f) , mRotation.y * -1.0f, glm::vec3(0.0f, 1.0f, 0.0f) );
engine->cameraMatrix = lookAtCam * rotationCamera;
}
MVP = (*perspectiveMatrix) * (*cameraMatrix) * modelMatrix;
modelMatrix = glm::mat4(1.0f);
}
[/cpp]
with wich I get this result:
[video=youtube;TY9eGkICloM]http://www.youtube.com/watch?v=TY9eGkICloM[/video]
Notice how the rotation is fucked up and the player doesnt move right.
The camera moves to the left and right as well as towards and away as it should depending on its rotation.
But the player always moves on the X and Z axis no matter what its rotation.
Changing the modelMatrix to:
[cpp]modelTranslate = modelRotate * modelTranslate;
modelMatrix = modelTranslate;// * modelRotate;[/cpp]
I get the result I want except the player doesnt rotate around himself.
[video=youtube;hQgMLQdbp1s]http://www.youtube.com/watch?v=hQgMLQdbp1s[/video]
[QUOTE=Niteshifter;33279926]Try [url=http://pastebin.com/CVZ0jX9z]this[/url]. It creates a basic window with the sprite, but there's a couple smaller details that are different from yours.[/QUOTE]
I finally got it to work, thanks.
I had to rebuild the entire project after all, I feel stupid. But at least I've learned from it.
Anyone know how to get libcaca to work with C#?
[QUOTE=Hypershadsy;33348574]I'll pay someone money to tell me how to get libcaca to work with C#, and it works.[/QUOTE]
[url]http://lmgtfy.com/?q=libcaca+c%23[/url]
??
[highlight](User was banned for this post ("Unhelpful reply / LMGTFY link" - Swebonny))[/highlight]
[QUOTE=thomasfn;33348602][url]http://lmgtfy.com/?q=libcaca+c%23[/url]
??[/QUOTE]
You know, this is only appropriate when the results are useful.
Actually, fuck that, it's [i]never[/i] appropriate, regardless of how stupid the question is.
I can see several results for libcaca for C# when googling. I'm fairly sure they're not [i]all[/i] broken.
[editline]20th November 2011[/editline]
And he has't exactly given much information about what problem he is having. What kind of a response was he expecting?
Right, right
[img_thumb]http://dl.dropbox.com/u/21571661/Pictures/libcaca%20is%20caca.png[/img_thumb]
[img_thumb]http://dl.dropbox.com/u/21571661/Pictures/mvs.png[/img_thumb]
[img_thumb]http://dl.dropbox.com/u/21571661/Pictures/mvs2.png[/img_thumb]
Mind helping me with tile collision facepunch?
[code]
public boolean collidesWith(int tileX,int tileY){
if(!level.shouldCollide(tileX, tileY))
return false;
int x=(int)this.x;
int y=(int)this.y;
if((x>=tileX&&x<=(tileX+width/16))&&(y>=tileY&&y<=(tileY+height/16)))
return true;
return false;
}
[/code]
[editline]19th November 2011[/editline]
It's topdown, so no gravity
Hey guys, I saw all the stuff going on in this thread and I thought it was the coolest thing i'd ever seen. I'd really love to make a 2D game myself as I had one in mind for years now.
If I coded it in C++, how would I get started? (I need to learn C++ of course)
Learn the syntax of C++
[editline]20th November 2011[/editline]
First, that is. Accelerated C++ is a gift from the heavens if you have any idea of what you're dealing with but if you're not familiar with C++ yet, go for something easier.
[QUOTE=esalaka;33349310]Learn the syntax of C++
[editline]20th November 2011[/editline]
First, that is. Accelerated C++ is a gift from the heavens if you have any idea of what you're dealing with but if you're not familiar with C++ yet, go for something easier.[/QUOTE]
Ive had people reccomend me Java and stuff before. But everyone reccomended me different things so I thought i'd just start with C++
Lua and LOVE would probably be easier. And faster. And some of the most awesome games here have been made with that combination.
Or technically it's not even a combination.
So what's LUA used for besides Gmod?
[QUOTE=DerpHurr;33349443]So what's LUA used for besides Gmod?[/QUOTE]
[url=http://love2d.org/]Lots of things[/url]
[QUOTE=esalaka;33349521][url=http://love2d.org/]Lots of things[/url][/QUOTE]
Wow, that looks so amazing. Well, i'm going to get started then :D. Thank you so much esalaka.
[editline]20th November 2011[/editline]
Looks like ive got to tackle lua first before LOVE.
[editline]20th November 2011[/editline]
Sorry if I'm asking alot but where Is a good tutorial for implementing LUA with LOVE? Or do I just learn LUA in general?
It's actually quite surprising how often Lua crops up in big titles. Portal 2, WoW, Battlefield 3, Crysis, Civilization 5 to name a few. Plenty of older titles too, such as Baldur's Gate. It's definitely a useful language to have under your belt.
I've made progress into the hellish depths of Open Source software...
I've installed cygwin and gcc, installed Code::Blocks, set Code::Blocks to gcc c99, failed to compile, fiddled with the concept of gcc.exe being a [I]goddamn symbolic link[/I] to gcc-3.exe, retried to compile but couldn't since config.h was missing, found out it's generated when you use the project's included GNU autotools which I can hopefully use cygwin to execute...
Yeah.
If there's any overhaul that OSS needs, it's [B]DOCUMENTATION[/B].
[QUOTE=DerpHurr;33349646]Wow, that looks so amazing. Well, i'm going to get started then :D. Thank you so much esalaka.
[editline]20th November 2011[/editline]
Looks like ive got to tackle lua first before LOVE.
[editline]20th November 2011[/editline]
Sorry if I'm asking alot but where Is a good tutorial for implementing LUA with LOVE? Or do I just learn LUA in general?[/QUOTE]
[url]http://www.lua.org/pil/[/url]
Is a good place to start.
[QUOTE=Hypershadsy;33350538]I've made progress into the hellish depths of Open Source software...
I've installed cygwin and gcc, installed Code::Blocks, set Code::Blocks to gcc c99, failed to compile, fiddled with the concept of gcc.exe being a [I]goddamn symbolic link[/I] to gcc-3.exe, retried to compile but couldn't since config.h was missing, found out it's generated when you use the project's included GNU autotools which I can hopefully use cygwin to execute...
Yeah.
If there's any overhaul that OSS needs, it's [B]DOCUMENTATION[/B].[/QUOTE]
Normally you have some readme file on how to build it. Usually some text-file in all caps and no file extension, e.g. INSTALL.
The usual procedure with the GNU maketools is
[code]./configure --help
./configure --enable-options --with-something
make
make install[/code]
You can of course also omit the part with the flags and just compile with the default options.
Additionally I prefer making a new directory in which to do the building in (just mkdir build;cd build;../configure).
And cmake, also used here and there, has a graphical user interface, so that shouldn't be much of an issue to use.
[editline]20th November 2011[/editline]
Also, gcc-3 lol? We're at 4.6.something stable and 4.7 in development (feature frozen).
[QUOTE=Hypershadsy;33350538]I've made progress into the hellish depths of Open Source software...
I've installed cygwin and gcc, installed Code::Blocks, set Code::Blocks to gcc c99, failed to compile, fiddled with the concept of gcc.exe being a [I]goddamn symbolic link[/I] to gcc-3.exe, retried to compile but couldn't since config.h was missing, found out it's generated when you use the project's included GNU autotools which I can hopefully use cygwin to execute...
Yeah.
If there's any overhaul that OSS needs, it's [B]DOCUMENTATION[/B].[/QUOTE]
Do you need a documentation to double-click a '.msi' file in Windows? No, because it's simple, consistent and common.
In Linux, you build software with './configure && make -j5 && sudo make-install'. It then installs to /usr/local/, unless you've overridden the install path for configure and make using the 'PREFIX' environment variable and '--prefix' argument.
The issue isn't lack of documentation, the issue is that you don't know how to function in a unix-like environment.
Hey guys, so Ive been using notepad++ and [url]www.lua.org/pil[/url] to learn lua so far. How can I run my applications? I tried saving it as main.lua and running it in love but it's not working too well.
Put your lua file in a folder and then drag it to LÖVE.
Sorry, you need to Log In to post a reply to this thread.