I'm new with Java and I'm having trouble distinguishing between mutable and immutable things. For our most recent assignment my professor wants us to make deep copies of anything mutable, and I thought I did it right but apparently I didn't make deep copies of anything in the majority of my program. We aren't allowed to get help on the assignment specifically, but I was wondering if someone could help me out with determining what is or isn't mutable?
i need some help.
Im learning and programing on C(and sometimes on arduino processing).
But all of my programs which are written in C, haven't got any GUI. It is just "cmd box", i don't know how to make buttons, or drawing graphics. I will be really happy if i get some help from my fellow FP. I want to make 2d games and this type of things, but i thing first i need to learn how to make button and draw square, i hope you got my problem.
Find a GUI library.
I don't know what's good for plain old C, but they're out there.
Im rendering a 3D "maze" in XNA, but something is terribly wrong.
[thumb]http://i.imgur.com/zp2oA.png[/thumb] (if you cant see it, imgur sucks at the moment, but its supposed to show walls at a distance are on top of walls that are closer to the camera.
The rendering is fine though when i look at the opposite direction.
Im using this code to render it
[code]effect.CurrentTechnique = effect.Techniques["Textured"]; effect.Parameters["xWorld"].SetValue(Matrix.Identity);
effect.Parameters["xView"].SetValue(mViewMatrix);
effect.Parameters["xProjection"].SetValue(mProjectionMatrix);
effect.Parameters["xTexture"].SetValue(sceneryTexture);
foreach (EffectPass pass in effect.CurrentTechnique.Passes)
{
pass.Apply();
device.SetVertexBuffer(mapVertexBuffer);
device.DrawPrimitives(PrimitiveType.TriangleList, 0, mapVertexBuffer.VertexCount / 3);
}[/code]
And im generating the vertices with this code
[code]int currentwall = floorPlan[x, z]; float wallHeight = 1f * currentwall;
if (currentwall != 0)
{
//front wall
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, 0, -z - 1), new Vector3(0, 0, -1), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z - 1), new Vector3(0, 0, -1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, 0, -z - 1), new Vector3(0, 0, -1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z - 1), new Vector3(0, 0, -1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, 0, -z - 1), new Vector3(0, 0, -1), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, wallHeight, -z - 1), new Vector3(0, 0, -1), new Vector2((currentwall * 2) / imagesInTexture, 0)));
//back wall
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, 0, -z), new Vector3(0, 0, 1), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, 0, -z), new Vector3(0, 0, 1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z), new Vector3(0, 0, 1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z), new Vector3(0, 0, 1), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, wallHeight, -z), new Vector3(0, 0, 1), new Vector2((currentwall * 2) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, 0, -z), new Vector3(0, 0, 1), new Vector2((currentwall * 2) / imagesInTexture, 1)));
//left wall
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, 0, -z), new Vector3(-1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, 0, -z - 1), new Vector3(-1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z - 1), new Vector3(-1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z - 1), new Vector3(-1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z), new Vector3(-1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, 0, -z), new Vector3(-1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 1)));
//right wall
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, 0, -z), new Vector3(1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, wallHeight, -z - 1), new Vector3(1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, 0, -z - 1), new Vector3(1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, wallHeight, -z - 1), new Vector3(1, 0, 0), new Vector2((currentwall * 2 - 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, 0, -z), new Vector3(1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, wallHeight, -z), new Vector3(1, 0, 0), new Vector2((currentwall * 2) / imagesInTexture, 0)));
}
//floor or ceiling
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z), new Vector3(0, 1, 0), new Vector2(currentwall * 2 / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z - 1), new Vector3(0, 1, 0), new Vector2((currentwall * 2) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, wallHeight, -z), new Vector3(0, 1, 0), new Vector2((currentwall * 2 + 1) / imagesInTexture, 1)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x, wallHeight, -z - 1), new Vector3(0, 1, 0), new Vector2((currentwall * 2) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, wallHeight, -z - 1), new Vector3(0, 1, 0), new Vector2((currentwall * 2 + 1) / imagesInTexture, 0)));
verticesList.Add(new VertexPositionNormalTexture(new Vector3(x + 1, wallHeight, -z), new Vector3(0, 1, 0), new Vector2((currentwall * 2 + 1) / imagesInTexture, 1)));
}
}
mapVertexBuffer = new VertexBuffer(device, VertexPositionNormalTexture.VertexDeclaration, verticesList.Count, BufferUsage.WriteOnly);
mapVertexBuffer.SetData<VertexPositionNormalTexture>(verticesList.ToArray());[/code]
-snip-
I need to get back into fixing up my site, does anyone know any free database designers?
Can someone help me with my "Unresolved External Symbols" problem? I'm almost sure it has to do with linking FMOD libs.
I linked in Visual Basic here: E:\FMOD Programmers API Windows\api\lib in Config Properties/Linker/Additional Library Directories.
For a component based system, I have the behavior "draw". Basically, it controls whether a object will be drawn or not. The problem is that if I let items be drawn whenever they are updated, then I would have to clear the screen before any processing is done, and then let things draw and then display them. The problem is that all the processing time is between steps 1 and 3 (since I have to update) and as soon as anything is displayed it is cleared again. Should I make the draw behavior send info to a stack and then draw based on the things from that stack?
[QUOTE=Meatpuppet;35775305]Can someone help me with my "Unresolved External Symbols" problem? I'm almost sure it has to do with linking FMOD libs.
I linked in Visual Basic here: E:\FMOD Programmers API Windows\api\lib in Config Properties/Linker/Additional Library Directories.[/QUOTE]
[URL="http://stackoverflow.com/questions/4066405/when-to-use-the-visual-studio-additional-dependencies"]See this[/URL] (you have to specify the actual library in Linker => Input => Additional dependencies.)
I've got a project for game development using pygames that is due this wednesday. I'm having a few problems with laggy code and I don't understand some stuff. It's awfully large to post here so if someone is very fluent in python can you add me on steam really quick?
[QUOTE=shill le 2nd;35775683][URL="http://stackoverflow.com/questions/4066405/when-to-use-the-visual-studio-additional-dependencies"]See this[/URL] (you have to specify the actual library in Linker => Input => Additional dependencies.)[/QUOTE]
I'm still not sure on if I'm doing this right; it still gives me the errors. Where do I link the .dlls?
[QUOTE=Funley;35772492]Im rendering a 3D "maze" in XNA, but something is terribly wrong.
[thumb]http://i.imgur.com/zp2oA.png[/thumb] (if you cant see it, imgur sucks at the moment, but its supposed to show walls at a distance are on top of walls that are closer to the camera.
The rendering is fine though when i look at the opposite direction.
Im using this code to render it
[code]-codesnip-[/code][/QUOTE]
Make sure you have depth testing enabled. If you do, then you have your depth function mixed up, try LEQUAL (whatever the DX equivalent for that is)
Ugh. I'm getting fed up with Awesomium. It asks for the virtual-key of keys pressed and I go out on a limb and give it that. It returns the following in favor: no keys like ./+/- punch in right (+ becomes 1/4th, etc.), all letters are in capitals, etc.
Here's my code:
[cpp]
void CWebView::InjectKeypress(int vkey, bool down)
{
if(down)
{
if(vkey == 'c')
awe_webview_copy(m_pWebView);
awe_webkeyboardevent keyEvent;
if(ConvertKeyFromVK(vkey, keyEvent))
{
keyEvent.type = AWE_WKT_KEYDOWN;
awe_webview_inject_keyboard_event(m_pWebView, keyEvent);
keyEvent.type = AWE_WKT_CHAR;
keyEvent.text[0] = vkey;
keyEvent.unmodified_text[0] = vkey;
keyEvent.native_key_code = vkey;
keyEvent.virtual_key_code = vkey;
awe_webview_inject_keyboard_event(m_pWebView, keyEvent);
}
}
if(!down)
{
awe_webkeyboardevent keyEvent;
if(ConvertKeyFromVK(vkey, keyEvent))
{
keyEvent.type = AWE_WKT_KEYUP;
awe_webview_inject_keyboard_event(m_pWebView, keyEvent);
}
}
}
bool CWebView::ConvertKeyFromVK( const int virtualKey, awe_webkeyboardevent &keyEvent )
{
if(virtualKey == 0)
return false;
keyEvent.virtual_key_code = virtualKey;
keyEvent.native_key_code = virtualKey;
keyEvent.is_system_key = false;
keyEvent.modifiers = (g_engineInput.KeyIsDown(K_ALT) ? AWE_WKM_ALT_KEY : 0) | (g_engineInput.KeyIsDown(K_CTRL) ? AWE_WKM_CONTROL_KEY : 0) | (g_engineInput.KeyIsDown(K_SHIFT) ? AWE_WKM_SHIFT_KEY : 0);
keyEvent.text[0] = 0;
keyEvent.text[1] = 0;
keyEvent.text[2] = 0;
keyEvent.text[3] = 0;
keyEvent.unmodified_text[0] = 0;
keyEvent.unmodified_text[1] = 0;
keyEvent.unmodified_text[2] = 0;
keyEvent.unmodified_text[3] = 0;
return true;
}
[/cpp]
I do know the modifiers are working, because "ctrl + backspace" backspaces one word at a time, and shift tab moves me backwards in element focus inside the UI. However, this doesn't explain why EVERYTHING ELSE IS BROKEN. :(
[QUOTE=Meatpuppet;35776359]I'm still not sure on if I'm doing this right; it still gives me the errors. Where do I link the .dlls?[/QUOTE]
Hmm, you shouldn't need to link the .dlls; they are by definition "dynamic", which means loaded when the program actually runs. As far as I know, linking fmodex_vc.lib should allow your program to compile, and load fmodex.dll when it runs.
[QUOTE=Lord Ned;35777299]Ugh. I'm getting fed up with Awesomium. It asks for the virtual-key of keys pressed and I go out on a limb and give it that. It returns the following in favor: no keys like ./+/- punch in right (+ becomes 1/4th, etc.), all letters are in capitals, etc.
I do know the modifiers are working, because "ctrl + backspace" backspaces one word at a time, and shift tab moves me backwards in element focus inside the UI. However, this doesn't explain why EVERYTHING ELSE IS BROKEN. :([/QUOTE]
You are using your virtual key code as your character event text.
[QUOTE=Philly c;35779106]You are using your virtual key code as your character event text.[/QUOTE]
I've tried a half dozen variations. It would appear that I have to write my own text/unmodified_text, because all of their examples just use the C++ API (which I of course, can't use (wrong compiler) + wrong lib).
I still don't know how to transmit things like left/right arrow keys, and I have problems transmitting things like "#" - even if I place them as the text (which is what appears to get placed in my Javascript text-boxes), it does weird things - like highlight all.
[b]Edit:[/b]
Their C++ examples also use a lot of "Awesomium::getKeyIdentifierFromVirtualKeyCode(keyEvent.virtualKeyCode, &buf);" - This returns a Ux00 (Or similar, I forgot the exact value, but it can be up to 20char long) value, which the C api doesn't seem to take. My problems probably stem from being unable to use this.
[QUOTE=Lord Ned;35779225]I've tried a half dozen variations. It would appear that I have to write my own text/unmodified_text, because all of their examples just use the C++ API (which I of course, can't use (wrong compiler) + wrong lib).
I still don't know how to transmit things like left/right arrow keys, and I have problems transmitting things like "#" - even if I place them as the text (which is what appears to get placed in my Javascript text-boxes), it does weird things - like highlight all.
[B]Edit:[/B]
Their C++ examples also use a lot of "Awesomium::getKeyIdentifierFromVirtualKeyCode(keyEvent.virtualKeyCode, &buf);" - This returns a Ux00 (Or similar, I forgot the exact value, but it can be up to 20char long) value, which the C api doesn't seem to take. My problems probably stem from being unable to use this.[/QUOTE]
I am not familiar with the getkeyidentifier function but I am guessing if the key code is like back then it outputs "back". I could be wrong though.
I think i've said it before but a key code isn't ascii (or wide char or utf-16 or whatever it is that awesomium wants), so you can't just pass it straight through as text. If you don't want to determine what ascii character yourself based off of the keys pressed, you might want to take WM_CHAR messages which does it for you. Awesomiums api seems to sync up pretty well to the windows messages. When you get WM_KEYDOWN/UP and WM_CHAR, just input the equivalent event to awesomium and it should just work.
[QUOTE=Philly c;35779338]I am not familiar with the getkeyidentifier function but I am guessing if the key code is like back then it outputs "back". I could be wrong though.
I think i've said it before but a key code isn't ascii, so you can't just pass it straight through as text. If you don't want to determine what ascii character yourself based off of the keys pressed, you might want to take WM_CHAR messages which does it for you. Awesomiums api seems to sync up pretty well to the windows messages. When you get WM_KEYDOWN/UP and WM_CHAR, just input the equivalent event to awesomium and it should just work.[/QUOTE]
Looks like I'm wrong, again. (I swear you follow me around and help myself prove I'm wrong)
Looks like their examples use a lookup table -
[cpp]// A helper macro, used in 'getWebKeyFromSDLKey'
#define mapKey(a, b) case SDLK_##a: return Awesomium::KeyCodes::AK_##b;
// Translates an SDLKey virtual key code to an Awesomium key code
int getWebKeyFromSDLKey(SDLKey key)
{
switch(key)
{
mapKey(BACKSPACE, BACK)
mapKey(TAB, TAB)
mapKey(CLEAR, CLEAR)
//AND SO ON
[/cpp]
Maybe they do need a re-mapping. I'll try manually re-mapping everything to Awesomium keys first. And I do understand that I can't transmit straight Virtual Keys to char - but Awesomium acts like that's what it wants.
[QUOTE=Lord Ned;35779374]Looks like I'm wrong, again. (I swear you follow me around and help myself prove I'm wrong)
Looks like their examples use a lookup table -
Maybe they do need a re-mapping. I'll try manually re-mapping everything to Awesomium keys first. And I do understand that I can't transmit straight Virtual Keys to char - but Awesomium acts like that's what it wants.[/QUOTE]
Haha well i'm not just trying to prove you wrong but help you.
You were right about the virtual key codes though. Awesomiums are the same as windows, so for key up and down events you can just use them. That sdl example you posted remaps sdl keys to awesomium keys.
For character input if you want to input "a" then you need to see whether the A key is pressed and whether shift is pressed at the same time. You can't get upper or lower case "A" from the A key alone. I'm not sure how your input works but it's probably better to take these straight from the equivalent windows message like I said before than constantly checking whether every key combo is pressed.
[QUOTE=Philly c;35779494]Haha well i'm not just trying to prove you wrong but help you.
You were right about the virtual key codes though. Awesomiums are the same as windows, so for key up and down events you can just use them. That sdl example you posted remaps sdl keys to awesomium keys.
For character input if you want to input "a" then you need to see whether the A key is pressed and whether shift is pressed at the same time. You can't get upper or lower case "A" from the A key alone. I'm not sure how your input works but it's probably better to take these straight from the equivalent windows message like I said before than constantly checking whether every key combo is pressed.[/QUOTE]
Yeah I'm just writing a huge case with a bunch of redundancy:
mapKeyShift('.', /*Awesomium > equivelent*/);
I'll do that and let you know how it goes.
[b]Edit:[/b]
This is what frustrates me. Even after spending a while writing the giant case switch, basic things still do not work. Returning AK_OEM_PERIOD as their examples suggest produces a curvey x shape instead of a "."
I'm just frustrated as fuck that it works for them but not for me. It seems totally irrelevent of everything I put in everything but .text[0]. Maybe those are just straight up final ASCII values I should fill?
[b]Edit:[/b]
Hell, their example just uses SDL's "pre-translated" value for the text[0]. I guess I get to write myself another bloody lookup table.'
[b]Edit again:[/b]
So the new lookup table goes great until I hit '#'. As soon as I set the .text[0] / .unmodified_text[0] t= 35 ('#'), it does NOT put it into the UI.
If I punch in a Awesomium::KeyCodes::AK_3 with a shift modifier (which I know works), I still get '3' Instead of '#'.
(╯°□°)╯︵ ┻━┻
[img]http://puu.sh/snBs[/img]
Does anyone know how to get rid of this black wall? It's annoying since I want to see my whole level.
[QUOTE=Staneh;35782839]Does anyone know how to get rid of this black wall? It's annoying since I want to see my whole level.[/QUOTE]
Set the far clipping plane to something larger in your projection matrix.
[QUOTE=bean_xp;35782866]Set the far clipping plane to something larger in your projection matrix.[/QUOTE]
Thanks.
[QUOTE=Lord Ned;35779546]I'm just frustrated as fuck that it works for them but not for me. It seems totally irrelevent of everything I put in everything but .text[0]. Maybe those are just straight up final ASCII values I should fill?[/QUOTE]
Yeah that's what I was trying to say. Sorry if I wasn't clear. You only need the final text for the character event. I think you should use WM_CHAR instead of doing it yourself. When you get WM_KEYDOWN messages it automatically sends a WM_CHAR message if the keys you pressed create one.
Got one more small problem, when I want to draw a big model, an exported WMO from WoW, it turns like, halfblack: [img]http://puu.sh/so64[/img]
I have no idea why this is happening, the textures are all normal.
Does anyone here have an experience with the Minecraft Classic protocol? I'm writing a basic chat client, and I understand how to login and send chat and all that, I just don't understand how to get the IP address to connect to from the classic URL (eg. [url]http://www.minecraft.net/classic/play/69c17964f6454865d011c5c946a4961c[/url]). I've tried Base62 and Base64 decoding the end bit, but I can't seem to get the IP of the server so that I can open a connection and authenticate and all that jazz.
Anyone have any ideas?
[QUOTE=Philly c;35783262]Yeah that's what I was trying to say. Sorry if I wasn't clear. You only need the final text for the character event. I think you should use WM_CHAR instead of doing it yourself. When you get WM_KEYDOWN messages it automatically sends a WM_CHAR message if the keys you pressed create one.[/QUOTE]
I converted over to using WM_CHAR instead of WM_KEYDOWN and I can finally type in 0-9, !-), a-z, etc. It's a Christmas miracle!
I don't get arrow keys/backspace obviously (no WM_CHAR is generated), so I'll have to figure out how to shoe-horn in those.
Hey i've been having some trouble with Sublime text 2 saving line terminations as \r.
Every time I upload them to my server i have to do a ":set fileformat=unix" through vim which gets annoying. I even set the preferences in Sublime to save as "unix" format but it still does bugger all!
Any help?
I still have the unresolved external symbols error.
In Config Propertires/C++/General/Additional Include Directories - FMOD Programmers API Windows/api/inc
In Linker/Additional Dependencies - fmodexL64_vc.dll
In Linker/Additional Library Directories - FMOD Programmers API Windows/api/lib
[QUOTE=Meatpuppet;35786070]I still have the unresolved external symbols error.
In Config Propertires/C++/General/Additional Include Directories - FMOD Programmers API Windows/api/inc
In Linker/Additional Dependencies - fmodexL64_vc.dll
In Linker/Additional Library Directories - FMOD Programmers API Windows/api/lib[/QUOTE]
No, I told you [i]not[/i] to the link the .dll; link the .lib instead.
EDIT: is that really .dll or did you make a typo? I can't even find an fmodexL64_vc.dll in my FMOD; only fmodexL64_vc.lib (which is what you should be linking) and fmodexL64.dll (none of the DLLs have a "vc" suffix because they get loaded at runtime, which makes them compiler-agnostic)
EDIT2: And are you sure you should be using the 64-bit lib?
Sorry, you need to Log In to post a reply to this thread.