[QUOTE=ArgvCompany;38854542]That's because std::queue doesn't have push_back. Use push instead.[/QUOTE]
Herp derp. Thanks.
This probably has been asked many times already but you know, blues can't search. I have quite good experience with C#, so how hard would it be to move on to C++? Mainly for SFML. I have heard that using C++ fluently is hard with the pointers(?) and stuff.
[QUOTE=Funley;38854793]This probably has been asked many times already but you know, blues can't search. I have quite good experience with C#, so how hard would it be to move on to C++? Mainly for SFML. I have heard that using C++ fluently is hard with the pointers(?) and stuff.[/QUOTE]
Pointers aren't hard. They're pretty much "easy". Dunno about switching tho.
[QUOTE=Funley;38854793]This probably has been asked many times already but you know, blues can't search. I have quite good experience with C#, so how hard would it be to move on to C++? Mainly for SFML. I have heard that using C++ fluently is hard with the pointers(?) and stuff.[/QUOTE]
I had to do this a few months ago. I try to avoid using the heap (pointers) mostly, because you're right - it is probably the most difficult part. Overall though it hasn't been that bad.
[QUOTE=Staneh;38803292]I need to make something happen on an interval with C#, XNA, lets say I want to run a method every 500 miliseconds, what would be the easiest and quickest way of doing this?[/QUOTE]
Very late pehaps but the GameTime object has a variable for that.
Make a float/ double variable end add gameTime.ElapsedGameTime.TotalMiliseconds each time, if the variable is above 500 you know 500 ms has elapsed.
Just set the variable to 0 after that and it can start over.
Maybe a little bit more work than a Timer but cleaner in the XNA enviroment.
What's everybody's opinion of Haskell?
I have to implement Rabin Karp string search algorithm in it and it feels like getting circumcised all over again, its wrecking my head.
I have a problem with my C++ project, on linux everything works fine, but in windows I used to get lots of linker errors, I managed to fix it but now the window opens, at which point I dont think its updating, I have te fps drawing in the corner but this stays on 0 and when I move the mouse nothing happens, on linux its meant to draw a red triangle under the cameras position.
The project uses: glfw, glm, glew...
-snip-
My bad it was something to do with the delta time, does anyone know ho to turn on vsync or set the fps limit with glfw?
[QUOTE=Funley;38854793]This probably has been asked many times already but you know, blues can't search. I have quite good experience with C#, so how hard would it be to move on to C++? Mainly for SFML. I have heard that using C++ fluently is hard with the pointers(?) and stuff.[/QUOTE]
It shouldn't be too hard. Really if you think your gonna have issues try using them in your C# work to get a good feel for them. [url]http://www.c-sharpcorner.com/UploadFile/rajeshvs/PointersInCSharp11112005051624AM/PointersInCSharp.aspx[/url]
ould this be the correct way to implement a frametime limit?
[cpp]
double delta = glfwGetTime();
if(delta < 0.0) delta = 0.0;
glfwSleep(upTime - delta); //uptime is: 1.0 / 60
mDelta = glfwGetTime(); //mDelta is the deltatime that all the update uses
glfwSetTime( 0.0 );
[/cpp]
[QUOTE=Map in a box;38857407]Anyone know why?[/QUOTE]
hooks[id] does not exist?
That's one issue, I can't tell if it's valid or not without making it a pointer which opens up more issues
[editline]16th December 2012[/editline]
Rewrote that part to use a lookup table. It werks now:
[cpp]struct GUIHook{
IGUIElement* element;
EGUI_EVENT_TYPE type;
void (*hook)(GUIHook);
};
struct GUILookup{
IGUIElement* element;
u32 index;
};
array<array<GUIHook>> hooks;
array<GUILookup> lookuptable;
array<GUIHook>* getElementHooks(IGUIElement* element){
for(u32 I=0;I<lookuptable.size();I++){
if(lookuptable[I].element) return &hooks[lookuptable[I].index];
}
return NULL;
}
int curID=0;
class EventReceiver : IEventReceiver{
public:
virtual bool OnEvent(const SEvent& event){
if(event.EventType==EEVENT_TYPE::EET_GUI_EVENT){
array<GUIHook>* elHooks=getElementHooks(event.GUIEvent.Caller);
if(elHooks==NULL) return false;
for(u32 I=0;I<elHooks->size();I++){
if(elHooks->operator[](I).type==event.GUIEvent.EventType)
elHooks->operator[](I).hook(elHooks->operator[](I));
}
}
return false;
}
};
void hookGUIElement(IGUIElement* element, EGUI_EVENT_TYPE type, void (*func)(GUIHook)){
if(element->getID()==-1){
curID++;
element->setID(curID);
hooks.reallocate(curID+1);
GUILookup lookup;
lookup.index=hooks.size();
lookup.element=element;
hooks.push_back(array<GUIHook>());
lookuptable.push_back(lookup);
}
GUIHook hook;
hook.element=element;
hook.type=type;
hook.hook=func;
getElementHooks(element)->push_back(hook);
}
[/cpp]
Does anyone know of any popular 2D games made with glfw? I'm looking into open source software so I could learn about general game engine design. I tried Gish, but that's in SDL. If I'm just being stupid and there's really not many differences between SDL and glfw, then tell me.
[QUOTE=Meatpuppet;38857817]Does anyone know of any popular 2D games made with glfw? I'm looking into open source software so I could learn about general game engine design. I tried Gish, but that's in SDL. If I'm just being stupid and there's really not many differences between SDL and glfw, then tell me.[/QUOTE]
Game engines are more than just graphics libraries. The concepts and design patterns will remain the same regardless of which graphics library you're using.
If I have a 3d isometric scene such as
[IMG]http://i81.photobucket.com/albums/j223/drawkbox/ff1.png[/IMG]
Whats the best way to convert the position of the mouse on the window into a position of the floor on the game?
for example to make the character always look towards the mouse
[QUOTE=robmaister12;38857943]Game engines are more than just graphics libraries. The concepts and design patterns will remain the same regardless of which graphics library you're using.[/QUOTE]
I need a design pattern. So you're saying that Gish's source code is really just what I need if I want to know the workflow and file patterns for a normal 2D game?
[code]
error C3867: 'Eerie::CConsole::onCommandEntered': function call missing argument list; use '&Eerie::CConsole::onCommandEntered' to create a pointer to member
[/code]
???
[code]
Eerie::hookGUIElement(consoleTextEntry, EGUI_EVENT_TYPE::EGET_EDITBOX_ENTER, Eerie::CConsole::onCommandEntered);
[/code]
hookGUIElement definition:[code]void hookGUIElement(IGUIElement* element, EGUI_EVENT_TYPE type, void (*func)(GUIHook)){[/code]
[QUOTE=Over-Run;38855412]What's everybody's opinion of Haskell?
I have to implement Rabin Karp string search algorithm in it and it feels like getting circumcised all over again, its wrecking my head.[/QUOTE]
I feel data structures are significantly harder to wrap your mind around than in imperative languages. The fact that you can't exactly do destructive operations on anything makes implementing your own containers efficiently hard, even with practice.
I hate Haskell so much.
Anybody mind having a look at this short function and telling me whats wrong with it.
I'm so tired so I probably made so many mistakes and also I'm shit at Haskell.
Just trying to implement Rabin Karp.
I think I'm close but I dunno
[url]http://hpaste.org/79341[/url]
[QUOTE=Meatpuppet;38858165]I need a design pattern. So you're saying that Gish's source code is really just what I need if I want to know the workflow and file patterns for a normal 2D game?[/QUOTE]
Haven't taken a look at Gish specifically, but yeah, there's a lot to learn from games that aren't using the exact same libraries as you. Things like the entity system, overall engine structure, and even game logic code are all basically library-independent.
Most of the time, the lower-level libraries will be abstracted away in the engine.
[QUOTE=Richy19;38858028]If I have a 3d isometric scene such as
[IMG]http://i81.photobucket.com/albums/j223/drawkbox/ff1.png[/IMG]
Whats the best way to convert the position of the mouse on the window into a position of the floor on the game?
for example to make the character always look towards the mouse[/QUOTE]
[url]http://www.wildbunny.co.uk/blog/2011/03/27/isometric-coordinate-systems-the-modern-way/[/url]
I feel stupid asking this, but is it possible to do call a method on a class and have it run on all the objects of that class somehow? I'm pretty sure I read about this in a Java book a while ago but I never used it, and now I'm using Python.
basically
[code]
class MyClass(object):
def method():
print 'something'
a = MyClass()
b = MyClass()
MyClass.method() #I want something like this, it would do a.method() and b.method(), and any others if there were more!
[/code]
ugh this is probably a stupid question that everyone should know and I'm probably not even using the right names for things
[QUOTE=Shadaez;38864096]I feel stupid asking this, but is it possible to do call a method on a class and have it run on all the objects of that class somehow? I'm pretty sure I read about this in a Java book a while ago but I never used it, and now I'm using Python.
basically
[code]
class MyClass(object):
def method():
print 'something'
a = MyClass()
b = MyClass()
MyClass.method() #I want something like this, it would do a.method() and b.method(), and any others if there were more!
[/code]
ugh this is probably a stupid question that everyone should know and I'm probably not even using the right names for things[/QUOTE]
If you mean what I think you mean, then you want static functions.
Those can only work with static data in the class, though, so you can't do anything specific to each instance of the class.
[QUOTE=Over-Run;38861445]I hate Haskell so much.
Anybody mind having a look at this short function and telling me whats wrong with it.
I'm so tired so I probably made so many mistakes and also I'm shit at Haskell.
Just trying to implement Rabin Karp.
I think I'm close but I dunno
[url]http://hpaste.org/79341[/url][/QUOTE]
I'm not fluent enough to speak Haskell in my sleep and I don't have GHC installed, but I noticed the following things:
Comparison for equality should be done with ==.
You have a "let", but not a corresponding "in". The if-then-else should follow the "in".
I would also put parenthesis in "hash take length pattern mainString" so that it's easier to read:
hash (take (length pattern) mainstring)
3D Rendering question:
What's the usual way to draw a model that has parts that are Semi transparent?
Example: the frostwyrms from warcraft3 the wings are a single triangle for the most part with a texture that has transparent parts.
See here: [url]http://www.hiveworkshop.com/forums/resource_images/9/models_8100_screenshot.jpg[/url]
The wings and also the spine skin (or what's left of it :P)
Is transparent / has holes in it.
How is this done in such old games??there has to be some simple trick to it
[QUOTE=Felheart;38864825]3D Rendering question:
What's the usual way to draw a model that has parts that are Semi transparent?
Example: the frostwyrms from warcraft3 the wings are a single triangle for the most part with a texture that has transparent parts.
See here: [url]http://www.hiveworkshop.com/forums/resource_images/9/models_8100_screenshot.jpg[/url]
The wings and also the spine skin (or what's left of it :P)
Is transparent / has holes in it.
How is this done in such old games??there has to be some simple trick to it[/QUOTE]
Just have transparent holes in the texture, or even the model, I would assume
Transparent parts will still write to the depth buffer.
And then some parts of the model or the background will be missing.
The usual problem with transparency. The only solution I can think of is rendering twice, but that's pretty expensive
[cpp]glEnable(GL_BLEND); //Enable blending.
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); //Set blending function.[/cpp]
You will need an alpha channel in your frame buffer (and alpha information in your model)
You want simple alpha testing, not alpha blending.
[QUOTE=Chris220;38864526]If you mean what I think you mean, then you want static functions.
Those can only work with static data in the class, though, so you can't do anything specific to each instance of the class.[/QUOTE]
Well, is there any way to say "Every instance of the class MyClass, do this method"? That's what I'm looking for.
[editline]18th December 2012[/editline]
only thing I can think of is creating a list of them, and adding to the list in the __init__ of the class, or something?
Sorry, you need to Log In to post a reply to this thread.