• What do you need help with? Version 1
    5,001 replies, posted
[code]If PictureBox1.Left + PictureBox1.Width > YourForm.Width Then PictureBox1.Left = YourForm.Width - PictureBox1.Width End If If PictureBox1.Top + PictureBox1.Height > YourForm.Height Then PictureBox1.Top = YourForm.Height - PictureBox1.Height End If[/code]
That only stops it from leaving the right side of the form. :frown: [B]Edit:[/B] Wait, I'm dumb. I added that to my existing code and it stops it from leaving the top and the right, but not the bottom. :smile:
I'm trying to figure out how to do a sort of generic linked list in C. A linked list would look like this: [cpp] struct list { struct list *next; char* data; } [/cpp] But I want to be able to do a linked list with any struct and have a generic function that I can use like void list_add(struct list *head, struct list *new_obj); I'm thinking I can maybe use void* data; And when I create the struct object I can cast another struct to a void* and shove it into my list wrapper struct so it can be passed off to one of my generic list handling functions. [editline]04:02PM[/editline] It could look something like this: [cpp] struct list *head; struct list *l; struct my_struct *ms; ms->x = 100; ms->y = 200; l->data = (void*) ms; list_add(head, l); [/cpp]
I was going to do this myself. By no means am I good programmer, but I would use void* pointers and casting.
[QUOTE=PvtCupcakes;24296912]I'm trying to figure out how to do a sort of generic linked list in C. A linked list would look like this: [cpp] struct list { struct list *next; char* data; } [/cpp] But I want to be able to do a linked list with any struct and have a generic function that I can use like void list_add(struct list *head, struct list *new_obj); I'm thinking I can maybe use void* data; And when I create the struct object I can cast another struct to a void* and shove it into my list wrapper struct so it can be passed off to one of my generic list handling functions. [editline]04:02PM[/editline] It could look something like this: [cpp] struct list *head; struct list *l; struct my_struct *ms; ms->x = 100; ms->y = 200; l->data = (void*) ms; list_add(head, l); [/cpp][/QUOTE] I did something like this when I was working on my game engine two years ago. You can use void* pointers in your list nodes and cast as necessary, using callback functions for comparisons, etc. You do, however, lose a bit of speed by running a callback for each and every comparison. But it does work, and it's about as good a solution as you're going to find for generic linked-lists in C. Notable libraries such as GLib take this approach. You can also use preprocessor macros to create something that resembles generics/templates, which is slightly faster, but is ugly, a complete pain in the ass to debug, and generally no fun to work with. It might also be getting into the realm of "premature optimization". I did this for my vector math routines. Wrote just one set of routines, and used the preprocessor to substitute types and generate code for 8/16/32/64-bit integers, floats, and doubles.
When you guys make your 2d tileset games how do you make the solid tiles(walls and such)? i dont need any specific code just the gimmick of how to do it and i should be ab;e to figure it out
I keep getting an error. It's PHP and HTML. This is postform.html : [code] <html> <head> <body> <title> Commenting Page (Test!) </title> </head> <form action="postcomment.php" method="post"> <center><table> <tr><td>Name:</td><td><input type="text" name="name"></td></tr> <tr><td>Comment:</td><td><textarea name="message"></textarea></td></tr> <tr><td></td><td><input type="submit" value="submit"></td> </table></center> </form> </body> </body> </html> [/code] This is postcomment.php [code] <html> <head> <title>Comment</title> </head> <body> <?php $name = $_POST['name']; $message = $_POST['message']; $fp = fopen($_SERVER['DOCUMENT_ROOT'] . "B-Forum/forum/comments.php", 'a'); if (!$fp) { echo "There was an error! Please try again in a minute."; exit; } else { $outputstring = "Name: " .$name. "<br /> Comment:<br />" .$message. "<br />"; fwrite($fp, $outputstring, $strlen($outputstring)); fclose($fp); echo "Your comment was successfully posted. Click <a href='history.back();'>here</a> to continue."; } ?> </body> </html> [/code] I have a blank .php file called comments.php, so that isn't the problem. The error I'm getting is this: Comment: " .$message. " "; fwrite($fp, $outputstring, strlen($outputstring)); fclose($fp); echo "Your comment was successfully posted. Click here to continue."; } ?> It shows me that exactly on the page. Any reason why it's doing this? (I've tried using $strlen is that made any difference - it didn't. I'm also a newbie when it comes to PHP, so don't be too harsh.)
$outputstring = "Name: " . $name . "<br /> Comment:<br />" . $message . "<br />"; I don't know whether or not it matters, but by force of habit, I put in those spaces.
[QUOTE=Richy19;24302495]When you guys make your 2d tileset games how do you make the solid tiles(walls and such)? i dont need any specific code just the gimmick of how to do it and i should be ab;e to figure it out[/QUOTE] On the one I've been doing, my friend who does the maps makes a black and white image of the map. Where it's white you can walk, where it's black you can't walk. So in the code, you just figure out the coordinates of the player and then figure out which color the map is at that point. I can't imagine how tedious it is to do that though. The most basic way is to have something in your map file (lets say it's XML) that would say tile (x,y) can't be walked on. Then the problem is that you have large squares you can't walk on, and it kinda screws up realism. There's probably a better way, but I don't know about it.
[QUOTE=Spartan One;24303690]I keep getting an error. It's PHP and HTML. [/QUOTE] You should check out the web development forum, this kind of stuff is what it's for.
How do I link a progress bar in visual basic to the progress bar that shows up in in the task bar, in windows 7. Or is it impossible to do that in visual basic?
Is there a way to use dwmapi.dll to change the aero glass color? I've done some research, apparently it worked in Vista but doesn't in 7. Trying this myself comes to the same conclusion.
[QUOTE=Richy19;24302495]When you guys make your 2d tileset games how do you make the solid tiles(walls and such)? i dont need any specific code just the gimmick of how to do it and i should be ab;e to figure it out[/QUOTE] Tile ID's? For example. A tile image with assigned id 1 = can walk through A tile image with assigned id 2 = can't walk through(set walk speed to 0 on the axis the wall is or something that simulates walking into a wall) Not sure how you would make it, but it would work i think :v:
[QUOTE=topgun98;24310945]How do I link a progress bar in visual basic to the progress bar that shows up in in the task bar, in windows 7. Or is it impossible to do that in visual basic?[/QUOTE] I'm pretty sure that was a couple of pages back in the WAYWO.
[QUOTE=Agent766;24314240]I'm pretty sure that was a couple of pages back in the WAYWO.[/QUOTE] [url]http://code.msdn.microsoft.com/WindowsAPICodePack[/url]
Anyone know of any good tools for creating animated characters? What I am hoping is for a program that allows me to define images/sprites for arms, legs etc and map them to a 2d skeleton. Then the program can generate the frames of the animation using either custom or built in animations for the skeleton. I was considering using Pivot, but I'm not exactly the best animator.
[QUOTE=Mattz333;24319534]Anyone know of any good tools for creating animated characters? What I am hoping is for a program that allows me to define images/sprites for arms, legs etc and map them to a 2d skeleton. Then the program can generate the frames of the animation using either custom or built in animations for the skeleton. I was considering using Pivot, but I'm not exactly the best animator.[/QUOTE] Pivot doesn't map sprites to bones, either. You're probably best of writing one yourself if you want some special features. It's not like drawing rotated sprites is excessively hard, either.
[QUOTE=FoohyAB;24311200]Is there a way to use dwmapi.dll to change the aero glass color? I've done some research, apparently it worked in Vista but doesn't in 7. Trying this myself comes to the same conclusion.[/QUOTE] You can do it in Windows (personalize menu), therefore you SHOULD be able to do in a program. The old method won't work in 7 because Microsoft changed the value to read-only. With a little bit of tinkering and a lot of searching, you may be able to find exactly what you need. If you do, it would be nice if you could post it back here.
[QUOTE=Mattz333;24319534]Anyone know of any good tools for creating animated characters? What I am hoping is for a program that allows me to define images/sprites for arms, legs etc and map them to a 2d skeleton. Then the program can generate the frames of the animation using either custom or built in animations for the skeleton. I was considering using Pivot, but I'm not exactly the best animator.[/QUOTE] You could take the Facewound approach -- Forgo animated sprites entirely, using crappy 2D skeletal animation instead.
What's a good library if I want to write directly to a sound buffer?
Using what language?
I am trying some basic implementation of astar, I know I shouldn't be using lists but I'll fix that later just want the basic concept done. for some reason this isn't working : [url]http://pastebin.com/f7sKJfNd[/url] if I switch the y,x to x,y it works but it goes through collidable tiles and if I let it stay this way it just goes into a endless loop and keeps adding nodes. [code] if (map[y, x] >= collision) [/code]
Using queues is a part of the basic concept. Don't have time to look at the code right now. Maybe later sorry.
When you use threads in java its meant to use less CPU than if you dont use it right?
[QUOTE=Darwin226;24341243]Using queues is a part of the basic concept. Don't have time to look at the code right now. Maybe later sorry.[/QUOTE] can't you also just search the list every time ? I mean its a small map with 40*40 tiles. I can always implement the queues later
[URL="http://msdn.microsoft.com/en-us/library/system.collections.queue.aspx"]C# has queues...[/URL]
[QUOTE=Richy19;24342398]When you use threads in java its meant to use less CPU than if you dont use it right?[/QUOTE] No.
I think generally it'll use up more cycles, though probably not anything considerable. If using threads makes it easy, or you have an algorithm that you can parallelize and want the performance-boost for multi-core systems, just go for it.
[QUOTE=Darwin226;24342466][URL="http://msdn.microsoft.com/en-us/library/system.collections.queue.aspx"]C# has queues...[/URL][/QUOTE] But wouldn't that just be the same thing, I still need to search it every time because you can/can't ? sort it ?
Well, if A* is anything like breadth first search, and I'm pretty sure it is, then no. A queue adds elements to the front and removes them from the back, hence the name. I think the list adds to the front and can remove any element. As I said, haven't looked at the code but I think the idea is to start at the first field, mark every field around it with 1, then every field around those with 2 and so on until you reach the end field. Then back track from to get the path. You push the first field in the queue and then, with a while (queue.Count > 0) { currentField = queue.Dequeue() } add the 4 (or 8 if you go diagonally too) surrounding fields to the queue and so on. If you for example used a stack, it would first go trough one possible path, then the next one and so on, when the queue goes trough all of them at the same time, step by step.
Sorry, you need to Log In to post a reply to this thread.