• What do you need help with? Version 1
    5,001 replies, posted
[QUOTE=Chad Mobile;20810329]Ok, I will try to figure this out :)[/QUOTE] I don't know if you're still having a problem with this, but this should work. [code] If PictureBox1.Location.X <= Me.Width Then PictureBox1.SetBounds(PictureBox1.Location.X - 50, PictureBox1.Location.Y, PictureBox1.Width, PictureBox1.Height) End If[/code] That's only going to work if the picturebox is moved to the very right of the form though, the rest you should be able to tinker out yourself.
I have a jar file for my java game, but I can't for the love of god/satan/hamburgers figure out how to access resources within the same jar. Anyone know how to do this?
[QUOTE=ralle105;21617282]I have a jar file for my java game, but I can't for the love of god/satan/hamburgers figure out how to access resources within the same jar. Anyone know how to do this?[/QUOTE] In case you still haven't found out, and I'm not misunderstanding what you're trying to do. [url]http://java.sun.com/j2se/1.3/docs/api/java/lang/Class.html#getResource(java.lang.String[/url]) In object type Class, the method getResource("/resource.blah") would return resource.blah, supposedly. Unless I'm misunderstanding what you're trying to ask. [editline]10:28PM[/editline] Oh, and the root directory of the jar is "/", I'm sure you could guess that. [url]http://forums.sun.com/thread.jspa?threadID=278932[/url] A little more information I found.
I'm having a problem deciding if a ball should roll clockwise or counter-clockwise when it's hitting a rotated block in a 2D environment. Don't even know where to start. Deciding how fast it should roll isn't a problem (length of the velocity vector). [b]Edit:[/b] Solved it.
I was thinking about rendering 3d terrain and then my head got stuck on rendering caves, I mean most rendering engine's use heightmaps but they don't allow caves ?
Maybe use multiple layers, like 3 or 4 heightmaps for various layers of the terrain? I don't know
My C# WinForms UserControl won't draw. It's pretty basic, so here's the code: [cpp] public class TestControl : UserControl { protected override void OnPaint(PaintEventArgs e) { e.Graphics.DrawEllipse(Pens.White, Location.X, Location.Y, Size.Width, Size.Height); } }[/cpp] Creation: [cpp] TestControl tc = new TestControl(); tc.Location = new Point(5, 5); tc.Size = new Size(50, 50); Controls.Add(tc);[/cpp] If I change the class to inherit from to Button, it draws (a black rectangle with a part of white circle). According to [url=http://ondotnet.com/pub/a/dotnet/2002/03/18/customcontrols.html]this Tutorial[/url], the OnPaint-function is all I need to override. Am I doing something wrong or is that tutorial outdated? Not sure if this is important, but I'm on Windows 7 and I'm using Mono.
[QUOTE=quincy18;21628170]I was thinking about rendering 3d terrain and then my head got stuck on rendering caves, I mean most rendering engine's use heightmaps but they don't allow caves ?[/QUOTE] Correct. AFAIK, most games fake it by making caves out of entities (i.e. make a cave model and place it in a dent in the height map). Or you teleport the player to another map when they enter the cave (like in Oblivion or Fallout 3).
My code still has problems. [code] int identification[]; identification = new int[1]; identification[0] = 1 [/code] Error: [code] H:\5-8\Chapter07\HFCHD.java:33: <identifier> expected identification = new int[1]; ^ H:\5-8\Chapter07\HFCHD.java:34: ']' expected identification[0] = 1; ^ H:\5-8\Chapter07\HFCHD.java:34: ';' expected identification[0] = 1; ^ H:\5-8\Chapter07\HFCHD.java:34: illegal start of type identification[0] = 1; ^ H:\5-8\Chapter07\HFCHD.java:34: <identifier> expected identification[0] = 1; ^ 5 errors Tool completed with exit code 1 [/code]
[QUOTE=WastedJamacan;21631801]My code still has problems. [code] int identification[]; identification = new int[1]; identification[0] = 1 [/code] Error: [code] H:\5-8\Chapter07\HFCHD.java:33: <identifier> expected identification = new int[1]; ^ H:\5-8\Chapter07\HFCHD.java:34: ']' expected identification[0] = 1; ^ H:\5-8\Chapter07\HFCHD.java:34: ';' expected identification[0] = 1; ^ H:\5-8\Chapter07\HFCHD.java:34: illegal start of type identification[0] = 1; ^ H:\5-8\Chapter07\HFCHD.java:34: <identifier> expected identification[0] = 1; ^ 5 errors Tool completed with exit code 1 [/code][/QUOTE] You placed the brackets wrong. [code]int[] identification;[/code]
[QUOTE=noctune9;21632222]You placed the brackets wrong. [code]int[] identification;[/code][/QUOTE] Bracket placement means nothing.
Normal i never ask for help on debugging but this is strange [code] #include <windows.h> // include the basic windows header file // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { // create a "Hello World" message box using MessageBox() MessageBox(NULL, L"Hello World!", L"Just another Hello World program!", MB_ICONEXCLAMATION | MB_OK); // return 0 to Windows return 0; } [/code] [code] main.cpp(13) : error C2664: 'MessageBoxA' : cannot convert parameter 2 from 'const wchar_t [13]' to 'LPCSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast [/code] Msgbox [url]http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx[/url] my code is fully correct following the msdn. I have no clue why it askes for a "LPCSTR" wich is a "Long Pointer to Constant STRing" and is some kind of 16bit OS left over string.
Not in java between int and arrayname, atleast [editline]01:24PM[/editline] Dammit, my automerge was stolen
[QUOTE=WastedJamacan;21632293]Bracket placement means nothing.[/QUOTE] Ah, didn't know that.
[QUOTE=ColdFusion;21632308]Normal i never ask for help on debugging but this is strange [code] #include <windows.h> // include the basic windows header file // the entry point for any Windows program int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { // create a "Hello World" message box using MessageBox() MessageBox(NULL, L"Hello World!", L"Just another Hello World program!", MB_ICONEXCLAMATION | MB_OK); // return 0 to Windows return 0; } [/code] [code] main.cpp(13) : error C2664: 'MessageBoxA' : cannot convert parameter 2 from 'const wchar_t [13]' to 'LPCSTR' Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast [/code] Msgbox [url]http://msdn.microsoft.com/en-us/library/ms645505(VS.85).aspx[/url] my code is fully correct following the msdn. I have no clue why it askes for a "LPCSTR" wich is a "Long Pointer to Constant STRing" and is some kind of 16bit OS left over string.[/QUOTE] The problem is that LPCSTR is a string with 8-bit characters, while the L prefix to string literals makes it a wide string of 16-bit characters (wchar_t). Remove the L or use MessageBoxW.
[QUOTE=jA_cOp;21632532]The problem is that LPCSTR is a string with 8-bit characters, while the L prefix to string literals makes it a wide string of 16-bit characters (wchar_t). Remove the L or use MessageBoxW.[/QUOTE] Thank you sweety
[QUOTE=WastedJamacan;21631801]My code still has problems. --large quote snip--[/QUOTE] Could you post the complete file?
My mouse has a bunch of extra buttons, one of which can be mapped to "pause player", and it comes in handy when I have a full screen application. Unfortuantly it doesn't work with all players. I was thinking about capturing process and sending it some sort of function, but not sure what. Ideas?
[QUOTE=ZeekyHBomb;21630012]My C# WinForms UserControl won't draw. It's pretty basic, so here's the code: [cpp] public class TestControl : UserControl { protected override void OnPaint(PaintEventArgs e) { e.Graphics.DrawEllipse(Pens.White, Location.X, Location.Y, Size.Width, Size.Height); } }[/cpp] Creation: [cpp] TestControl tc = new TestControl(); tc.Location = new Point(5, 5); tc.Size = new Size(50, 50); Controls.Add(tc);[/cpp] If I change the class to inherit from to Button, it draws (a black rectangle with a part of white circle). According to [url=http://ondotnet.com/pub/a/dotnet/2002/03/18/customcontrols.html]this Tutorial[/url], the OnPaint-function is all I need to override. Am I doing something wrong or is that tutorial outdated? [/QUOTE] Try calling Invalidate() on the control and see if it draws then. [quote]Windows ... Mono.[/QUOTE] why..?
Anyone care to help me with some basic 3d movement, I tried making a fp camera here is the result : [cpp] public void Update(GamePadState state) { yaw -= state.ThumbSticks.Right.Y; pitch += state.ThumbSticks.Right.X; float yawR = MathHelper.ToRadians(yaw); float pitchR = MathHelper.ToRadians(pitch); Vector3 cameraForward = Vector3.Normalize( new Vector3((float)Math.Sin(-yawR), (float)Math.Sin(pitchR), (float)Math.Cos(-yawR) ) ); Vector3 cameraLeft = Vector3.Normalize( new Vector3( (float)Math.Cos(yawR), 0f, (float)Math.Sin(yawR) ) ); position -= state.ThumbSticks.Left.Y * cameraForward; position -= state.ThumbSticks.Left.X * cameraLeft; viewMatrix = Matrix.Identity; viewMatrix *= Matrix.CreateTranslation(-position); viewMatrix *= Matrix.CreateRotationY(pitchR); viewMatrix *= Matrix.CreateRotationX(yawR); } [/cpp] For some reason it isn't moving to the right direction.
[QUOTE=turb_;21644427]Try calling Invalidate() on the control and see if it draws then.[/QUOTE] It does, thanks :) [edit]Actually drawing a white circle on a very bright background is not a good idea... Works without Invalidate :S[/edit] [QUOTE=turb_;21644427]why..?[/QUOTE] Why not :D I can't spot any drawbacks (unless if I wanted to use yet unimplemented features). This way I'll also not get any incompatibilities when porting :3
Is it possible to have a get accessor on the class, not on it's property so when I want to get one instance of that class the get {} function is called? I have a Point class that stores X and Y values and I want to be able to do point1 = point2 without them both referencing the same point. I know I could use structs but if it's possible to do it with classes please tell me.
Why do you not want to use a struct? A struct is perfect for a small, simple data structure like a point.
Can you tell me the upsides/downsides of a struct? I've only dealt with classes in C# so I'm trying to stick with what is familiar. I might add a lot more functions to it later, so is there a way to do what I said with classes?
Structs are lighter but don't have inheritance (though they inherit from Object, and interfaces are supported). They're usually faster to deal with because they can be allocated on the stack. They have copy semantics as they are value types, not reference types (which has a positive effect on performance for small types [url=http://msdn.microsoft.com/en-us/library/ah19swz4(VS.71).aspx]less than 16 bytes[/url]). From the link above: [quote] The struct type is suitable for representing lightweight objects such as Point, Rectangle, and Color. [/quote]
[QUOTE=ZeekyHBomb;21634853]Could you post the complete file?[/QUOTE] [url=http://randocity.wikispaces.com/file/view/HFCHD-placeholder.java]It's[/url] a homework assignment, fyi.
Try int[] identification = {1};
Same errors.
Could anyone take a look at the code I posted, can't figure it out :(
[QUOTE=WastedJamacan;21649654]Same errors.[/QUOTE] I meant instead of all the other stuff. Also get rid of identification[0] = 1; and so on.
Sorry, you need to Log In to post a reply to this thread.