Chatted with Dragonflare and helped him figure it out.
All is well.
[QUOTE=Pangogie;41646576]Chatted with Dragonflare and helped him figure it out.
All is well.[/QUOTE]
Stop creeping on my FP posts sir.
[QUOTE=Dragonflare;41646311]I need a better, quicker way to clear the console.
I'm using system("cls") right now but its too slow and I really don't want to get in the habit of using system()
I'm making a little realtime text based side scroller/shooter thing.
Also, is there a way to get input that doesn't lock everything? I used _getch() and _getch_nolock() but they both wait for input before anything else happens.[/QUOTE]
If you want to use the console for anything more than basic text I/O then I recommend taking a look at the curses library.
I'm a bit confused at the moment. I'm using a few libraries for my project (SFML, GLEW, JsonCpp). Both SFML and GLEW have the option of both static and dynamic linking. At the moment I'm linking dynamically, but which one am I really supposed to use? What is the benefit of providing a coice?
Both have pros and cons.
Static libraries can be optimized by the linker. Shared libraries can't. Shared libraries are faster to link.
Static libraries can have a smaller footprint, if other programs don't use the same library (or if you're on Windows, where shared libraries aren't shared all that much). Shared libraries can have a smaller footprint in memory and on disk if multiple programs are using the same shared library.
Shared libraries can be used for inter-process communication; static libraries can't.
Static libraries may require more configuring of your build environment. Pre-compiled static libraries are more prone to causing linker errors.
Programs compiled with static libraries contain less files. And usually less code, if the linker can omit unused code. It can't omit unused code from shared libraries. Programs compiled with shared libraries are possibly easier to maintain, since you can just patch the offending library. Static libraries require you to recompile things that depend on those libraries if they're changed.
If any library you use is (unmodified) LGPL, then you'd have to adapt your license to something LGPL-compatible if you statically link.
Now, from a technical point of view:
Dynamic linking has the advantage of several applications being able to use the same library in memory.
You can also update the library without having to re-link your program, provided the library maintainers know how to do ABI compatibility.
Static linking has less run-time overhead, meaning your application could start faster. I have not personally benchmarked this. If you statically link libraries that are not widely used, you can also get smaller memory-footprint, because static linking can selectively include relevant parts.
With static linking, you don't have to ensure your users have the library installed.
[QUOTE=ZeekyHBomb;41645609][code]while (i <= 15);[/code]
That line means while i <= 15, do nothing.
You want to open a new scope:
[code]while (i <= 15) {
System.out.println(i);
i++;
}[/code][/QUOTE]
Alright thanks Ill try it out!
I'm doing a programming challenge for an application to a class, I'm meant to create a django app to edit / update / create and delete users from a database. Pretty simple, but what the heck is the difference between editing and updating? I'm thinking update would simply replace the field while edit would display what's currently there in a form and then update it to whatever you put there. Does that make sense?
[QUOTE=Shadaez;41650276]I'm doing a programming challenge for an application to a class, I'm meant to create a django app to edit / update / create and delete users from a database. Pretty simple, but what the heck is the difference between editing and updating? I'm thinking update would simply replace the field while edit would display what's currently there in a form and then update it to whatever you put there. Does that make sense?[/QUOTE]
Yes, editing is displaying it's current value and then offering the option to change once the value has been updated and updating is replacing the contents of that field.
Anyone know if premake allows you to add files to the generated project that will be copied to output?
ie. image files or font files...
Cant seem to find anything relating to this on the docs but it seems a pretty simple thing that I would have thought it should support
I found this bit of code on StackOverflow to highlight a keyword in a UITextView
[CODE]-(IBAction) highlight:(id) sender{
NSMutableAttributedString * string = [[NSMutableAttributedString alloc]initWithString:self.text.text];
NSArray *words=[self.text.text componentsSeparatedByString:@" "];
for (NSString *word in words) {
if ([word hasPrefix:@"@"]) {
NSRange range=[self.text.text rangeOfString:word];
[string addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:range];
}
}
[self.text setAttributedText:string];
}[/CODE]
For some reason its not getting the range quite right. I can write out a sentence like so:
@Hello this works
and I then can press the button and it will highlight the @Hello bit BUT if I didnt type anything after @Hello it will keep highlighting everything red no matter what. I can only assume its not reading the range of the keywords correctly? Whats going on?
I stumbled into a roadblock while I was programming a check printer; essentially it takes data from an array of records and prints a check with the pay rate, gross, etc. However, I dont know how to create a function that can convert monetary digits to words e.g. 546.80 => The sum five hundred forty-six 80/100 dollars
Sorry if this is a trivial question. Could someone point me into the right direction with this? I imagine it uses fgets in a way but I'm unsure how to specify which lines to retrieve with that command. I am programming using C/C++ more emphasis in original C
How do I draw a texture to the screen with deprecated OpenGL (just for a test thing)?
Right now I enable Texture2D, make the texture active and bind it (Texture2D), then draw with GL.TexCoord2 and GL.Vertex2.
The rectangles on the screen are right, but I get the colour from GL.Color3 instead.
[QUOTE=Nasake;41651952]I stumbled into a roadblock while I was programming a check printer; essentially it takes data from an array of records and prints a check with the pay rate, gross, etc. However, I dont know how to create a function that can convert monetary digits to words e.g. 546.80 => The sum five hundred forty-six 80/100 dollars
Sorry if this is a trivial question. Could someone point me into the right direction with this? I imagine it uses fgets in a way but I'm unsure how to specify which lines to retrieve with that command. I am programming using C/C++ more emphasis in original C[/QUOTE]
One way to do this is to examine each number from left to right, extracting the value in each place and then using a format string to print it. You would end up having some edge cases concerning plural numbers, but I'm not aware of any better way.
You can get the magnitude of a number with log(float), so:
[code]
(int)log(1) = 0
(int)log(10) = 1
(int)log(100) = 2
...
[/code]
and then pull out a digit with integer division.
For example, if you have the number, 123.45, you determine it has 3 digits left of the decimal because (int)log(123.45) == 2; then you can see how many hundreds their are using powers of 10 (we already assume we are in a decimal system because log() is base 10). So to see how many hundreds there are, integer divide by (int)pow(10, 2) and get 1, then subtract all of the hundreds (in this case just 1) off of the number and you are left with 23.45 from which you can repeat the process.
Logarithms and exponentiation are very related, so this may be more effort than is required, but I see no other way. Someone more knowledgeable please correct me before this actually gets used :v:
[QUOTE=Richy19;41651742]Anyone know if premake allows you to add files to the generated project that will be copied to output?
ie. image files or font files...
Cant seem to find anything relating to this on the docs but it seems a pretty simple thing that I would have thought it should support[/QUOTE]
[url=http://industriousone.com/buildaction]buildaction[/url] seems to be exactly what you're looking for.
[QUOTE=Chizbang;41651939]I found this bit of code on StackOverflow to highlight a keyword in a UITextView
[CODE]-(IBAction) highlight:(id) sender{
NSMutableAttributedString * string = [[NSMutableAttributedString alloc]initWithString:self.text.text];
NSArray *words=[self.text.text componentsSeparatedByString:@" "];
for (NSString *word in words) {
if ([word hasPrefix:@"@"]) {
NSRange range=[self.text.text rangeOfString:word];
[string addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:range];
}
}
[self.text setAttributedText:string];
}[/CODE]
For some reason its not getting the range quite right. I can write out a sentence like so:
@Hello this works
and I then can press the button and it will highlight the @Hello bit BUT if I didnt type anything after @Hello it will keep highlighting everything red no matter what. I can only assume its not reading the range of the keywords correctly? Whats going on?[/QUOTE]
Maybe the range is automatically updated when you add text? I'm not sure how you could circumvent it, short of listening for modification-events from the TextView and checking the end for this artifact.
But to test it you could try and take one off the length of the range.
[QUOTE=Nasake;41651952]I stumbled into a roadblock while I was programming a check printer; essentially it takes data from an array of records and prints a check with the pay rate, gross, etc. However, I dont know how to create a function that can convert monetary digits to words e.g. 546.80 => The sum five hundred forty-six 80/100 dollars
Sorry if this is a trivial question. Could someone point me into the right direction with this? I imagine it uses fgets in a way but I'm unsure how to specify which lines to retrieve with that command. I am programming using C/C++ more emphasis in original C[/QUOTE]
Hehe, from the eyes of a C programmer you're writing bastardized C and from the eyes of a C++ programmer you're writing bastardized C++ :v:
What's wrong with plain C?
Anyway, as far as I am away, there is no standard C (or C++) algorithm to do what you want.
You need to write your own algorithm.
The way I'd go about converting integers is going from the smallest to the biggest digit.
You'd need an array of strings that go from "zero" to "nineteen" for numbers < 20, "zero" to "ninety" with a step-size of 10 for numbers >= 20 and then post-fixes like "hundred", "thousand" and so on, however big you need.
It should be extremely trivial to convert numbers < 20, very trivial for numbers to 99 (you just stick two strings together) and quite trivial for the rest (you stick multiple strings together).
It's probably a bit easier if you go from the biggest digit to the smallest, but I think you need to write some more code. If you go to thousands, you'd check if the number is bigger than 1000 and do the very trivial case for (number / 1000) and then the same with 100.
And you can probably save some memory and stick together some of the *-teen and *-ty numbers.
Do whatever you see is fitting the best.
For decimal numbers, you would have to take care of negative numbers and then I'd parse the number right of the decimal point as integer and then just append each digit left of the decimal point.
[editline]30th July 2013[/editline]
[QUOTE=Tamschi;41652385]How do I draw a texture to the screen with deprecated OpenGL (just for a test thing)?
Right now I enable Texture2D, make the texture active and bind it (Texture2D), then draw with GL.TexCoord2 and GL.Vertex2.
The rectangles on the screen are right, but I get the colour from GL.Color3 instead.[/QUOTE]
[url=https://en.wikibooks.org/wiki/OpenGL_Programming/Intermediate/Textures#Example]Here[/url]'s some C-code from Wikibooks.
[QUOTE=ZeekyHBomb;41652520][url=http://industriousone.com/buildaction]buildaction[/url] seems to be exactly what you're looking for.
[/QUOTE]
My bad, didnt specify for C++
[QUOTE]Build actions are currently only supported for .NET projects, and not for C or C++[/QUOTE]
Didn't notice. Weird limitation... I'm guessing due to the embedding, but they could just make that option .NET specific?
Well there's [url=http://industriousone.com/postbuildcommands]postbuildcommands[/url], and the example provided is copying something.
I'm looking for some good and very in-depth Direct3D guides.
Read trough [url]http://www.directxtutorial.com/[/url] intro and realized that rest of the guide is premium only. :downs:
Hi wdynhw, I want to get into real programming from scratch (mainly games) without using shitty enignes and using any library (because let's be clear, engines only work for big studios or serious projects :V).
So I want to learn, i'm shitty in anything that involves graphics, anyone has a good updated book or who the fuck know that explains every single line of code I could take a look at?
One thing you can do is dig around in open-source engines, like Ogre3D and idTech 4.
Sure, not every line is documented, but either it's referring to some other piece of code you can look up, or it's a call to some library, for which you can look at the documentation (or if it's open-source also its source code).
For graphics programming, there's some literature [url=https://developer.nvidia.com/suggested-reading]advertised at nVidia's site[/url].
There's also a book series called "Game Programming Gems", and one of the advertised ones is "GPU Gems", perhaps they're somehow related. Could be an indication that the *Gems series is good, could also just be an attempt to boost popularity. Guess you'll have to look at some reviews.
Using an engine is perfectly fine (and really the best option) if your goal is to make games. If you want to learn about graphics, then yes, that's a perfectly fine thing to do.
I'd recommend looking up some OpenGL tutorials (I'm pretty sure I linked to 4 really good ones a page or two back) and poking around open source engines to see how they're structured.
You're probably going to have to teach yourself linear algebra (or at least it's application) unless you like stumbling around blindly in the dark.
[editline]30th July 2013[/editline]
[QUOTE=robmaister12;41630127]I'm assuming by looping, you mean that you're using immediate mode OpenGL (glBegin, glEnd, etc).
The first step is to stop using immediate mode.
The second step is to [url=http://open.gl/]start[/url] [url=http://duriansoftware.com/joe/An-intro-to-modern-OpenGL.-Chapter-1:-The-Graphics-Pipeline.html]learning[/url] [url=http://www.arcsynthesis.org/gltut/]modern[/url] [url=http://www.opengl-tutorial.org/]OpenGL[/url]
After that you should be able to handle ~1024x1024 heightmaps without a problem. Beyond that, you can look into level of detail algorithms and do frustum culling.
I've implemented this in my game that's based on procedurally-generated terrain: [url]http://dice.se/publications/terrain-rendering-in-frostbite-using-procedural-shader-splatting/[/url]
[editline]28th July 2013[/editline]
(slides 38-40, not the whole thing)[/QUOTE]
Yup, over here.
Has anyone here used Bullet? I am making a game where the player should only be able to jump when touching the ground. I thought I should do this by keeping track of whether the player is on the ground or not, and changing it when the player starts and stops touching the ground. What's the simplest way to do this in bullet? I think I can maybe manage "starting" part, but I'm clueless as to how to detect when the player leaves the ground again.
The [url=https://code.google.com/p/bullet/source/browse/trunk/Demos/CharacterDemo/DynamicCharacterController.cpp]CharacterDemo[/url] does this by doing a trace downwards.
[QUOTE=ZeekyHBomb;41659244]The [url=https://code.google.com/p/bullet/source/browse/trunk/Demos/CharacterDemo/DynamicCharacterController.cpp]CharacterDemo[/url] does this by doing a trace downwards.[/QUOTE]
Thanks! You're really helpful in this thread Zeeky.
[QUOTE=eirexe;41653241]Hi wdynhw, I want to get into real programming from scratch (mainly games) without using shitty enignes and using any library (because let's be clear, engines only work for big studios or serious projects :V).
So I want to learn, i'm shitty in anything that involves graphics, anyone has a good updated book or who the fuck know that explains every single line of code I could take a look at?[/QUOTE]
If you haven't done any programming before then you have a [b]long[/b] road ahead of you, it would be better to just look at learning some basics and creating other bits and pieces before trying to do anything game related, because if you only use things that literally walk you by the hand (i.e. give you the code) you won't learn much, and if you try anything harder from the start you will likely get frustrated and quit in 10 minutes.
My suggestion if you havent done any programming before would be to look at the bagillion Python tutorials to get a grasp of basic programming concepts, and/or C# + .Net. I learned a lot about C# and OOP in general just from playing around with windows forms applications in C# and paying attention to how different things worked.
If you are really adamant you want to try making a game before doing any programming, then I would again suggest looking at tutorials for one of the many Python game libraries (OGRE, Pygame etc), or there are loads of tutorials on C# + XNA which give a good understanding on the basics of games programming.
Remember: programming is only a viable option as a hobby if you actually enjoy it and can stick at it, no offense but your post made it sound like you have played some games and decided 'How hard can it really be to make a game? I'll give it a shot!' The answer is [I]very[/I] hard, and to make anything people would want to play takes a huge amount of time and effort.
[QUOTE=Cushie;41659582]LOVE[/QUOTE]
That's not a Python library.
[QUOTE=thf;41659681]That's not a Python library.[/QUOTE]
Whoops, I was thinking of OGRE but had loads of different library names bouncing around my head at the time.
Hi, I need a bit of help on a concept:
I am currently experimenting on vertices and maths. I currently need help working out how to have a camera and how I would draw what the camera would see.
Right now, I am able to rotate a camera around an origin with user input from a 2d plane with a click and drag system, However, I need a camera that can move around, And look around. I don't know if I should move the world around the camera (which i can do, But will remove a lot of functionality like sky dispersion shader), Or move the camera though the world, At which point I wouldn't be able to calculate which planes need drawing unless I did an extensive vertex connection system.
What I am asking is how have other people done this in the most efficient way possible.
I have only done very basic graphics programming, so maybe there's something I don't understand right, but why whouldn't such a shader work when you move the world around the player?
The only thing that could change is information about rotation, but you have that either way, no?
[QUOTE=ZeekyHBomb;41666091]I have only done very basic graphics programming, so maybe there's something I don't understand right, but why whouldn't such a shader work when you move the world around the player?
The only thing that could change is information about rotation, but you have that either way, no?[/QUOTE]
I am doing a dynamic fluid body (waves) with pre-cached reflection model. If i move the world around the camera, The offsets would change, And so the reflections would be off.
I will experiment with both for now, but with a moving camera, I really can't see an easy way of doing it.
My problem is that when rendering with a dynamic camera, most vertices will be out of the frame, but some will be attached to those in the frame, So to render correctly, I will need to render the triangles that are inside the frame, But with a vertex outside the frame.
Sorry, you need to Log In to post a reply to this thread.