You could use OpenAL: [url]http://www.opentk.com/doc/audio[/url]
License: [url]http://www.opentk.com/project/license[/url]
[QUOTE=Niteshifter;32329852]I'm basically trying to optimise this mess:
[cpp]
if(AG >= 170) //170+
counter = 3;
else if(AG >= 98) //169-98
counter = 4;
else if(AG >= 62) //97-62
counter = 5;
else if(AG >= 44) //61-44
counter = 6;
//etc...
[/cpp]
This ladder goes on for about another 15 statements and I'm wondering if there's a better way.[/QUOTE]
Assuming your counter variable is as predictable as it looks, I think this should work:
[cpp]int AG_n = 4; // Or more.
int AG_values[AG_n] = {170, 98, 62, 44 /* ... */ };*
int i;
for (i = 0; i < AG_n && AG < AG_values[i]; ++i);
int counter = i + 3;[/cpp]
If your counter isn't quite that predictable, you can simply use an array as a look-up table for that as well, just like AG.
[QUOTE=Dlaor-guy;32352423]I've been looking for a good C# sound library for a while now, and there are plenty of them out there, but none of them allow commercial use without having to buy a license (I'm going to use it for Froid 2, and since I'm not using SFML.NET anymore, I can't use SFML's audio stuff anymore... and Froid 2 might be Steam-worthy, who knows?). The ones I found so far are irrKlang, FMOD.NET and BASS.NET, but as I said, they are free for non-commercial use and require a license for commercial use. Anyone knows a C# sound library that allows free commercial use?
(the hobbyist license for irrKlang is only €65, but still, I'd obviously rather go for a free alternative)[/QUOTE]
What are you going to be selling? :v:
I'm posting this in here because every other section would give me dumb answers.
I have to find all whole numbers ( x, y ) that [IMG]http://www4c.wolframalpha.com/Calculate/MSP/MSP36119h792a2e0367ci600003a1c456ggac25i1h?MSPStoreType=image/gif&s=47&w=45&h=18[/IMG] is a square of a whole number.
I have no clue on how to do this , any pointers?
[QUOTE=marcin1337;32357674]I'm posting this in here because every other section would give me dumb answers.
I have to find all whole numbers ( x, y ) that [IMG]http://www4c.wolframalpha.com/Calculate/MSP/MSP36119h792a2e0367ci600003a1c456ggac25i1h?MSPStoreType=image/gif&s=47&w=45&h=18[/IMG] is a square of a whole number.
I have no clue on how to do this , any pointers?[/QUOTE]
There's a [url=http://www.facepunch.com/threads/1065478/19]mathematics thread[/url] that's more suited for stuff like that. Generally, you'll get decent help from it.
A generic content loading system for my iPhone games engine.
Hit a snag though! Does anyone know how to do method level templates in C++(<- hand rolled definition)
I'd like to be able to do:
[cpp]m_contentManager->Load<Texture2D>("FilePath");
m_contentManager->Load<Mesh3D>("FilePath");[/cpp]
Coming from a C# world I thought it would be easier but i'm kinda stumped.
[QUOTE=VGS_Devs;32358520]A generic content loading system for my iPhone games engine.
Hit a snag though! Does anyone know how to do method level templates in C++(<- hand rolled definition)
I'd like to be able to do:
[cpp]m_contentManager->Load<Texture2D>("FilePath");
m_contentManager->Load<Mesh3D>("FilePath");[/cpp]
Coming from a C# world I thought it would be easier but i'm kinda stumped.[/QUOTE]
It's called template specialization.
Fuck it I'll post here since I'm tired of google
Does anyone have a complete tutorial for getting started with openGL in visual studio. Completely and totally covers how to set it up (and / or glut / freeglut / other libraries)
What's the best way to access other classes data? I'm working with wxWidgets, incase this API offers a better way.
Here's my issue (that i've run into alot, with general C++ programming).
My issue with this, is that everything I do must be "public" which I can see causing problems down the line.
[b]File1.cpp[/b]
[cpp]
class SomeClass
{
public:
int *m_iPointer;
};
extern SomeClass *myGlobalPointer;
[/cpp]
In "File2.cpp" I need to access "m_iPointer" this is how I do it now:
[b]File2.cpp[/b]
[cpp]
somefunc()
{
myGlobalPointer->m_iPointer;
}
[/cpp]
When coding with any API (sfml/sdl/wxwidgets) I always have a "main/master" class that's exposed to a global object, and I access everything from there.
Is this *okay*? or if there's really no other way? Also, does wxWidgets provide me a better way? I know the event system, but that doesn't help to much.
Thanks!
Make mutator and accessor methods.
[cpp]class someclass
{
private:
int x;
public:
void SetX(int newx);
int GetX();
};[/cpp]
It turns out to be more work, but this is usually preferred over making everything public. It also gives you some control on the value of x. For example, if x should never be negative, you can check for that in the SetX() method.
Also, it's usually hard to get around, but globals are frowned upon in most industries. Consider looking into design patterns which will help you avoid using globals. A very common one is called the singleton design pattern, however if abused it can be just as bad as globals. Singletons limit a class to only ever having one instance. It may be unnecessary, for example, to make an object manager, a resource manager and some other manager a singleton when it makes more sense to have one "global" singleton--a gameworld if you will--that has an instance of these classes within it. This allows you to create another object manager down the road rather than limiting yourself to one.
Does anyone have a XNA book they can recommend?
[QUOTE=Themage;32362068]Does anyone have a XNA book they can recommend?[/QUOTE]
[url]http://www.amazon.com/Learning-XNA-4-0-Development-Windows/dp/1449394620[/url]
Just curious about something, is there any particular values for which the operations x/2 + y/2 and (x+y)/2 will give [b]different[/b] results? I'm trying to see if this is the case in C++.
I was thinking, well suppose x = 5 and y = 2. Suppose the resultant value was represented by int:
x/2 + y/2 = 3 + 1 = 4? (the 2.5 got rounded up to 3)
(x + y) / 2 = (5 + 2) / 2 = 7/2 =3.5 = 4?
See how we get the same number? Is there any cases in which this is not the case?
If both of them are odd, and you're doing integer division, you will get different results:
x = 5, y = 3
x/2 + y/2 = 2 + 1 = 3
(x + y)/2 = 8/2 = 4
What is a good C# syntax book?
What would be the difference between pushing/popping a translation for drawing a cube at a certain position than just modifying the vertices?
[QUOTE=Map in a box;32366236]What would be the difference between pushing/popping a translation for drawing a cube at a certain position than just modifying the vertices?[/QUOTE]
Both produce the same result. 'Just modifying the vertices', however, sounds like a software process, and software is slow. Additionally, it means you have to re-upload the vertex data which uses up bandwidth. When you apply translations to the modelview matrix in ancient super-deprecated fixed-function OpenGL, you're still taking advantage of hardware acceleration and you can leave individual vertex data unmodified.
For something like a single cube, you won't see much of a difference because it's only eight verts, but it adds up on real models.
[editline]19th September 2011[/editline]
Wait. You aren't using glBegin(), glVertex, et al. are you?
Those are [i]really[/i] slow. They really eat through bandwidth.
I seem to be getting lots of errors like this
[code]Error 10 error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in json_vc71_libmtd.lib(json_writer.obj) c:\Users\Richy\documents\visual studio 2010\Projects\msvcprtd.lib(MSVCP100D.dll)
Warning 88 warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library c:\Users\Richy\documents\visual studio 2010\Projects\LINK
[/code]
Since using jsoncpp any Idea what to do?
[QUOTE=ROBO_DONUT;32367304]Both produce the same result. 'Just modifying the vertices', however, sounds like a software process, and software is slow. Additionally, it means you have to re-upload the vertex data which uses up bandwidth. When you apply translations to the modelview matrix in ancient super-deprecated fixed-function OpenGL, you're still taking advantage of hardware acceleration and you can leave individual vertex data unmodified.
For something like a single cube, you won't see much of a difference because it's only eight verts, but it adds up on real models.
[editline]19th September 2011[/editline]
Wait. You aren't using glBegin(), glVertex, et al. are you?
Those are [i]really[/i] slow. They really eat through bandwidth.[/QUOTE]
Haven't done ANYTHING yet, not sure where to start. Doing the beginning of opengl stuff(perspectives, etc) always stop me from doing anything with opengl.
How would I draw a cube in OGL3?
Wondering if there is a way to quickly disable and enable a specific usb port, in c# if possible.
I have a problem with my keyboard which just needs an unplug/plug to fix it.
A nice exe file on my desktop I could macro to a key would be wonderful.
[QUOTE=Map in a box;32367551]Haven't done ANYTHING yet, not sure where to start. Doing the beginning of opengl stuff(perspectives, etc) always stop me from doing anything with opengl.
How would I draw a cube in OGL3?[/QUOTE]
While the programmable pipeline is far cleaner and more powerful, it also requires more boilerplate. You'd need to write a vertex shader and a fragment shader, compile both into a shader program, upload your vertex attribute data to VBO, bind it to a vertex attribute object (VAO), then you can finally draw the cube with glDrawArrays (or glDrawElements if you want to draw by index).
That being said, you don't have to use GL3 to draw your entire model in one or two calls. glVertexPointer and glDrawArrays have existed since OpenGL 1.1 (and VBOs since 1.5). Don't ask me why all the old tutorials teach immediate mode, it really doesn't make any sense at all.
[QUOTE=sim642;32358637]
[QUOTE=VGS_Devs;32358520]A generic content loading system for my iPhone games engine.
Hit a snag though! Does anyone know how to do method level templates in C++(<- hand rolled definition)
I'd like to be able to do:
[cpp]m_contentManager->Load<Texture2D>("FilePath");
m_contentManager->Load<Mesh3D>("FilePath");[/cpp]
Coming from a C# world I thought it would be easier but i'm kinda stumped.[/QUOTE]
It's called template specialization.
[/QUOTE]
Instead you could use interfaces so Texture2D, Mesh3D, or any content providers and define a set of functions (like IContentProvider::Load). That means no template specialization so when you add some new content provider (like Sound/Audio) you just define the class and don't have to worry about a function in another file.
[QUOTE=Drak_Thing;32361618]What's the best way to access other classes data? I'm working with wxWidgets, incase this API offers a better way.
Here's my issue (that i've run into alot, with general C++ programming).
My issue with this, is that everything I do must be "public" which I can see causing problems down the line.
[b]File1.cpp[/b]
[cpp]
class SomeClass
{
public:
int *m_iPointer;
};
extern SomeClass *myGlobalPointer;
[/cpp]
In "File2.cpp" I need to access "m_iPointer" this is how I do it now:
[b]File2.cpp[/b]
[cpp]
somefunc()
{
myGlobalPointer->m_iPointer;
}
[/cpp]
When coding with any API (sfml/sdl/wxwidgets) I always have a "main/master" class that's exposed to a global object, and I access everything from there.
Is this *okay*? or if there's really no other way? Also, does wxWidgets provide me a better way? I know the event system, but that doesn't help to much.
Thanks![/QUOTE]
Make em' [URL="http://www.cplusplus.com/doc/tutorial/inheritance/"]friends[/URL].
[QUOTE=reevezy67;32367625]Wondering if there is a way to quickly disable and enable a specific usb port, in c# if possible.
I have a problem with my keyboard which just needs an unplug/plug to fix it.
A nice exe file on my desktop I could macro to a key would be wonderful.[/QUOTE]
You're going to have to use PInvoke. Look into device management in Win32.
[QUOTE=DevBug;32368485]Make em' [URL="http://www.cplusplus.com/doc/tutorial/inheritance/"]friends[/URL].[/QUOTE]
Be careful with this, actually. Friends make sense in certain circumstances, however if something is accessed in many places there is no need to use friends. Use the accessor/mutators as I mentioned.
[url="http://www.parashift.com/c++-faq-lite/friends.html#faq-14.2"]This FAQ does a good job explaining it.[/url]
[QUOTE=Richy19;32367411]I seem to be getting lots of errors like this
[code]Error 10 error LNK2005: "public: virtual __thiscall std::basic_streambuf<char,struct std::char_traits<char> >::~basic_streambuf<char,struct std::char_traits<char> >(void)" (??1?$basic_streambuf@DU?$char_traits@D@std@@@std@@UAE@XZ) already defined in json_vc71_libmtd.lib(json_writer.obj) c:\Users\Richy\documents\visual studio 2010\Projects\msvcprtd.lib(MSVCP100D.dll)
Warning 88 warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:library c:\Users\Richy\documents\visual studio 2010\Projects\LINK
[/code]
Since using jsoncpp any Idea what to do?[/QUOTE]
[url]http://stackoverflow.com/questions/4917592/compiling-and-using-jsoncpp-on-visual-studio10-with-boost/4918008#4918008[/url]
[QUOTE=SupahVee;32352621]Couldn't you use only the audio part of SFML.NET?[/QUOTE]
Yeah, that might be a possibility, but to be honest, I'm really getting sick of the C# port of SFML, so now I'm using this...
[QUOTE=Zeonho;32354469]You could use OpenAL: [url]http://www.opentk.com/doc/audio[/url]
License: [url]http://www.opentk.com/project/license[/url][/QUOTE]
Thanks! :smile:
-removed-
[highlight](User was permabanned for this post ("Bot" - Craptasket))[/highlight]
What is this error supposed to mean?
[code]Inconsistent accessibility: field type 'System.Collections.Generic.List<NewLand.terrain.TerrainPiece>' is less accessible than field 'NewLand.terrain.Terrain.terrainPieces'
[/code]
I have this which errors:
[code]public List<TerrainPiece> terrainPieces;[/code]
Having trouble in AS3.0, I made an eye following the cursor, it works but it moves freely in the page, and I have to make it so it only moves within an oval. Haven't figure out how yet.
What would be the best way to handle random NPC movement? I'm trying to make it so that my enemy NPC will just fly around randomly (pausing every so often) untill the player gets close enough to it.
[QUOTE=Jcorp;32374863]What would be the best way to handle random NPC movement? I'm trying to make it so that my enemy NPC will just fly around randomly (pausing every so often) untill the player gets close enough to it.[/QUOTE] Generate a random path for it to move and once it has moved that path, stop the movement and generate a new path. In the same time, check is the player close and if is, do what you wish,
[QUOTE=Funley;32373876]What is this error supposed to mean?
[code]Inconsistent accessibility: field type 'System.Collections.Generic.List<NewLand.terrain.TerrainPiece>' is less accessible than field 'NewLand.terrain.Terrain.terrainPieces'
[/code]
I have this which errors:
[code]public List<TerrainPiece> terrainPieces;[/code][/QUOTE]
You've given the List a generic of <TerrainPiece>, but you've assigned terrainPieces something which cannot possibly exist in TerrainPiece's parameters.
Sorry, you need to Log In to post a reply to this thread.