|
342
|
Developer / Technical / Re: The grumpy old programmer room
|
on: February 11, 2013, 02:22:37 PM
|
Late last night I spent 2 and a half hours debugging why my code wasn't producing the expected result. It turns out, I have a variable named "nq" and also "nc" and I was using the wrong one.  Crappy variable naming practices plagued my early years of game development. var a, b, c, aa, bb, cc, abc, x, xx; Good that you didn't go for: var _, __, ___, ____, _____, ______, _______, ________, _________; 
|
|
|
|
|
345
|
Developer / Technical / Re: How to make a level editor in LWJGL!
|
on: February 10, 2013, 12:49:45 PM
|
Uhm. What do you expect as the answer? Like, complete code? It's impossible to tell *in general* "how do code a level editor in LWJGL". I'd say you better read some Java + LWJGL game development tutorials, so you've got an idea about actually making stuff. Also, as you seem a beginner. I wouldn't recommend LWJGL for you. From what I know, it is fairly low level. (Isn't it just a wrapper for OpenGL + some additional functionality, like input?) You'll be best starting with some easy to learn library. You might want to try Slick2D. http://www.slick2d.org/wiki/index.php/Main_PageAnd some game-making tutorials for it: http://www.slick2d.org/wiki/index.php/Tutorials
|
|
|
|
|
348
|
Developer / Technical / Re: Can't run PHP script on website
|
on: January 28, 2013, 02:49:52 AM
|
The code was fine, it was crashing on: <?xml version="1.0" encoding="UTF-8" ?>  Althrough, I think that problem (before that) was something about file encoding (Since I work on windows and server runs linux), but it wasn't that in this case. Answering questions: Did you try to run the script locally first, using something like WAMP? I use XAMPP. It did work there  I'm gonna wild guess now but I bet my ass you glued together multiple strings/variables and forgot . somewhere.  Nope. It's hard to make error in something such as: echo "Blah";On 1st line and not spot it  Basically, I should've look into that error closer before posting here, but it was late and I was sleepy. Accidents happen. To me mostly.  Cheers.
|
|
|
|
|
349
|
Developer / Technical / Can't run PHP script on website
|
on: January 27, 2013, 03:23:34 PM
|
|
Hey there.
My [new] problem is, that I cannot run PHP script on my website (that script is under index.php). What I get is unexpected T_STRING on first line of PHP code..
It MIGHT be a problem with shorthand form or something, but I am not sure. What I know is that I fixed it before, and now forgot how did I do that.
Cheers, Kamac
PS. My .htaccess:
SetEnv REGISTER_GLOBALS 1 SetEnv ZEND_OPTIMIZER 0 SetEnv MAGIC_QUOTES 1 SetEnv PHP_VER 5_3
|
|
|
|
|
350
|
Developer / Technical / Re: The grumpy old programmer room
|
on: January 27, 2013, 02:39:26 AM
|
you'd better use boost if you want to use boost::function, you can just get the boost headers without compilation and boost::function -and may other libs- will work out of the box I already use it  And thanks zacaj, that's rad  I won't hesitate to PM you when needed either.
|
|
|
|
|
351
|
Developer / Technical / Re: The grumpy old programmer room
|
on: January 26, 2013, 04:11:24 PM
|
Memory leaks. Memory leaks everywhere.
C/C++? Definitely. I bet you are about to give me some cool memory-leaks detector program/technique right now. Am I right? Not really, I use VLD on Visual Studio but no memory leak detector is perfect unfortunately. I would recommand using "modern c++" to avoid memory leaks in the first place (if you use C++, not C). It has to work for android NDK too and for now I couldn't get, for example C++11x's std::function to work. (Since android NDK doesn't seem to support modern C++. Or it's my compiler. I wonder if there are any other)
|
|
|
|
|
355
|
Feedback / DevLogs / Re: Screenshot Saturday
|
on: January 26, 2013, 01:44:13 PM
|
 Road tile testing, and first take at a unit selector. (normally would be animated) Deserves to be quoted! Godlike pixelart 
|
|
|
|
|
357
|
Developer / Technical / Re: Calculating scrollbar's length
|
on: January 26, 2013, 09:27:38 AM
|
You got it wrong. If you have 400px of content and only 100px is displayed, then the scrollbar should have length of 25% of max length. Therefore length = maxval/val * 100 (if you need it in percent, otherwise don't multiply it by 100). Actually, no. If I do maxval/val * 100 it will not work. Consider that I have only one item added (say 32x32 image), while the view is 800px height. 800/32*100 = 2500% Right. While my example returns the following (*100 is optional): (800-32)/800 * 100% = 96% 96% of full grabby's size. Not 2500%. So, roc was right that I was right  Maybe I'm misreading this, but you want the size of the grabby part of the scrollbar to increase as the ratio of view size/content size decreases? Won't that raise all kinds of hell when you have a real length of 2, a max length of 400 and only 1-4% of the scrollbar gutter to divide those remaining 398 content unit thingies up amongst? I didn't want to mess it up adding that I'd make an condition statement to check if size isn't too small. (if percent < smallest_acceptable then percent = smallest_acceptable) view_size / max_size isn't proper either. I don't know whether we don't understand eachother, or whatever, but I think my solution works for me just fine. Final expression's thought: The bigger difference between max view and actual view, the bigger thumb's size. (That grabby thing) Anyways, got it working with my expression sample. Cheers.
|
|
|
|
|
359
|
Developer / Technical / Calculating scrollbar's length
|
on: January 26, 2013, 04:15:20 AM
|
Help me because I am lost.  I've tried to think of some expression that would calculate scrollbar's length, when knowing maximal pixel content value and real pixel content value. Here's the list of what do I need that expression to be/return: - Scrollbar length must be in %, where 100% is maximal length - The longer real pixel content, the smaller is scrollbar's length || For example || Let's assume our maximal content's pixel length is 400 and our real pixel content's length is 100, therefore I need scrollbar to be about 75% of it's length Now, another example: max. length: 400, real length: 400, then I need scrollbar to be at 0% - 1% size. And the last example: max. length: 400, real length: 2, then I need scrollbar to be at 95% - 99% size. I am lost in equations 
|
|
|
|
|
360
|
Developer / Technical / Re: Tile collision (BlitzPlus)
|
on: January 26, 2013, 12:48:29 AM
|
Don't make another thread just because nobody answered your last one  You could've bumped it (re-post in your old thread). Also, you should provide only relevant pieces of code, unless not possible otherwise.
|
|
|
|
|