Finally, got WebSocket handshaking working in chrome... Now I need to get framing to work so I can actually send data.
[IMG]http://jimbomcb.net/files/06_2011/img_0111_5333.png[/IMG]
[QUOTE=high;30794248]Personally I would hate having num.Value all over my code though and would end up declaring a variable for it anyways.[/QUOTE]
Once you check that the Nullable<int> isn't null, you can just cast it to int.
[img]http://i.imgur.com/R7hAV.png[/img]
Trying to make this be more than one massive hill, but at least caves and tunnels are somewhat decent.
Also, disregard the FPS, resizing 921600 16x16 sprites to 1x1 isn't exactly kind to the GPU.
[QUOTE=DatZach;30796253][img]http://i.imgur.com/R7hAV.png[/img]
Trying to make this be more than one massive hill, but at least caves and tunnels are somewhat decent.
Also, disregard the FPS, resizing 921600 16x16 sprites to 1x1 isn't exactly kind to the GPU.[/QUOTE]
Why not just draw pixels?
[QUOTE=iPope;30796637]Why not just draw pixels?[/QUOTE]
He's probably just showcasing his terrain generation.
[QUOTE=DatZach;30796253][img]http://i.imgur.com/R7hAV.png[/img]
Trying to make this be more than one massive hill, but at least caves and tunnels are somewhat decent.
Also, disregard the FPS, resizing 921600 16x16 sprites to 1x1 isn't exactly kind to the GPU.[/QUOTE]
If you can't just draw pixels like iPope said, then at least only do the resize operation once?
I see no reason for you to have to resize all those tiles every frame :v:
Hello ! Here's my last school project for this year, the graphics are terrible but I want to show it anyway :
[img]http://dl.dropbox.com/u/4801646/zappy.png[/img]
[QUOTE=pedrus24;30797518]Hello ! Here's my last school project for this year, the graphics are terrible but I want to show it anyway :
[img]http://dl.dropbox.com/u/4801646/zappy.png[/img][/QUOTE]
It looks like an modern Amiga / Mac OS8/9 game. I like it.
[QUOTE=bobthe2lol;30787499]Are you parsing the HTML, or reading the json from the api output?[/QUOTE]
I'm parsing the HTML. Though FP constantly dying wasn't helping my development
For those who haven't seen this yet, here's an informative read on the history of OpenGL vs Direct3D: [url]http://programmers.stackexchange.com/questions/60544/why-do-game-developers-prefer-windows/88055#88055[/url]
[QUOTE=Clavus;30800485]For those who haven't seen this yet, here's an informative read on the history of OpenGL vs Direct3D: [url]http://programmers.stackexchange.com/questions/60544/why-do-game-developers-prefer-windows/88055#88055[/url][/QUOTE]
It's a pretty good description of
a) Why OpenGL <3 (3.3 I think?) is what it is
b) Why D3D is the popular choice
c) How horribly incompetent the OpenGL ARB is
The silly thing is that people aren't willing to readopt OpenGL even though it now finally has moved onto a new world of buffer objects and shaders completely.
[QUOTE=esalaka;30800651]It's a pretty good description of
a) Why OpenGL <3 (3.3 I think?) is what it is
b) Why D3D is the popular choice
c) How horribly incompetent the OpenGL ARB is
The silly thing is that people aren't willing to readopt OpenGL even though it now finally has moved onto a new world of buffer objects and shaders completely.[/QUOTE]
Which is just another reason for me to use OpenGL only. It makes sense, and it's very much usable in the world of today, being a very modern graphics lib.
If only the guys at Crytek wrote an OpenGL renderer for their engine.
[QUOTE=Overv;30801164]If only the guys at Crytek wrote an OpenGL renderer for their engine.[/QUOTE]
Maybe you can [b]write about it at [h2]open.gl[/h2][/b]
[QUOTE=snergwerf;30801241]Maybe you can [B]write about it at [h2]open.gl[/h2][/B][/QUOTE]
*backflips onto motorcycle*
[cpp]
command=="v" ? obj_vertices.push_back(t) : // my awesome version of a switch, sadly there HAS to be a function call as default,
command=="vn" ? obj_normals.push_back(t) : // but that's what the void constructor is for anyway, right? :v
command=="vt" ? obj_uvws.push_back(t) : void();[/cpp]
What am I working on, you ask? Well, that obviously is part of some sort of file decoder.
[QUOTE=WeltEnSTurm;30802577][cpp]
command=="v" ? obj_vertices.push_back(t) : // my awesome version of a switch, sadly there HAS to be a function call as default,
command=="vn" ? obj_normals.push_back(t) : // but that's what the void constructor is for anyway, right? :v
command=="vt" ? obj_uvws.push_back(t) : void();[/cpp]
What am I working on, you ask? Well, that obviously is part of some sort of file decoder.[/QUOTE]
I'm confused as to why you're doing that and not:
[cpp]if(command == "vt") obj_uvws.push_back(t);[/cpp]
[QUOTE=Chris220;30802887]I'm confused as to why you're doing that and not:
[cpp]if(command == "vt") obj_uvws.push_back(t);[/cpp][/QUOTE]
Because it needs more keystrokes, especially if you're using a lot of 'else if's.
And I find it somewhat easier to read.
How are you adding a ":" but with no return value? (Or anything at all, for that matter)
[editline]30th June 2011[/editline]
Wait nevermind
[QUOTE=WeltEnSTurm;30802955]Because it needs more keystrokes, especially if you're using a lot of 'else if's.
And I find it somewhat easier to read.[/QUOTE]
Why didn't you name command c? That would have saved you more keystorkes.
Not sure why it's easier to read. It's almost the same:
[cpp]command=="v" ? obj_vertices.push_back(t) :
command=="vn" ? obj_normals.push_back(t) :
command=="vt" ? obj_uvws.push_back(t) : void();[/cpp]
[cpp] if(command=="v") obj_vertices.push_back(t) //you can also indent it
else if(command=="vn") obj_normals.push_back(t)
else if(command=="vt") obj_uvws.push_back(t)[/cpp]
You should look out more for readability. Try to avoid the ternary operator.
[cpp]constexpr char vertex_magic = 'v', normals_magic = 'n', uvws_magic = 't';
if(command.size() == 0)
return false;
if(command[0] == vertex_magic)
{
//look if it's just a vertex declaration
if(command.size() == 1)
obj_vertices.push_back(t);
//if not, it should only have 1 additional magic byte
else if(command.size() != 2)
return false;
switch(command[1])
{
case normals_magic: obj_normals.push_back(t); break;
case uvws_magic: obj.uvws.push_back(t); break;
default: return false;
}
}
return true;[/cpp]
It's a lot more loc, but it's more efficient (only need to check the v once), you can easily see what's going on and it's also comfortable to extend.
Defining constexpr-chars for those magic characters is not really necessary, but I don't see anything wrong with them either.
[QUOTE=ZeekyHBomb;30803292]
[cpp]constexpr char vertex_magic = 'v', normals_magic = 'n', uvws_magic = 't';
if(command.size() == 0)
return false;
if(command[0] == vertex_magic)
{
//look if it's just a vertex declaration
if(command.size() == 1)
obj_vertices.push_back(t);
//if not, it should only have 1 additional magic byte
else if(command.size() != 2)
return false;
switch(command[1])
{
case normals_magic: obj_normals.push_back(t); break;
case uvws_magic: obj.uvws.push_back(t); break;
default: return false;
}
}
return true;[/cpp]
It's a lot more loc, but it's more efficient (only need to check the v once), you can easily see what's going on and it's also comfortable to extend.
Defining constexpr-chars for those magic characters is not really necessary, but I don't see anything wrong with them either.[/QUOTE]
Switch doesn't support strings, and I have to process commands longer than one character.
I could use if-elses, but it won't make much of a difference performance-wise.
My version of doing that just does what I want it to do, is easily extendable (just add (conditional)?(operation): and done),
works perfectly well for calling just a single function and looks better to me. If I have to do more than just calling one function, I'll switch.
E:
If the first character is not v anymore, it gets pretty annoying to extend. But I guess it will work for this file format.
If you have much more, consider using an associative map to map strings to functions/function objects.
That's what I planned to do in the first place, but initializing them is annoying and C++0x can be a bitch at times.
Lua-style function declarations that return its pointer would be awesome, that's the way I would love to do it:
[cpp]
struct obj_command {
std::string c;
void(*f)(const std::string&);
};
std::vector<obj_command> = {
{
"v",
void()(const std::string& s){
}
}
};[/cpp]
I guess I like Lua too much. (Didn't use map because I never really used it D:)
[img]http://jimbomcb.net/files/06_2011/img_0112_5740.png[/img]
[editline]30th June 2011[/editline]
[url]http://jimbomcb.net/ws.html[/url] try this for the next 10 minutes, the handshaking is still buggy and doesn't work half the time, keep refreshing until it connects!
and this only works in chrome at the minute, firefox is awkward and sends handshaking stuff in a different packet and i haven't designed it for that yet.
Seems to be working great
[img]http://i.imgur.com/88IpP.png[/img]
More progress:
[IMG]http://img851.imageshack.us/img851/6634/commonqt5.png[/IMG]
If the input box is blank the OK button is disabled. If the input is validated against a regular expression, it's enabled. If it's changed to something silly again, it's disabled.
47 out of 556 pages translated to Lisp.
Getting my C groove on - converting midi files into .tone files for my old iPod nano :buddy:
Haven't much experience with binary files, kinda enjoying all of this bit-twiddling stuff.
[editline]30th June 2011[/editline]
Huh, that's weird. putc()'s changing my \n into a \r\n when I write to the output file. This could get annoying.
Would it be stupid to learn OpenGL to make 2D-games for starters? I'm eager to learn OpenGL but I don't have the math knowledge needed for 3D-stuff without copying shit straight out of tutorials.
EDIT: Is OpenGL even suitable for 2D-games?
Sorry, you need to Log In to post a reply to this thread.