Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

122 Neutral

About jack_bauer

  • Rank
  1. If anyone is experienced with CORBA im trying to implement a struct specification in java and having a lot of trouble.. my IDL looks like the following module LMS { struct Alarm { string sensor; string zone; }; interface LMSIF { //functions and such declaared here }; }; From what i understad, a struct gets mapped directly to a java class, like the following public final class Alarm { public String sensor; public String zone; public Alarm() {} //default constructors, oublic Alarm(String _sensor, String _zone) {zone = _zone, sensor = _sensor} } Now im trying to access the values in the struct/class like so: class LMSServant extends _LMSIFImplBase { Alarm al; //functions here public LMSServant() { //this line causes the problem. al.sensor = "Sensor 1"; } } But I get constand NullPointerException errors when it hits the 'al.sensor='line. from a java point of view how does the code look? Any reason why it shouldnt be working? If anyone knows a bit of CORBA too, then again any ideas? I havent declared the class Alarm anywhere in the java files, should i be doing? I tried that but it started causing other problems..
  2. ive tried.. I reset the computer before posting here but its still doing it..
  3. Sorry if this is the wrong board to post this on, but the best i could find. The code is actually in a mixture of MFC and win32 c/c++. I just started getting this error under Visual Studios after i edited one of my resource files. It says it cant open the include file, and in the resource editor window it says the file is already open in another editor. Anyone know whats up?
  4. I've got an application setup using JTabbedPanes, I want to be able to switch to a new tab without having to click on the actual tab. Ive got a button I want to be able to press to move to the next one (sending a bit of data with it). Any ideas how i could implement this?
  5. Ive got a project to do in java, I have to create a network bulletin board system. The problem is Java (and inparticular GUIs in Java) has always been a weak area of mine. The problem i'm having is, imagine this: I want to create a sort-of text-box in the screen which lists all the individual topics that have been posted, and users should be able to selct any of them and load the full topic up. The problem is i dont know how to create a read-only text box which would be divided up into sections (topics) and allows user selection. Can someone give me an idea what to look for? It seems like (and probably is) a really simple thing to do, but i've been browsing through some of the documentation on java.sun.com but i dont really know what im looking for. Any other general pointers on how better to implement it would be welcome too ;) Thanks in advance.
  6. Im going to be designing/making an online poker game for windows. I can handle most of the programming (i think o.O) except ive never really done any network/internet programming before. Ive been looking at the book reviews on this site, but the problem is i dont really know what im looking for.. Its going to have a central server which multiple (unlimited?) clients can connect to. But as i say im not really sure what im looking for here. Would winsock cover everything i need? thanks in advance.
  7. jack_bauer

    Random Number Generator / Shuffling argorithms

    thanks. But, I am looking for something much stronger. Its for a college project and its been stressed that one of the priorities is to generate completely random cards, with no noticable bias. I wont be starting any coding for a couple of months or so, this is all just research and brainstorming at the moment. Getting a seed isnt an issue, i can feed results of things like mouse positions and client commands etc to give a truly random seed. But i need to research some effective algorithms. Ive been looking on google but not really found anything of value. A lot of websites all saying different things. Some saying a Knuth shuffle is perfect, others saying the exact opposite. None really explain how to implement anything.
  8. Im just starting writing an online poker game and i need to research/develop an efficient and effective shuffling algorithm and random number generator. Can anyone give me some ideas where to start looking? Any good books/websites/general info.
  9. hmmmm.. well i worked it out this way straight up in the Y direction is set as the default position - 0 degress rotation. 90 degrees rotation then is straight right accross the screen in the x direction sin 90 = 1 180 degrees rotated is straight down the screen, cos 180 = -1 So it all seemed to work out nicely that way.. Whats wrong with that? Its been way way too long since ive done any kind of maths (except a bit of probability..)
  10. I'm hoping this is the best forum for this problem i'm having. I'm just starting out in directx and i'm working on a 2D asteroids clone. I've made myself a triangle which can rotate about its centre and move forwards along the screen. The problem i'm having is that when its moving UP/LEFT and DOWN/RIGHT on the screen, it moves faster than when its heading UP/RIGHT and DOWN/LEFT. This shouldnt happen the speed should be constant. This is what i'm using to calculate the speed: y_speed = (cos(fRotation_angle)*thrust); x_speed = (-sin(fRotation_angle)*thrust); fCentreY += x_speed; //the Y co-ord of the centre of the ship fCentreX += y_speed; //the X co-ord of the centre of the ship Any ideas whats going wrong?
  11. jack_bauer

    d3d rotating triangle about its center

    Ahaaaa thanks you two that seems to have almost solved it. Its working almost perfectly, the only problem im having now is, after ive called MoveForwards (which translates it up the screen), calling rotate will jump the object up the screen by a few pixels (depending on how far its moved). Thats probably a problem with my fCenterY variable going off somewhere.. I'll have to work on that more tomorrow (unless someones got more advice for me :P) Thanks though guys!
  12. I posted this on the maths and physics forum first but its here now too :) Anyway i'm made a direct3d prog and i'm trying to get a triangle to rotate and move about the screen. Its not quite working out though. Ive got a triangle with coords (100,-67), (-100, -66) and (0,133) which puts the center of rotation at (0,0). I blit it to the centre of the screen and it will rotate no problem. Moving it about the screen works sorta as well. the problem i'm having is combining the two. Here is my code for rotation and translation. void rotateLeft(float angle) { fRotationAngle += angle; D3DXMatrixTranslation(&matrixTranslation, -fCentreX, -fCentreY, 0.0f); D3DXMatrixRotationZ(&matrixRotationZ, fRotationAngle); D3DXMatrixTranslation(&matrixTranslationBack, +fCentreX, +fCentreY, 0.0f); resultantMatrix = matTranslation*matRotationZ*matTranslationBack; return; } void MoveForwards(void) { fCentreY += 1.0f; D3DXMatrixTranslation(&matrixTranslation,fCentreX,fCentreY,0.0f); resultantMatrix = matrixTranslation; } fCentreX and fCentreY are the coords of the centre of the triangle (starting at (0,0) and increasing/decreasing as necessary. - Whats happening is: I blit the triangle to the center of the screen, i can then rotate it no problem. I can move the triangle up the screen (only direction ive programmed in so far), but after that it will not rotate properly. After its been moved upscreen, calling the rotate function will instantly blit the triangle back to its original position (centre of the screen) and it will rotate it about the centre point of where the triangle should be (where it was after translation). Calling the moveforwards again will then put the triangle back to exactly where it was the last time the function ended. My rendering function is basically: Device->SetTransform(D3DTS_VIEW, &resultantMatrix); Device->SetStreamSource(0,pTriangleVB,0,sizeof(D3DVERTEX)); Device->DrawPrimitive(D3DPT_TRIANGLELIST,0,1); I hope ive explained it clearly enough and i hope some one can offer me some advice where i'm going wrong.
  13. OK i'm trying to get this but its not quite working out. Using direct3D and C++. Ive got a triangle drawn onscreen with coords (-100, -67), (0, 133), (100, -67) which puts the centre of gravity (rotation point) at approx (0,0). If the triangle stays stationary i can rotate it about its centre without a problem using matrices D3DXMatrixRotationZ(&matrixRotationZ, fRotationAngle); The problem i'm having is when it has been moved about on screen to another location. Im trying to translate it to the origin, rotate it, then rotate it, then translate it back but it doesnt quite work and ends up rotating about a random point. This is what im doing: D3DXMatrixTranslation(&matrixTranslation, -fCentreX, -fCentreY, 0.0f); //puts it to the origin D3DXMatrixRotationZ(&matrixRotationZ, fRotation); //rotates D3DXMatrixTranslation(&matrixTranslationBack, +fCentreX, +fCentreY, 0.0f); //puts it back resultantMatrix = matrixTranslation*matrixRotationZ*matrixTranslationBack fCentreX and fCentreY is the centre position of the triangle, starts at (0,0) and get increased or decreased as the triangle moves about. what it actually does is messes with the position of the triangle and rotates it about a wrong origin, then if i try to translate it again it seemingly ignores the position and rotation and goes back to where it was last time i called the translate function. Any ideas what im doing wrong? I put it on this board because im guessing its a problem with my math and not strictly my code.
  14. doh. ok i was overstating the problem i guess, that answers one part of it (something which i honestly never thought of doing o.O) But, How do i find the initial coordinates?? Ive got my local vertices: x y -2, 1 //top -3, -1 //bl -1, -1 //br Im not sure how to transform these to any specific coordinates in the world. My code blits it to what looks like the center of the screen. The tutorials i'm learning from dont seem concerned with exactly where it initially blits it to, just how to move it afterwards. How could i make it so, say, the bottom left corner of the triangle is put at the bottom left corner of the screen (0,0) or (0,screen_height). Sorry for the stupid question, i'm just starting out thats my excuse :) I did a bit of 2d graphics work in java and i had to write all my own matrices for transformations.
  15. Just started learning direct3D and i was trying to make a 2D asteroids clone. Ive managed to create a triangle (which is the ship) on screen and use DirectInput to rotate it and move it about the screen no problem. Ive put in the model coordinates of the triangle and transformed it to world coords' to display it, but im not sure exactly where it is at any given time. I'm working on the collision detection and am trying to have a 'sun' in the middle of the screen creating gravity constantly pull the ship towards it. But i'm stuck as to how to do it without knowing exactly where the ship is on the screen. anyone give me some good advice on what i'm missing. Thanks.
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!