[QUOTE=Nikita;36757996]Question, is there a way to define a type in C++ that would store [i]exactly[/i] N bytes?
Also, if I do "typdef unsigned char dword[4]", can I use it as if it were an unsigned int, and not an array?[/QUOTE]
Yes, just cast the array pointer into an Uint32 pointer.
[editline]14th July 2012[/editline]
Gah, thought the last post of the previous page was the last post of the thread. :(
[QUOTE=ief014;36763019]Yes, just cast the array pointer into an Uint32 pointer.
[editline]14th July 2012[/editline]
Gah, thought the last post of the previous page was the last post of the thread. :([/QUOTE]
adding to this:
uint8_t
uint16_t
uint32_t
uint64_t
[b][i]use them[/i][/b]
-snip-
What would be the best solution if I want a C++ project that compiles on both Windows (Visual Studio) and Linux (Makefiles and GCC)? Some project I've seen just maintain both a .vcxproj file and a Makefile, but wouldn't that be a bit annoying to keep in sync? And I guess you'd eventually forget to add a file to the other platform's build system.
[QUOTE=ArgvCompany;36766030]What would be the best solution if I want a C++ project that compiles on both Windows (Visual Studio) and Linux (Makefiles and GCC)? Some project I've seen just maintain both a .vcxproj file and a Makefile, but wouldn't that be a bit annoying to keep in sync? And I guess you'd eventually forget to add a file to the other platform's build system.[/QUOTE]
the ideal solution is to get the makefiles to work on windows
[QUOTE=swift and shift;36766051]the ideal solution is to get the makefiles to work on windows[/QUOTE]
Do I have to switch the compiler out for GCC then? Or can I get makefiles to work with the VC++ compiler?
[QUOTE=ArgvCompany;36766104]Do I have to switch the compiler out for GCC then? Or can I get makefiles to work with the VC++ compiler?[/QUOTE]
just use somethink like premake
[QUOTE=ArgvCompany;36766104]Do I have to switch the compiler out for GCC then? Or can I get makefiles to work with the VC++ compiler?[/QUOTE]
in theory you can change the CC variable to either gcc or cl.exe depending on the platform, and then you could change CFLAGS to suit the syntax of either compiler
whether this plays out nicely for you in practise is another thing
[QUOTE=Richy19;36766218]just use somethink like premake[/QUOTE]
I've looked it up now, and it looks like it suits my needs. Just asking though, are there any drawbacks to using it compared to using standard makefiles and such?
[QUOTE=ArgvCompany;36766285]I've looked it up now, and it looks like it suits my needs. Just asking though, are there any drawbacks to using it compared to using standard makefiles and such?[/QUOTE]
it's yet another thing you have to deal with
[QUOTE=swift and shift;36766459]it's yet another thing you have to deal with[/QUOTE]
I suppose, but getting makefiles to work with Windows is also something to deal with, isn't it?
This post is not really asking for help on a concept, just an opinion. I just got my score from APCS and got the 5 so I'm skipping 2 semesters of CS in college in which one of the classes teaches python. Now I don't even know anything about the syntax of python, but I think the classes I will be going to will refer back to python on certain topics. Do you think just watching some of the videos on Khan Academy would suffice for knowing the basics of the language? Or would there be a better way to just get a quick summary of the language?
Does anybody have a suggestion for a guide on programming with C# with unity? I can only find one and it only shows you one thing (a 3D clock thing)
[QUOTE=ArgvCompany;36766030]What would be the best solution if I want a C++ project that compiles on both Windows (Visual Studio) and Linux (Makefiles and GCC)? Some project I've seen just maintain both a .vcxproj file and a Makefile, but wouldn't that be a bit annoying to keep in sync? And I guess you'd eventually forget to add a file to the other platform's build system.[/QUOTE]
Could just switch to Code::Blocks, right? Or another cross-platform IDE.
[QUOTE=ECrownofFire;36778371]Could just switch to Code::Blocks, right? Or another cross-platform IDE.[/QUOTE]
I suppose I could, but I much prefer Visual Studio to it.
[editline]15th July 2012[/editline]
[QUOTE=W00tbeer1;36769863]This post is not really asking for help on a concept, just an opinion. I just got my score from APCS and got the 5 so I'm skipping 2 semesters of CS in college in which one of the classes teaches python. Now I don't even know anything about the syntax of python, but I think the classes I will be going to will refer back to python on certain topics. Do you think just watching some of the videos on Khan Academy would suffice for knowing the basics of the language? Or would there be a better way to just get a quick summary of the language?[/QUOTE]
If you already know another programming language just read [URL=http://docs.python.org/]the official documentation[/URL]
I'm looking for a good tutorial for rendering skinned meshes, OpenGL would be good but I'm mainly looking for the maths I need for a weighted mesh and relative bone positions/angles.
I've been working on a "BIT.TRIP BEAT" Clone and was wondering... How would you guys save the file.
Essentially I need to store
- Location
- Speed
- Note (A, Ab, D# etc.)
Is there anything wrong with my matricies?
[cpp]
glm::mat4 P = glm::perspective(75.0f, App.getSize().x/(float)App.getSize().y, 0.1f, 50.0f);
glm::mat4 V = glm::lookAt( glm::vec3(0,0,5), glm::vec3(0), glm::vec3(0,1,0));
glm::mat4 O = glm::ortho(0.0f ,(float)App.getSize().x ,(float)App.getSize().y, 0.0f, -1.0f , 1.0f);
glm::mat4 PV = P * V;
glm::mat4 OV = O * V;
Model = glm::translate(glm::mat4(1.0f),Pos.x , Pos.y, 0.0f);
glm::mat4 MVP = O * Model;
[/cpp]
[QUOTE=Richy19;36787746]Is there anything wrong with my matricies?
[cpp]
glm::mat4 P = glm::perspective(75.0f, App.getSize().x/(float)App.getSize().y, 0.1f, 50.0f);
glm::mat4 V = glm::lookAt( glm::vec3(0,0,5), glm::vec3(0), glm::vec3(0,1,0));
glm::mat4 O = glm::ortho(0.0f ,(float)App.getSize().x ,(float)App.getSize().y, 0.0f, -1.0f , 1.0f);
glm::mat4 PV = P * V;
glm::mat4 OV = O * V;
Model = glm::translate(glm::mat4(1.0f),Pos.x , Pos.y, 0.0f);
glm::mat4 MVP = O * Model;
[/cpp][/QUOTE]
They look fine to me (although I'm far from experienced in GL) But I would recommend you use divide as little as possible, it takes much longer to do 1/4 than it does to do 1*0.25
Figured out its not the matricies, SFML produces glyphs of a font on a transparent texture but my program doesnt seem to be treating it as transparent.
this is my gl settings
[cpp]
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);[/cpp]
and this is the shader code
[cpp]
#version 120
varying vec2 uv;
uniform sampler2D Texture;
uniform vec4 Color;
void main()
{
vec4 textur = texture2D( Texture, uv ).rgba;
textur.rgb = Color.rgb;
if(textur.a == 0.0f){
textur = vec4(0.0f, 0.0f, 0.0f, 0.0f);
}
gl_FragColor = textur;
}
[/cpp]
[QUOTE=Richy19;36793805]Figured out its not the matricies, SFML produces glyphs of a font on a transparent texture but my program doesnt seem to be treating it as transparent.
this is my gl settings
[cpp]
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);[/cpp]
and this is the shader code
[cpp]
#version 120
varying vec2 uv;
uniform sampler2D Texture;
uniform vec4 Color;
void main()
{
vec4 textur = texture2D( Texture, uv ).rgba;
textur.rgb = Color.rgb;
if(textur.a == 0.0f){
textur = vec4(0.0f, 0.0f, 0.0f, 0.0f);
}
gl_FragColor = textur;
}
[/cpp][/QUOTE]
Try just discarding the fragments if they're below a certain threshold (aka not exactly equal to 0.0f).
[QUOTE=Overv;36796762]Try just discarding the fragments if they're below a certain threshold (aka not exactly equal to 0.0f).[/QUOTE]
Didnt work, but surelly if the image has some transparency then it should draw it as transparent regardless of the shader?
[editline]16th July 2012[/editline]
If I draw the hole image via:
[cpp]for(int i = 0; i < text.length(); i++)
{
sf::Glyph g = font.getGlyph(text[i], siz, false);
//Positions.push_back(g.textureRect);
Positions.push_back(sf::IntRect(0,0,128,128));
}
bitmap = font.getTexture( siz );
[/cpp]
it draws fine.
I did wondr if glyph.textureRect() could numbers in a 0 - 1 scale and not pixels but I cout'ed and it does output in pixels...
Javascript:
How can I pass a variable in a for loop to a function that won't be called till the for loop is already over?
[QUOTE=vexx21322;36797232]Javascript:
How can I pass a variable in a for loop to a function that won't be called till the for loop is already over?[/QUOTE]
var v = 0;
forloop{
v = something;
}
function(v);
[QUOTE=Richy19;36798935]var v = 0;
forloop{
v = something;
}
function(v);[/QUOTE]
Forgot to mention that the function is created in the loop.
And this wouldn't work anyways because the value would be the last of the loop before it's sent to the function.
[QUOTE=vexx21322;36802004]Forgot to mention that the function is created in the loop.
And this wouldn't work anyways because the value would be the last of the loop before it's sent to the function.[/QUOTE]
can you post your current code
[editline]17th July 2012[/editline]
Is there anyway to remove momentum from certain box2d objects? I want to have a top down player but have him stop moving when the player stops holding the move key
What's the best way to hide a console window without changing the project to a windows forms application?
I made a console app that takes a -silent argument but everything I've tried to hide the window still shows the console window briefly before hiding it.
[editline]17th July 2012[/editline]
Probably should add I'm using C# :v
[QUOTE=vexx21322;36802004]Forgot to mention that the function is created in the loop.
And this wouldn't work anyways because the value would be the last of the loop before it's sent to the function.[/QUOTE]
That's what closures are for.
[cpp]for ( ... )
{
foo[i] = ( function( i ) {
return function()
{
// do something with i
}
} )( i );
}[/cpp]
Anyone know any good software for planning code? You know like class diagrams n' shit. Would be great if you knew some.
Sorry, you need to Log In to post a reply to this thread.