• What do you need help with? V. 3.0
    4,884 replies, posted
[QUOTE=Richy19;33140215]It solves the box problem but scaling it makes it fuzzy [img]http://img850.imageshack.us/img850/4531/unled1ei.png[/img] This is making the font small and upscaling. Making the font bigger kept the squares[/QUOTE] looks like a linear texture mag filter to me. If you're using OpenGL, make sure that the tex parameter GL_MAG_FILTER is set to GL_NEAREST instead of GL_LINEAR. I'm not sure what the DirectX equivalent would be, but it should be pretty similar.
Also, an alternate strategy to one-number switches is to read one character from stdin, then do the cases with character constants: '1' instead of 1, etc.
[QUOTE=calzoneman;33141280]It's probably not a good idea to make your main function recursive. A better way to do this would be to do something like [cpp] bool valid_input = false; while(!valid_input) { // switchy stuff here } [/cpp][/QUOTE]How do I put that in my function? This is C, by the way.
[QUOTE=Meatpuppet;33141774]How do I put that in my function? This is C, by the way.[/QUOTE] [cpp]int main() { char choice; printf("Welcome to Generic Shooter 2. What do you want to do?\n 1. Start New Campaign\n 2. Load Campaign\n 3. Play Multiplayer Campaign\n 4. Play Multiplayer Deathmatch\n 5. Quit Game\n Selection: "); scanf("%c", &choice); bool valid_input = false; while(!valid_input) { switch (choice) { case '1': New(); valid_input = true; break; case '2': Load(); valid_input = true; break; case '3': Coop(); valid_input = true; break; case '4': Deathmatch(); valid_input = true; break; case '5': printf("Quitting..."); valid_input = true; break; default: printf("Choice not valid. Returning to Main Menu..."); break; } } getchar(); }[/cpp] Although if the switch is intended to continue until the game quits a simple while(true) would suffice
I'm working on a screenshot program, a bit like ZScreen, in C#. This is the class I'm using to implement a global keyboard hook: [url]http://pastebin.com/WNESf0Va[/url] The problem is that it doesn't allow others to handle it. I'm registering printscreen, but the clipboard doesn't contain an image when I press it. I could do two things: [B]1. [/B]Find a way to pass the message through so that Windows [B]does[/B] save the image to the clipboard, or [B]2. [/B]Take a screenshot myself using Graphics.CopyFromScreen. I want to know if people mind if I take option 2, if it makes any difference. If it's better to use the clipboard, I need to know how to do option 1. [editline]6th November 2011[/editline] Actually, it doesn't matter. I have to set the clipboard to text afterwards anyway. :v:
How the f...reak does it say theres another page, without there actually being one? [b]Edit:[/b] Nevermind, seems like a bug... When a page is full, it shows like there is a next page even if there isnt any.
I thought that was fixed, haven't seen it happen in a while.
[QUOTE=robmaister12;33141321]looks like a linear texture mag filter to me. If you're using OpenGL, make sure that the tex parameter GL_MAG_FILTER is set to GL_NEAREST instead of GL_LINEAR. I'm not sure what the DirectX equivalent would be, but it should be pretty similar.[/QUOTE] To change this would I have to change the SFML source?
I was just looking through the thread and saw this: [QUOTE=Edvinas;32976936]I've been having a lot of trouble with this assignment which I have to finish until Friday: [quote]There are from 1 to x offices in the building, a tablet is nailed on each office door with it's number, each number must have a separate tablet. So, if there are 10 offices in the building, then 11 tablets will be required, if 100 then 192. Write a program which calculates how many tablets will be required for x offices.[/quote] Anyone got any suggestions?[/QUOTE] And I thought I'd practice my Python lambdas: [code]>>> from math import log10 >>> f = lambda x: sum([((n==0) and 1) or int(log10(abs(n)))+1 for n in range (1, x+1)]) >>> f(10) 11 >>> f(100) 192 >>> f(10**6) 5888896[/code] Apparently, this logarithmic digit counting is pretty much just as fast as len(str(abs(n))). [code]>>> f2 = lambda x: sum([len(str(abs(n))) for n in range (1, x+1)]) >>> f(10**6) 5888896 >>> f2(10**6) 5888896 >>> from timeit import timeit >>> timeit(repr(f(10**6))) 0.008955676209552621 >>> timeit(repr(f2(10**6))) 0.009411776069782718 [/code] Any way to make this a little more efficient while keeping it a short, unreadable one-liner?
How do I make a grid like this? [QUOTE][IMG]http://i.imgur.com/NezyD.png[/IMG][/QUOTE] [editline]value[/editline] Let me rephrase that question. What is the best way of making a grid like that?
How would I go about line clearing in my Tetris clone? All my tetris blocks are made of individual smaller blocks so the removal shouldn't be a problem, but how would I check if a line is full? C# and XNA.
[QUOTE=Asgard;33150506]How would I go about line clearing in my Tetris clone? All my tetris blocks are made of individual smaller blocks so the removal shouldn't be a problem, but how would I check if a line is full? C# and XNA.[/QUOTE] That depends entirely on your implementation. If you're using simple two-dimensional arrays of individual cells, simply checking if each cell in a row is occupied should be easy enough to do. If it's full, you move every row above the one you want to clear down by one.
Hello, I would like to know if anyone knows a good tutorial for C++, I have seen quite a few but most of them aren't really my kind.
What would I need to do to a radian value to get the opposite of it relative to a plain, like this? [img]http://dl.dropbox.com/u/12024286/Example.png[/img]
[QUOTE=Mr. Smartass;33151945]What would I need to do to a radian value to get the opposite of it relative to a plain, like this? [img]http://dl.dropbox.com/u/12024286/Example.png[/img][/QUOTE] Subtract it from Pi?
-snip, never mind-
So, I'm using XNA and I'm having some trouble with collision detection between my player and the map. This is how the map is : [img]http://i.imgur.com/N6lb8.png[/img] What's the best way of doing collision detection with this type of map?
[QUOTE=Richy19;33149287]To change this would I have to change the SFML source?[/QUOTE] If you're using OpenGL, it's as simple as glBindTexture(GL_TEXTURE_2D, <font texture ID here>); glTexParameteri(GL_TEXTURE_2D, GL_MAG_FILTER, GL_NEAREST); glBindTexture(GL_TEXTURE_2D, 0); for the texture that's storing the text. It's probably just as simple in DirectX, I just have no experience with it so I couldn't give you a code snippet.
[QUOTE=xXParanoidXx;33153511]So, I'm using XNA and I'm having some trouble with collision detection between my player and the map. This is how the map is : [img]http://i.imgur.com/N6lb8.png[/img] What's the best way of doing collision detection with this type of map?[/QUOTE] I assume you have a variable for the player position that holds the coordinate the player is on. When the player presses a key to move, you check if the new coordinate contains an 1 or an 0. Assuming 1 means you collide with it and 0 means it's just air you can do something like this when the player tries to move to the right (psuedo-code): [code]if map[posX + 1][posY] == 0 then movePlayer() else fuck you[/code] [i]disclaimer: i suck at explaining shit and this might be entirely wrong since im new to game development and i dont know c# either[/i]
[QUOTE=xXParanoidXx;33153511]So, I'm using XNA and I'm having some trouble with collision detection between my player and the map. This is how the map is : [img]http://i.imgur.com/N6lb8.png[/img] What's the best way of doing collision detection with this type of map?[/QUOTE] Im using the exact same way to store the map and I have a function to retrieve the tile at position x,y. Then I do a check on 8 positions of the player: Left top, right top, right middle, right bottom, left bottom and left middle. Should I say more?
[code] x = 1 y = 0 z = 0 for n in range(1, 9000): z = x x = x + y y = z print n, ": ", x if len(str(x)) == 1000: break [/code] Doing a problem on project Euler. I have to find the first Fibonacci number to have 1000 digits. I came up with the code above but the site says it's wrong. I got 1070066266382758936764980584457396885083683896632151665013235203375314520604694040621889147582489792657804694888177591957484336466672569959512996030461262748092482186144069433051234774442750273781753087579391666192149259186759553966422837148943113074699503439547001985432609723067290192870526447243726117715821825548491120525013201478612965931381792235559657452039506137551467837543229119602129934048260706175397706847068202895486902666185435124521900369480641357447470911707619766945691070098024393439617474103736912503231365532164773697023167755051595173518460579954919410967778373229665796581646513903488154256310184224190259846088000110186255550245493937113651657039447629584714548523425950428582425306083544435428212611008992863795048006894330309773217834864543113205765659868456288616808718693835297350643986297640660000723562917905207051164077614812491885830945940566688339109350944456576357666151619317753792891661581327159616877487983821820492520348473874384736771934512787029218636250627816.
[code]Algorithm bubblesort(A, n): Input: An array A storing n integers. Output: An array with the same integers in ascending order. isReady = false while not isReady for i = 0 to n - 2 if A[i] > A[i+1] then swap(A[i], A[i+1]) isReady = true for i = 0 to n - 2 if A[i] > A[i+1] then isReady = false[/code] Here's a bubblesort algorithm that was posted on my course site. I'm just wondering about the last if-statement. Should it check if A[i] is greater than A[i+1] again or is it a typo?
[code]int main() { char choice; printf("Welcome to Generic Shooter 2. What do you want to do?\n 1. Start New Campaign\n 2. Load Campaign\n 3. Play Multiplayer Campaign\n 4. Play Multiplayer Deathmatch\n 5. Quit Game\n Selection: "); scanf("%c", &choice); bool valid_input = false; while(!valid_input) { switch (choice) { case '1': New(); valid_input = true; break; case '2': Load(); valid_input = true; break; case '3': Coop(); valid_input = true; break; case '4': Deathmatch(); valid_input = true; break; case '5': printf("Quitting..."); valid_input = true; break; default: printf("Choice not valid. Returning to Main Menu..."); break; } } getchar(); } [/code] error: 'bool' undeclared
What language is that?
By the whole scanf fiasco, I'd say C. Have you #included <stdbool.h> ?
Looks like C. Bool isn't a thing in C. I think the standard way of faking it is to use a char.
Bool is a thing in C99.
[QUOTE=Swebonny;33156718][code]Algorithm bubblesort(A, n): Input: An array A storing n integers. Output: An array with the same integers in ascending order. isReady = false while not isReady for i = 0 to n - 2 if A[i] > A[i+1] then swap(A[i], A[i+1]) isReady = true for i = 0 to n - 2 if A[i] > A[i+1] then isReady = false[/code] Here's a bubblesort algorithm that was posted on my course site. I'm just wondering about the last if-statement. Should it check if A[i] is greater than A[i+1] again or is it a typo?[/QUOTE] Helppp!
I'm having trouble understanding [url]http://www.cprogramming.com/tutorial/c/lesson6.html[/url], starting at "The function malloc" down.
[QUOTE=Jookia;33157190]By the whole scanf fiasco, I'd say C. Have you #included <stdbool.h> ?[/QUOTE] This is the best option if you're using a compiler that supports it. If not: [code] typedef int bool; #define true 1 #define false 0 [/code]
Sorry, you need to Log In to post a reply to this thread.