• What Do You Need Help With? V6
    7,544 replies, posted
Linear: [img]https://upload.wikimedia.org/wikipedia/commons/8/8c/Bezier_linear_anim.gif[/img] Quadratic: [img]https://upload.wikimedia.org/wikipedia/commons/3/35/Bezier_quadratic_anim.gif[/img] Cubic: [img]https://upload.wikimedia.org/wikipedia/commons/a/a3/Bezier_cubic_anim.gif[/img] (I think Garry linked this on his blog at some point.) Quartic: [img]https://upload.wikimedia.org/wikipedia/commons/7/7d/Bezier_4_big.gif[/img] and so on Read [URL="https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Constructing_B.C3.A9zier_curves"]this part[/URL] and [URL="https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm"]this[/URL] for the exact implementation. B-Splines (e.g. the ones with the control points sticking out from the "corners", very common in drawing programs) are apparently just chains of cubic Bézier segments.
[QUOTE=Tamschi;42046228][code] var q = t as IObjectVisible; if (q != null) { Console.WriteLine(q.Image); } [/code] would be slightly better, or just a direct cast if you're sure about the type. [editline]edit[/editline] Also, it seems you're currently using the built-in serialization. Never use that for persistent storage, it doesn't have a specification and is backwards incompatible to the point where very small changes can make your data unreadable. With protobuf-net you can theoretically serialize an object and deserialize it as a different type with matching fields, it's much more tolerant against minor changes (especially with the attributes) and in some cases even forward compatible.[/QUOTE] I'm sorry I ever doubted you. If I wanted to make a game, i'd use XNA, obviously. I'm interested in how games work, so i'm writing everything from scratch, using only standard libraries (I didn't have time to write my own JSON(Beatiful data interchange language!) parser, hence the binary-serialization), but after looking at, then implementing protobuf I can see I was a fool, it's very powerful (Well, compared to straight binary), so thank you for the recommendation!
[QUOTE=Lemmingz95;42065751]I'm sorry I ever doubted you. If I wanted to make a game, i'd use XNA, obviously. I'm interested in how games work, so i'm writing everything from scratch, using only standard libraries (I didn't have time to write my own JSON(Beatiful data interchange language!) parser, hence the binary-serialization), but after looking at, then implementing protobuf I can see I was a fool, it's very powerful (Well, compared to straight binary), so thank you for the recommendation![/QUOTE] In that case there's not too much difference except for the efficiency, just the built-in storage format is volatile. However, I think that serialization is one of the things that can be more quickly learnt by reading about them, because the (and especially a good) implementation for a single format would be more tedious to write than reading up on the most common ones and the way they are parsed and written. XNA is deprecated by the way, actively developed alternatives would be MonoGame (same/very similar API) or Unity. I haven't used either of them because I've recently reinvented the wheel for using OpenGL in a managed language :v: It's coming together nicely though, most functionality I'd add would be all but extensions by now.
Language: C++ Problem: Lab work Information: I have lab work which states: [quote]Create a console program that implements the “Zorkish” game using a non-blocking game loop. The loop must execute continuously, only processing input when it occurs, and only providing output when necessary. Recommendations: The input stream in C++ makes it easy to determine whether input has occurred and act on it if it has you'll have to go beyond simply using the >>operator, though.[/quote] From my research online, this is impossible without using threads. Is my lab work full of shit and they've given me an impossible task, or is there actually support for this?
[QUOTE=Empty_Shadow;42068809]Language: C++ Problem: Lab work Information: I have lab work which states: From my research online, this is impossible without using threads. Is my lab work full of shit and they've given me an impossible task, or is there actually support for this?[/QUOTE] [code]while(true) { processInput(); doLogic(); writeOutput(); }[/code] Seems to me it's just asking for your standard game loop.
Nah they want a non-blocking loop. IE if there's no input the game still calls update and render. Trust me on that, the previous lab was to make a blocking loop.
[QUOTE=Empty_Shadow;42068954]Nah they want a non-blocking loop. IE if there's no input the game still calls update and render. Trust me on that, the previous lab was to make a blocking loop.[/QUOTE] What makes you think my code would be 'blocking'? [editline]3rd September 2013[/editline] processInput() wouldn't wait for input, it would check if any is available and, if not, return.
Well yes but I'm asking if it's possible to implement the non-blocking input using the default libraries. I'm perfectly capable of setting up a basic game loop like that, like I said the previous lab was exactly the same thing with a blocking input function.
To the best of my knowledge this is indeed impossible with plain standard C++ without using threads (which are available in C++11) and without resorting to non-standard functionality. The description you posted says "The input stream in C++ makes it easy to determine whether input has occurred" though, maybe your teacher is thinking of std::cin.rdbuf()->in_avail(), but this is certainly not a portable solution, although if you're all required to use the same platform and standard library it might work.
How do operations like dw db dd (and on dcpu "dat") work? I know they are a feature of the assembler and not actually executed by the virtual machine, but I don't exactly understand how the data is saved. At first I thought the assembler just wrote the values into RAM starting at the position where the db op was called, but I may be mistaken.
[QUOTE=Empty_Shadow;42069196]Well yes but I'm asking if it's possible to implement the non-blocking input using the default libraries. I'm perfectly capable of setting up a basic game loop like that, like I said the previous lab was exactly the same thing with a blocking input function.[/QUOTE] [url=http://en.cppreference.com/w/cpp/io/basic_istream/peek]std::cin.peek()[/url]? [editline]4th September 2013[/editline] Nevermind, just tried it. Doesn't work.
[QUOTE=toaster468;42069426]How do operations like dw db dd (and on dcpu "dat") work? I know they are a feature of the assembler and not actually executed by the virtual machine, but I don't exactly understand how the data is saved. At first I thought the assembler just wrote the values into RAM starting at the position where the db op was called, but I may be mistaken.[/QUOTE] The data gets placed in the data segment. Like the code segment, often called text segment, it is just a part of the binary.
[QUOTE=Z_guy;42069591][url=http://en.cppreference.com/w/cpp/io/basic_istream/peek]std::cin.peek()[/url]? [editline]4th September 2013[/editline] Nevermind, just tried it. Doesn't work.[/QUOTE] Yeah peek looks at the buffer but doesn't remove anything it reads.
[img]http://i.imgur.com/jNylJnF.png[/img] There's something wrong with the count, int c. I've been staring at this for hours. I know, I suck.
Put the if-else-if block inside the first for loop.
[QUOTE=Empty_Shadow;42069196]Well yes but I'm asking if it's possible to implement the non-blocking input using the default libraries. I'm perfectly capable of setting up a basic game loop like that, like I said the previous lab was exactly the same thing with a blocking input function.[/QUOTE] Ah, I misunderstood what you meant. As far as I know, the method Zeeky posted [std::cin.rdbuf()->in_avail()] is your only option if you can't use libraries. As far as portability goes, assignments like these tend not to matter so much, so go ahead and use it. Just remember that if you ever want to do this in the real world (for some reason), then look for a better solution.
[QUOTE=ZeekyHBomb;42069631]The data gets placed in the data segment. Like the code segment, often called text segment, it is just a part of the binary.[/QUOTE] I don't think I completely understand. I tried taking a look at a dcpu emulator, [code] :data dat "Hello world", 0 [/code] [img]http://puu.sh/4ixZc.png[/img] And it seems to just write the values into memory at that line. When I think about it this makes more sense to me because say you do: [code] mov register1, data add register1, 1 mov register2, [register1] ; "e" [/code] So is this how it happens, or is this just dcpu being dumb?
Learning Java, can anyone tell me why this won't work? [code]public class ArgsExample3 { public static void main(String[] args) { String from; for (int i = 0; i < args.length; i++) { if (args[i].startsWith("From:")) { from = args[i].substring(5); System.out.println("MAIL FROM: " + from + ""); else from = args[i]; System.out.println("MAIL FROM: " + from + ""); } } } }[/code] ArgsExample3.java:21: error 'else' without 'if'
[QUOTE=SammySung;42071869]Learning Java, can anyone tell me why this won't work? [code]public class ArgsExample3 { public static void main(String[] args) { String from; for (int i = 0; i < args.length; i++) { if (args[i].startsWith("From:")) { from = args[i].substring(5); System.out.println("MAIL FROM: " + from + ""); [b]}[/b] else[b]{[/b] from = args[i]; System.out.println("MAIL FROM: " + from + ""); } } } }[/code] ArgsExample3.java:21: error 'else' without 'if'[/QUOTE] Formatting buddy, that will clear the issue right up. If that doesn't make sense, you don't have a closing paranthese and you don't have an opening paranthese
[QUOTE=WTF Nuke;42071917]Formatting buddy, that will clear the issue right up. If that doesn't make sense, you don't have a closing paranthese and you don't have an opening paranthese[/QUOTE] Cheers bud! Making more sense now :)
[QUOTE=toaster468;42071648]I don't think I completely understand. I tried taking a look at a dcpu emulator, [code] :data dat "Hello world", 0 [/code] [img]http://puu.sh/4ixZc.png[/img] And it seems to just write the values into memory at that line. When I think about it this makes more sense to me because say you do: [code] mov register1, data add register1, 1 mov register2, [register1] ; "e" [/code] So is this how it happens, or is this just dcpu being dumb?[/QUOTE] Well yeah, the loader loads the whole binary into memory, so at that point the data will be in RAM.
Currently i need to learn C for my internship. My assignment is to 'create' a webbrowser that support hardware accelerated loading to load presentation frameworks like impress.js. Any usefull tutorials for a guy with .Net/ Java background?
I don't know javascript at all. But with SFML.Net it should be trivial. If JS supports hooks then maybe you can just forward all rendering functions to the equivalent C# functions?
[QUOTE=ToXiCsoldier;42075255]Currently i need to learn C for my internship. My assignment is to 'create' a webbrowser that support hardware accelerated loading to load presentation frameworks like impress.js. Any usefull tutorials for a guy with .Net/ Java background?[/QUOTE] Could this help? [url]http://awesomium.com/[/url]
Awesomium is not for C. But [url=https://code.google.com/p/chromiumembedded/]Chromium Embedded Framework[/url] has a C API. It'd probably be easier to use [url=http://webkitgtk.org/]WebKitGtk+[/url] though :-)
[QUOTE=toaster468;42075722]Could this help? [url]http://awesomium.com/[/url][/QUOTE] Thanks, i might do this and will switch over from c to c++ (or pehaps learn both). [QUOTE=ZeekyHBomb;42076220]Awesomium is not for C. But [url=https://code.google.com/p/chromiumembedded/]Chromium Embedded Framework[/url] has a C API. It'd probably be easier to use [url=http://webkitgtk.org/]WebKitGtk+[/url] though :-)[/QUOTE] Thanks aswell, will take a look. Another question: Is it possible to create gtk+ applications in VS2012 on my machine and then move the files over to linux and let gcc compile them to be executable on linux? Currently the target device is a Raspberry Pi but friday we get another small machine with more processing power (quad core 600Mhz).
[QUOTE=ToXiCsoldier;42078585]Another question: Is it possible to create gtk+ applications in VS2012 on my machine and then move the files over to linux and let gcc compile them to be executable on linux? Currently the target device is a Raspberry Pi but friday we get another small machine with more processing power (quad core 600Mhz).[/QUOTE] Sure. If VS can compile it, GCC should have no problems either (with appropriate flags and #defines, e.g. VS __declspecs have their GCC equivalents). The reverse however is not true.
And if you refrain from platform-specific extensions. I know GCC can warn about these, I'm unsure about VS. You can also use [url=http://stackoverflow.com/questions/216025/gcc-with-visual-studio#216134]Makefiles[/url], but they're probably not as tightly integrated into VS. Perhaps you should just occasionally attempt to compile them with GCC and on Linux.
Started my Comp Sci course today and nobody understands the first assignment. [IMG]http://screenshot.medsouz.net/2013-09-4_14-21-02.png[/IMG] Everyone is stuck on the first question which is basic high school geometry.
[QUOTE=Soleeedus;42079038]Started my Comp Sci course today and nobody understands the first assignment. [IMG]http://screenshot.medsouz.net/2013-09-4_14-21-02.png[/IMG] Everyone is stuck on the first question which is basic high school geometry.[/QUOTE] How is that even computer science related math?
Sorry, you need to Log In to post a reply to this thread.