• What do you need help with? Version 5
    5,752 replies, posted
Ok so i am trying to compile the examples from the GTK+ Getting started page on windows [URL="http://developer.gnome.org/gtk-tutorial/stable/c39.html"]http://developer.gnome.org/gtk-tutorial/stable/c39.html[/URL] and i seem to be running into a problem. i have a full instalation of Mingw, and GTK+, both of their dependency's are added to my PATH, and both sets of commands work on their own. So here is my problem, [CODE]C:\Users\Brad\Programing\Practice>gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0 gcc: error: `pkg-config: No such file or directory gcc: error: unrecognized command line option '--cflags' gcc: error: unrecognized command line option '--libs' gcc: error: gtk+-2.0: No such file or directory[/CODE] Any reason why this isn't working? could it be that i have to set it up slightly differently because im using MinGW? any help?
C++ btw. [editline]25th July 2012[/editline] Broke my automerge :(
[QUOTE=Armandur;36931154]Any ideas how I would store a Hexagon tile map? (Settlers of Catan style)[/QUOTE] A square grid, with every other row or column offset by half the tile size. [img]http://img220.imageshack.us/img220/2445/57758565.png[/img]
The drawing, on the other hand, will have to use overlapping tiles with transparency to work properly and might be a bit more difficult to figure out.
[QUOTE=MickeyCantor;36931410]Ok so i am trying to compile the examples from the GTK+ Getting started page on windows [URL="http://developer.gnome.org/gtk-tutorial/stable/c39.html"]http://developer.gnome.org/gtk-tutorial/stable/c39.html[/URL] and i seem to be running into a problem. i have a full instalation of Mingw, and GTK+, both of their dependency's are added to my PATH, and both sets of commands work on their own. So here is my problem, [CODE]C:\Users\Brad\Programing\Practice>gcc base.c -o base `pkg-config --cflags --libs gtk+-2.0 gcc: error: `pkg-config: No such file or directory gcc: error: unrecognized command line option '--cflags' gcc: error: unrecognized command line option '--libs' gcc: error: gtk+-2.0: No such file or directory[/CODE] Any reason why this isn't working? could it be that i have to set it up slightly differently because im using MinGW? any help?[/QUOTE] Looks like you didn't get pkgconfig. [url]http://pkgconfig.freedesktop.org/releases/pkg-config-0.27.tar.gz[/url]
[QUOTE=Armandur;36931154]Any ideas how I would store a Hexagon tile map? (Settlers of Catan style)[/QUOTE] Like you'd store any other grid, just offset every other row when you're drawing it.
[QUOTE=Maloof?;36923432]Any ideas? I realise it's probably something quite basic but being quite new to all this I'm stumped. Could it be to do with the keyboard input system firing a regular series of quick 'on'/'off' signals instead of a constant 'on' signal when held down?[/QUOTE] You're listening for the KeyUp and KeyDown events. The only reason your acceleration is working is because of key repeat, and for a similarly-designed deceleration to work you'd need the OS to repeat the key up event too. I have to assume you're new to event-based systems, so I'll quickly explain how it works here. When you press down a key, the KeyDown event gets fired, this calls your KeyDownHandler, which, if you've pressed the right arrow, increases CharVelocityX to 2. If you keep holding this down, your OS will refire the event after the repeat delay, and CharVelocityX will increase by 2 again until it hits 10. Now, when you release the key, KeyUpHandler gets fired once, and CharDeceleration runs once, setting CharVelocityX to 9. In the absence of any more right arrow releases (it's already up) this method never runs again. If you press and release the right arrow again, it first gets increased by 2 to 11, where it stays until you release it, at which point it gets set to 10. Repeating this sets it to 12, then 11, and so on. Now, onto the fix. Your current designs seems to be based off of an input check, as opposed to something event-driven. One way to implement this (not sure if it's the best, don't have time to check ATM and I haven't done flash development in a while (BTW if you aren't using it and you're interested FlashDevelop has the best autocomplete I've ever used)) is by, in the current KeyUp/Down handlers, setting an isDown boolean. Basically do this [code] //These should probably be private public var isRightKeyDown:Boolean = false; public var isLeftKeyDown:Boolean = false; public function KeyDownHandler(e:KeyboardEvent) { if (e.keyCode == Keyboard.RIGHT) isRightKeyDown = true; if (e.keyCode == Keyboard.LEFT) isLeftKeyDown = true; } public function KeyUpHandler(e:KeyboardEvent) { if (e.keyCode == Keyboard.RIGHT) isRightKeyDown = false; if (e.keyCode == Keyboard.LEFT) isLeftKeyDown = false; } public function CharMovement() { var movementDelta:int = 0; if (isRightKeyDown) movementDelta += 2; if (isLeftKeyDown) movementDelta -= 2; //Decelerate if (!isRightKeyDown && !isLeftKeyDown) { //moving right if (CharVelocity > 0) { CharVelocityX -= 1; if (CharVelocityX < 0) CharVelocityX = 0; } //moving left if (CharVelocity < 0) { CharVelocityX += 1; if (CharVelocityX > 0) CharVelocityX = 0; } } //Apply movement (movementDelta used so if both keys are held there is no movement) CharVelocityX += movementDelta; //clamp velocity to +/- 10 if (CharVelocityX > 10) CharVelocityX = 10; else if (CharVelocityX < -10) CharVelocityX = -10; } public function enterFrameHandler(e:Event) { //Run this new method every frame CharMovement(); Char1.x += CharVelocityX; Char1.y += CharVelocityY; } [/code] This code isn't the best of the best or anything but it should work well enough. (If you find mistakes it's 4AM and I meant to get to bed an hour or two ago)
Is there any decent example or documentation on injecting code into a binary? I need to automate a "echo 1 > procstuff" call on a binary I have no sources on. (I have a toolchain to compile shit to said platform)
I want to check if 2 circles are intersecting, would this be the easiest way of doing it? both circles have a rect which is 2 times the size of the circle's radius, check if both rects intersect or any contains the other. if so check if the distance between both circles is less than the radius of both radius combined if it is less then they are colliding. [IMG]http://i.imgur.com/D3Lgq.png[/IMG]
Check like this: [code] bool colliding = distSq(origin1, origin2) < pow(radius1 + radius2, 2); [/code] it eliminates a square root (which is slow). [editline]26th July 2012[/editline] Also if you want to add some sort of collision response, this: [code] float ang = atan2(circle1.y - circle2.y, circle1.x - circle2.x); [/code] will give you the angle between them.
is that instead of the rect thing, or once I have checked if the rects are colliding? Also, how would distSq be done? [editline]26th July 2012[/editline] is it: xp = c2.pos.x - c1.pos.x; yp = c2.pos.y - c1.pos.y; Distance = SquareRoot(xp*xp + yp*yp)
[QUOTE=Richy19;36949789]is that instead of the rect thing, or once I have checked if the rects are colliding? Also, how would distSq be done? [editline]26th July 2012[/editline] is it: xp = c2.pos.x - c1.pos.x; yp = c2.pos.y - c1.pos.y; Distance = SquareRoot(xp*xp + yp*yp)[/QUOTE] After the rectangle check is done (just check [URL="http://www.tekpool.com/node/2686"]if one rect intersects the other[/URL]). It probably doesn't do much to improve the speed though, you could just use distsq checks. And you won't need to square root (it'll be xp * xp + yp * yp) unless you need to know the exact amount they are overlapping.
[QUOTE=NovembrDobby;36950000]After the rectangle check is done (just check [URL="http://www.tekpool.com/node/2686"]if one rect intersects the other[/URL]). It probably doesn't do much to improve the speed though, you could just use distsq checks. And you won't need to square root (it'll be xp * xp + yp * yp) unless you need to know the exact amount they are overlapping.[/QUOTE] Ahh ok :) for the testing i dont need to worry about the exact distance but for the full mechanic i would need to know the distance, what would be the correct way of doing it?
Keep using distance squared - then when you're sure you need the actual distance in a bit of code, just square root that specific number.
I've been using c++ for a while now and wanted to try something a bit more visual. Would c# be a good place to start?
Hi you crazy programmers. I'm looking to dabble a little in programming, and I'm a tad curious; What language is most preferred, or what's best for a beginner like me? What programs should I use to write in that language, what should I use to compile it, etc. Input and help is appreciated! :> EDIT: Sorry if this isn't the place for this.
[QUOTE=gaminji;36955101]Hi you crazy programmers. I'm looking to dabble a little in programming, and I'm a tad curious; What language is most preferred, or what's best for a beginner like me? What programs should I use to write in that language, what should I use to compile it, etc. Input and help is appreciated! :> EDIT: Sorry if this isn't the place for this.[/QUOTE] I would suggest starting in c++, as most visual languages (like java) are based off of it, and conversion from it to pretty much any other language is one of the easiest out there (as far as learning the differences goes).
[QUOTE=krazipanda;36957597]C++[/QUOTE] Hell no. C++ is hard. C#/Java/Lua are much easier, especially for begginers. I would myself recommend you write some console applications with C#, there you will see do you like programming overall
[QUOTE=gaminji;36955101]Hi you crazy programmers. I'm looking to dabble a little in programming, and I'm a tad curious; What language is most preferred, or what's best for a beginner like me? What programs should I use to write in that language, what should I use to compile it, etc. Input and help is appreciated! :> EDIT: Sorry if this isn't the place for this.[/QUOTE] Just look around, try something out. I would say you go to wikipedias list of programming languages, and look through some of them, and see if any of them look pretty and organized to you, then start learning about with it. Jump around a few times, see which is more comfortable. [editline]27th July 2012[/editline] Myself, I did the above, and I ended up using C++ anyway :)
[QUOTE=krazipanda;36957597]I would suggest starting in c++, as most visual languages (like java) are based off of it, and conversion from it to pretty much any other language is one of the easiest out there (as far as learning the differences goes).[/QUOTE] I am not really sure what you mean when you say 'Visual language', mind elaborating? I get the impression you're talking about when IDEs have visual GUI designers. If that's the case, you can get those for a lot of languages, including C++. :v:
[QUOTE=krazipanda;36953128]I've been using c++ for a while now and wanted to try something a bit more visual. Would c# be a good place to start?[/QUOTE] What? What do you mean with visual?
I'm trying to decide how to lay my game out. I'm writing it in C, and after following Overv's open.gl tutorials I've decided glfw will do exactly what I need it to. I'm somewhat at a loss as to how to structure everything, though. I was thinking of breaking up some concepts into their own data structures and files ( menu.c has a menu_t struct with relevant information, as well as some functions to manipulate the menu, same for game.c or player.c etc. ) But I realize this might be a good place to have object orientation built into the language. Should I just drop C and write it in C++? and if so where would you recommend I start learning? [editline]27th July 2012[/editline] Is [URL="http://cppannotations.sourceforge.net/c++annotations/html/"]this[/URL] any good?
I dont suppose anyone here might have any idea as to why SFML RenderTextures dont seem to work on Intel drivers?
[QUOTE=Rayjingstorm;36962309]I'm trying to decide how to lay my game out. I'm writing it in C, and after following Overv's open.gl tutorials I've decided glfw will do exactly what I need it to. I'm somewhat at a loss as to how to structure everything, though. I was thinking of breaking up some concepts into their own data structures and files ( menu.c has a menu_t struct with relevant information, as well as some functions to manipulate the menu, same for game.c or player.c etc. ) But I realize this might be a good place to have object orientation built into the language. Should I just drop C and write it in C++? and if so where would you recommend I start learning? [editline]27th July 2012[/editline] Is [URL="http://cppannotations.sourceforge.net/c++annotations/html/"]this[/URL] any good?[/QUOTE] With your programming background, i think you'll enjoy reading this instead: [url]http://www.cplusplus.com/doc/tutorial/[/url] I used it to learn c++ and it was a piece of cake. You'd be particularly interested in the Object Oriented programming section. And just a handy tip to make your life easier: use strings instead of char arrays, and std::cout instead of printf().
[QUOTE=Naelstrom;36963016]With your programming background, i think you'll enjoy reading this instead: [url]http://www.cplusplus.com/doc/tutorial/[/url] I used it to learn c++ and it was a piece of cake. You'd be particularly interested in the Object Oriented programming section. And just a handy tip to make your life easier: use strings instead of char arrays, and std::cout instead of printf().[/QUOTE] Will get started right away, thanks.
Does anyone know what the most common object file format used today is? I want to learn more about object files, debugging symbols in executable and all that kind of stuff.
Starting a new job doing a lot of stuff with Microsoft Azure and Sharepoint next month. Can anybody recommend any books / websites?
[QUOTE=flayne;36967051]Does anyone know what the most common object file format used today is? I want to learn more about object files, debugging symbols in executable and all that kind of stuff.[/QUOTE] In the home computer market that would probably be the one Windows uses, which would be PE/COFF. On Linux (, Solaris, IRIX, FreeBSD, NetBSD, OpenBSD, MINIX), ELF. And OSX uses Mach-O
Here's a quick stupid question: Could someone with words, describe to me why this works: [code]int data = 1; stream.write((char*) &data ,sizeof(char));[/code] But not this: [code] stream.write((char*) 1,sizeof(char));[/code] And eventually how I could send a datastream a plane value instead of a variable. I'm guessing it would have to make the use of "new char*" or something but I'm not really sure how.
[QUOTE=FPSMango;36970322]Here's a quick stupid question: Could someone with words, describe to me why this works: [code]int data = 1; stream.write((char*) &data ,sizeof(char));[/code] But not this: [code] stream.write((char*) 1,sizeof(char));[/code] And eventually how I could send a datastream a plane value instead of a variable. I'm guessing it would have to make the use of "new char*" or something but I'm not really sure how.[/QUOTE] Because in your first example, the first parameter is a pointer to data, containing 1. In your second example, you're passing a pointer to 0x00000001, which is invalid and might crash you if accessed. Not to mention the fact that the method seems to take char*, which means a C string instead of a number. By passing just 1 like in your first example you're giving it an invalid string. There's probably a more suitable overload for passing plain numbers. e: Are you using std::ostream? [cpp]stream << 1;[/cpp]
Sorry, you need to Log In to post a reply to this thread.