• What do you need help with? Version 5
    5,752 replies, posted
[QUOTE=~ZOMG;36665702]Is there a way to compile and run a program from MS Visual C++?[/QUOTE] Press F5 or click [img]http://puu.sh/GDXx[/img].
How do I load an image using Android's bitmap and bitmapfactory, while preserving the transparency? I am trying to load PNG but the transparency comes out black. I've saved it as a PNG-24, but no dice. This is the load method, with inScaled turned off. [code]final Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resourceId, options);[/code]
[QUOTE=Overv;36665722]Press F5 or click [img]http://puu.sh/GDXx[/img].[/QUOTE] Thanks bro.
[QUOTE=WTF Nuke;36665783]How do I load an image using Android's bitmap and bitmapfactory, while preserving the transparency? I am trying to load PNG but the transparency comes out black. I've saved it as a PNG-24, but no dice. This is the load method, with inScaled turned off. [code]final Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resourceId, options);[/code][/QUOTE] I don't know anything about Android stuff but if you're saving as PNG-24, surely there will be no alpha channel? 32 might be what you want.
I'm sorry for posting so frequently, but is there a way to keep the console open for more than a split second? I'm currently making some basic, crappy console program but when I run it the window closes before I can read anything.
[QUOTE=~ZOMG;36668044]I'm sorry for posting so frequently, but is there a way to keep the console open for more than a split second? I'm currently making some basic, crappy console program but when I run it the window closes before I can read anything.[/QUOTE] You can either run it trough the command line or make it wait for input before exiting.
[QUOTE=~ZOMG;36668044]I'm sorry for posting so frequently, but is there a way to keep the console open for more than a split second? I'm currently making some basic, crappy console program but when I run it the window closes before I can read anything.[/QUOTE] Since you are on windows, Just type system("pause") before you return 0.
[QUOTE=flayne;36668256]Since you are on windows, Just type system("pause") before you return 0.[/QUOTE] Don't. Use getchar().
[QUOTE=dajoh;36668274]Don't. Use getchar().[/QUOTE] Um, I'm sorry, but how would I use this?
Just call it, it's going to wait for input. alternatively you can just put a breakpoint before it exits so you can see your results before the program exits. [url]http://www.cplusplus.com/reference/clibrary/cstdio/getchar/[/url]
Ah, I didn't consider using breakpoints. They fit the bill perfectly. Thanks :smile:
Hey guys, I need help properly setting up the shooting mechanics for my sidescrolling shooter. What I want to do is implement a burst fire. When the shark shoots it shoots a max of 3 bullets on screen. What I want to do it make it so that the shark shoots in bursts of a max of 3 bullets. And when the first bullet reaches the edge of the screen, another burst can be fired. I also want the bullets to be able to fire in sync automatically. I can't seem to get it right, so I was hoping for some help from much more experienced programmers. Here is my project: [URL]https://dl.dropbox.com/u/3655315/Programming/Neeed HEEELP.rar[/URL] The controls are: Arrow keys: move Z: shoot Hold LeftShift: enhanced precision and more bullets per burst Esc: Exit
[QUOTE=Xion12;36668550]Hey guys, I need help properly setting up the shooting mechanics for my sidescrolling shooter. What I want to do is implement a burst fire. When the shark shoots it shoots a max of 3 bullets on screen. What I want to do it make it so that the shark shoots in bursts of a max of 3 bullets. And when the first bullet reaches the edge of the screen, another burst can be fired. I can't seem to get it right, so I was hoping for some help from much more experienced programmers. Here is my project: [URL]https://dl.dropbox.com/u/3655315/Programming/Neeed HEEELP.rar[/URL] The controls are: Arrow keys: move Z: shoot Hold LeftShift: enhanced precision and more bullets per burst Esc: Exit[/QUOTE] try making a loop that at the end it adds ++ to a counter, as long as the bullets on the screen are < 3 it can fire.
I tried that, but it makes the bullets go out of sync if you move left or right.
I am writing a WIN32 application using OpenGL. I wish to allow the usual re-sizable window with click and drag with window messages. However, I need to get the drawable area of the window rather than that including the border and toolbar. Basically I need to do the reverse of AdjustWindowRect. How would I go about this?
[QUOTE=~ZOMG;36668480]Ah, I didn't consider using breakpoints. They fit the bill perfectly. Thanks :smile:[/QUOTE] If you're using Visual Studio, Ctrl+F5 will run your application and automatically pause it before it closes.
If I have a logic thread and a graphics thread, should I keep position and size variables on the graphics thread and update it through the logic thread? Or should I just send info from the logic thread to the graphic thread and it'll work based off of that info. I think graphics thread holding basic info would be faster, but am unsure what is better.
[QUOTE=Xion12;36668651]I tried that, but it makes the bullets go out of sync if you move left or right.[/QUOTE] How so out of sync? as in 2 go left and 1 goes right, or something else?
posted this in waywo already, but I guess here is the better place to ask: Anyone got an idea how to create a "2D per-pixel depth testing shader" in xna? The thing is: I have greyscale height maps, and what I want to do is, everytime I'm drawing a new object, compare each pixel with the height value behind it, if it's bigger, replace it, if not, keep the old value. Based on that final depth map, I pretty much have 2.5D collision.... So what I have to do is basically alpha testing, just with greyscale textures... xna, hlsl... tried to do it with rendertargets, but with xna 4.0 they are kinda fucked up the way I wanna use the rendertargets as textures and pass them to the shader.
I am going to make a basic encryption program (scramble around a few words in a text file) but I have no idea how to deal with files outside c++. Where can I learn more about file management?
[QUOTE=flayne;36669053]I am writing a WIN32 application using OpenGL. I wish to allow the usual re-sizable window with click and drag with window messages. However, I need to get the drawable area of the window rather than that including the border and toolbar. Basically I need to do the reverse of AdjustWindowRect. How would I go about this?[/QUOTE] The area inside the window is called the client rectangle and can be retrieved with [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms633503(v=vs.85).aspx][b]GetClientRect[/b] [img]http://puu.sh/GJpl[/img][/url].
[QUOTE=krazipanda;36669754]How so out of sync? as in 2 go left and 1 goes right, or something else?[/QUOTE] It's sort of hard to explain. What I mean is that if you fire 1 second in between shots, but at the last shot you wait 2 seconds before you fire it, then when you hold the shoot key it fires in that pattern, rather than at the fire rate that was put in place. In order to be able to fire normally, I would have to wait until the last bullet gets deleted, and the shot count reaches 0. Sorry if it doesn't make any sense. You can try it out if you run the build in the project I uploaded. [URL]https://dl.dropbox.com/u/3655315/Programming/Neeed HEEELP.rar[/URL] In order to fire using the shot counter, just replace line 67 in shotManager with this: [code] if (shotsShot < maxShots) { } [/code]
[QUOTE=Overv;36670288]The area inside the window is called the client rectangle and can be retrieved with [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms633503(v=vs.85).aspx][b]GetClientRect[/b] [img]http://puu.sh/GJpl[/img][/url].[/QUOTE] How do I get the proper left, top coordinates instead of 0 as the function returns. Thanks.
[QUOTE=Xion12;36671052]It's sort of hard to explain. What I mean is that if you fire 1 second in between shots, but at the last shot you wait 2 seconds before you fire it, then when you hold the shoot key it fires in that pattern, rather than at the fire rate that was put in place. In order to be able to fire normally, I would have to wait until the last bullet gets deleted, and the shot count reaches 0. Sorry if it doesn't make any sense. You can try it out if you run the build in the project I uploaded. [URL]https://dl.dropbox.com/u/3655315/Programming/Neeed HEEELP.rar[/URL] In order to fire using the shot counter, just replace line 67 in shotManager with this: [code] if (shotsShot < maxShots) { } [/code][/QUOTE] possibly make a sub-class of a different bullet? like a completely different thing for the triple shot.
Im trying to use Love for some simple stuff, I have: [lua] love.graphics.setBackgroundColor( 255, 255, 255, 255 ) image = love.graphics.newImage( 'Speaker.png' ) FL = { 50, 50 } FR = { 550, 50 } BL = { 50, 550 } BR = { 550, 550 } function toRad(n) return n * 0.0174532925 end function love.draw() love.graphics.draw( image, 300 - FL[0], 300 - FL[1], toRad(45), 1, 1, 16, 16, 0, 0 ) love.graphics.draw( image, 300 - FR[0], 300 - FR[1], toRad(135), 1, 1, 16, 16, 0, 0 ) love.graphics.draw( image, 300 - BL[0], 300 - BL[1], toRad(315), 1, 1, 16, 16, 0, 0 ) love.graphics.draw( image, 300 - BR[0], 300 - BR[1], toRad(450), 1, 1, 16, 16, 0, 0 ) end [/lua] And im getting: Error: main.lua:15: attempt to perform arithmetic on field '?' (a nil value) Im guessing that being about the 300 - FL[0], can someone tell me what i messed up?
[QUOTE=Richy19;36673251]Im trying to use Love for some simple stuff, I have: [lua] love.graphics.setBackgroundColor( 255, 255, 255, 255 ) image = love.graphics.newImage( 'Speaker.png' ) FL = { 50, 50 } FR = { 550, 50 } BL = { 50, 550 } BR = { 550, 550 } function toRad(n) return n * 0.0174532925 end function love.draw() love.graphics.draw( image, 300 - FL[0], 300 - FL[1], toRad(45), 1, 1, 16, 16, 0, 0 ) love.graphics.draw( image, 300 - FR[0], 300 - FR[1], toRad(135), 1, 1, 16, 16, 0, 0 ) love.graphics.draw( image, 300 - BL[0], 300 - BL[1], toRad(315), 1, 1, 16, 16, 0, 0 ) love.graphics.draw( image, 300 - BR[0], 300 - BR[1], toRad(450), 1, 1, 16, 16, 0, 0 ) end [/lua] And im getting: Error: main.lua:15: attempt to perform arithmetic on field '?' (a nil value) Im guessing that being about the 300 - FL[0], can someone tell me what i messed up?[/QUOTE] Lua indices start at 1.
I need help with regular expressions. I need to replace: $1,$2,$3, with extern $1 $2; where each $ is an alphanumeric string. Figured it out: find: {[^,]+}\,{[^,]+}\,{[^,]+}\, replace: extern \1 \2;
[QUOTE=flayne;36671202]How do I get the proper left, top coordinates instead of 0 as the function returns. Thanks.[/QUOTE] [url=http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519(v=vs.85).aspx]GetWindowRect[/url]
I'm making a 2D Block-based game, and I'm doing horrible with collisions. Here's my code: [CODE] if(player.y+PlayerSize+player.vy >=block[i].y && player.y-PlayerSize-player.vy <=block[i].y){ if(player.x+PlayerSize+player.vx >=block[i].x && player.x-PlayerSize-player.vx <=block[i].x){ player.y = player.oldy; player.vy = 0; player.collidebottom = true; } } if(player.x+PlayerSize+player.vx >=block[i].x && player.x-PlayerSize-player.vx <=block[i].x){ if(player.y+PlayerSize+player.vy >=block[i].y && player.y-PlayerSize-player.vy <=block[i].y){ player.x = player.oldx; player.vx = 0; } } [/CODE] It seems to make the player get stuck in the right and bottom sides of blocks
What is the proper syntax for outputting to a pointer fstream file in an std::list<std::fstream*>? This doesn't work. [cpp] comics.front() << html[0] << c.getYear() << " - " << c.getMonth() << html[1] << c.getYear() << " - " << c.getMonth() << html[2] << c.getMonth() << html[3] << c.getDay() << html[4] << c.getDay() << html[5] << std::endl; comics.front().close(); [/cpp]
Sorry, you need to Log In to post a reply to this thread.