[csharp]
keys.Add( (Key)Enum.Parse( typeof( Key ), names[ i ] ), KeyState.Up );[/csharp]
Is there a prettier way to do this?
keys is a Dictionary<Key, KeyState>
Key is an enum
KeyState is an enum
i is the loop variable
It's supposed to fill the Dictionary with all the names in the enum and set them to KeyState.Up
[QUOTE=T3hGamerDK;28339834]What output did you expect/want?[/QUOTE]
I want to use Cygwin to compile on my windows machine and use the file on my linux VM.
[code]space = " ";
ex = "!";
print( "hello" + space + "world" + ex);[/code]
[code]hello world![/code]
Strings were suprisingly easy to implement.
[QUOTE=Nigey Nige;28341004]My experience learning to use PyGame:
I'll never make my dream Spelunky clone :([/QUOTE]
Post the code, I'll show you where your going wrong.
[QUOTE=high;28342118]I want to use Cygwin to compile on my windows machine and use the file on my linux VM.[/QUOTE]
Invoke gcc-linux instead of gcc.
wow, the GMA945 really sucks... I'm trying to work on my level editor at school (netbook), the texture that has transparency won't appear at all, but all the non-transparent textures work fine.
[url=http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Target-Options.html#Target-Options]linux-gcc[/url], not gcc-linux.
Dream Build Play here I come!
:ninja:
[editline]28th February 2011[/editline]
Damnit, don't break all my automerges!
[QUOTE=ZeekyHBomb;28342724][url=http://gcc.gnu.org/onlinedocs/gcc-4.5.2/gcc/Target-Options.html#Target-Options]linux-gcc[/url], not gcc-linux.[/QUOTE]
How do I configure codeblocks to do that?
Settings -> Compilers and debuggers
16 ms to render 800 particles.
Is that too slow? Separate draw calls, uniform setting and everything for each.
I have created a pretty neat resource management system just for my game competition game :buddy:
Check this out...
[cpp]ResourceManager.LoadImage("Data/Textures/Ball.png")[/cpp]
The function automatically turns the path to the file to just the file name without extension, and then adds it to a dictionary. Afterwards, you can access the image from everywhere by doing
[cpp]ResourceManager.images["Ball"][/cpp]
Simple, but damn effective!
What happens if two files with the same name lie in different folders or differ just in the extention?
[QUOTE=Darwin226;28343297]16 ms to render 800 particles.
Is that too slow? Separate draw calls, uniform setting and everything for each.[/QUOTE]
Yes, that sounds pretty slow. But I guess it depends on how complex the particles are, if they are just single sprites/lines it should be way faster.
[editline]28th February 2011[/editline]
[QUOTE=Dlaor-guy;28343450]I have created a pretty neat resource management system just for my game competition game :buddy:
Check this out...
[cpp]ResourceManager.LoadImage("Data/Textures/Ball.png")[/cpp]
The function automatically turns the path to the file to just the file name without extension, and then adds it to a dictionary. Afterwards, you can access the image from everywhere by doing
[cpp]ResourceManager.images["Ball"][/cpp]
Simple, but damn effective![/QUOTE]
Wouldn't it make more sense to load resources like this? ResourceManager.LoadImage("Data/Textures/Ball.png", "redBall")
You can now have multiple files with the same name and you don't have to change every single occurrence of images["redBall"] when you decide to use a different sprite with a different name.
[QUOTE=Robber;28344089]Yes, that sounds pretty slow. But I guess it depends on how complex the particles are, if they are just single sprites/lines it should be way faster.[/QUOTE]
Well, their updating takes 0 ms. The draw calls to OpenGL take all that time.
[QUOTE=ZeekyHBomb;28343212]Settings -> Compilers and debuggers[/QUOTE]
But then what? I switched the compiler to cygwin and I don't see any linux settings. I tried using -b but it says its unknown.
Also is it an executable because I don't see linux-gcc in the bin folder even though I set it to install with all the devel options.
There might not be any binary releases setup for cross-compilation.
Build it yourself from source using the --target option when configuring.
[QUOTE=deloc;28337202]don't kid yourself. this isn't irrelevant chat thread v16.
[highlight](User was banned for this post ("Continuous shitposting" - Overv))[/highlight][/QUOTE]
Oh god yes
I'm so glad we have a mod in the programming forum now.
[QUOTE=ZeekyHBomb;28344457]There might not be any binary releases setup for cross-compilation.
Build it yourself from source using the --target option when configuring.[/QUOTE]
Happen to know of a guide? I thought cygwin would have had precompiled binaries for linux compiling :(.
Precompiled binaries? In my world? Never. You have to build them yourself with old libraries with old and outdated guides on how to set them up and configure them. Making you pull your hair for hours.
Not sure if this work like this on Windows (perhaps with MSYS), but try simply executing ../configure --target=i686-linux in <gcc-source>/build.
Guys check it out: [url]http://codereview.stackexchange.com/[/url]
[QUOTE=ZeekyHBomb;28343609]What happens if two files with the same name lie in different folders or differ just in the extention?[/QUOTE]
If they have a different extension then you don't use LoadImage but LoadSound or LoadFont for example. Every data type has it's own dictionary.
[editline]28th February 2011[/editline]
[QUOTE=Ortzinator;28345039]Guys check it out: [url]http://codereview.stackexchange.com/[/url][/QUOTE]
Awesome, a free code cleanup and optimize service! :v:
[QUOTE=Dlaor-guy;28345057]If they have a different extension then you don't use LoadImage but LoadSound or LoadFont for example. Every data type has it's own dictionary.[/QUOTE]
I meant different file-formats, but for the same purpose.
[QUOTE=iPope;28342494]Post the code, I'll show you where your going wrong.[/QUOTE]
I already deleted it. Thanks, though! You guys are all so helpful :3
Updated my particle engine to allow more than one particle type from a single emitter. Particles have different properties etc so you can make smoke and fire behave differently! :)
[media]http://www.youtube.com/watch?v=JbCJAlyDKmk[/media]
[QUOTE=Dlaor-guy;28343450]I have created a pretty neat resource management system just for my game competition game :buddy:
Check this out...
[cpp]ResourceManager.LoadImage("Data/Textures/Ball.png")[/cpp]
The function automatically turns the path to the file to just the file name without extension, and then adds it to a dictionary. Afterwards, you can access the image from everywhere by doing
[cpp]ResourceManager.images["Ball"][/cpp]
Simple, but damn effective![/QUOTE]
My game has one of these too.
[code]
SuperStrict
Import brl.filesystem
Import brl.map
Import brl.standardio
Import brl.max2d
Import brl.Graphics
Global scanimg:TImage = LoadImage("Resource/scan.png")
Global loadimg:TImage = LoadImage("Resource/load.png")
Function DrawLoadingScreen(name:String = "", cur:Int, total:Int, s:Byte)
SetBlend(ALPHABLEND)
SetColor(0, 0, 0)
SetAlpha(1)
DrawRect(0, 0, 800, 600)
SetColor(255, 255, 255)
If s Then
DrawImage(scanimg, 50, 20)
Else
DrawImage(loadimg, 50, 20)
End If
DrawText("Loading: " + name, 150, 20)
DrawText(cur + "/" + total, 150, 35)
Flip(0)
End Function
Type ResourceLoader
Field _map:TMap = New TMap
Method CountFolder:Int(path:String, types:String, cur:Int = 0)
Local total:Int = cur
Local Dir:String[] = LoadDir(path)
Local FileTypes:String[] = types.Split("|")
For Local f:String = EachIn Dir
If Chr(f[0]) = "." Continue
Select FileType(path + "/" + f)
Case FILETYPE_DIR
total = total + CountFolder(path + "/" + f, types, total)
Case FILETYPE_FILE
For Local s:String = EachIn FileTypes
If s = ExtractExt(f)
total = total + 1
DrawLoadingScreen(path, 0, total, 1)
Exit
End If
Next
EndSelect
Next
Return total
End Method
Method LoadFolder:Int(path:String, types:String, c:Int = 0, t:Int = 0)
Local total:Int = t
If t = 0 Then
total = CountFolder(path, types)
End If
Local cur:Int = c
Local Dir:String[] = LoadDir(path)
Local FileTypes:String[] = types.Split("|")
For Local f:String = EachIn Dir
If Chr(f[0]) = "." Continue
Select FileType(path + "/" + f)
Case FILETYPE_DIR
cur = cur + LoadFolder(path + "/" + f, types, cur, total)
Case FILETYPE_FILE
For Local s:String = EachIn FileTypes
If s = ExtractExt(f)
AddResource(path + "/" + f)
cur = cur + 1
DrawLoadingScreen(path, cur, total, 0)
Exit
End If
Next
EndSelect
Next
Return cur
End Method
Method AddResource(url:String) Abstract
Method Get:Object(key:String)
Return _map.ValueForKey(key)
EndMethod
Method PrintMe()
For Local k:String = EachIn _map.Keys()
brl.standardio.Print(k)
Next
EndMethod
EndType
[/code]
:v:
Is there anyway I can use double precision floats in GLSL on an 9800GT?