• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Martin Mako Truba?

  • Content count

  • Joined

  • Last visited

Community Reputation

115 Neutral

About Martin Mako Truba?

  • Rank
  1. Lol...apparently problem was somewhere else. Thanks for pointing out, it is working properly now :)
  2. Well, I was doing it without bind (just  this.img.onload = this.imageLoaded; but it was not working so some guy gave me advice to to use bind. I looked it up but I can't make it work properly :( .
  3. Greetings, I am messing with JavaScript a little. I have a "class", that represents image. Inside that class, I try to assign a function to image.onload event.  var Card = function(url,c){ this.url = url; this.ctx = c; this.img = new Image(); this.posxCurr = 0; this.posyCurr = 0; this.widthCurr = 100; this.heightCurr = 100; this.img.onload = this.imageLoaded.bind(this); this.img.src = this.url; }; Card.prototype = { imageLoaded : function(){ //my goal is to initialize this.widthCurr and this.heightCurr this.widthCurr = this.img.width; this.heightCurr = this.img.height; alert('mako'); console.log(this.img.width); }, }; Basically I am trying to set widthCurr and heightCurr to actual size of the image after it is loaded. The function imageLoaded() seems not to be executed at all - there is no alert and when I draw the image, it is 100x100. What am I doing wrong?   Thanks for answers. Mako
  4. I finally figured it out...it's working now.
  5. Yeah you are right it should probably be  ball_old = ball_new; ... But may I ask why should I multiply ball * ball_old  instead of ball_old * ball;?  I know that order of matrix multiplication is important and it's not the same multiplying matrices A*B and B*A, but somewhere I read that arcball matrix rotation should be placed after all other matrices...so I basically put the new rotation matrix at the end of everything.
  6. Hello, I am trying to implement arcball / trackball camera rotation to my program but It doesn't work. I read some articles about matrices, quaternions etc. and I tought I finally understood the idea, but apparently I am doing something wrong. Basically I register two mouse positions, create axis of rotation, calculate angle, converted this information to quaternion and then quaternion to rotation matrix. It looks like it's rotating, but not in the way I want. So i would appreciate some help because I am desperate. Most of the code on the internet use glu, but I don't want to because I have already started to learn SDL and I like it. Here's part of the most important code:   void Vector3D::SetZ(float r) //set z coord. - projection to sphere, r - sphere radius { float delta = sqrt(x*x + y*y); if (delta <= r*0.70710678118) z = sqrt(r*r - delta*delta); else z = (r*r*0.5)/delta; } //from main.cpp: . . . SDL_GetMouseState(&currMX, &currMY); relx = event.motion.xrel; rely = event.motion.yrel; cMX = 2.*currMX/screen_width-1.; //normalizing screen coordinates cMY = screen_height - currMY; cMY = 2.*cMY/screen_height-1.; rely = -rely; if(relx<0)relx = -relx; if(rely<0)rely = -rely; if(rot) { d.Set(relx,rely,0); //distance vector from point 1 to point 2 if(d.Length() - eps >0) { z.Set(cMX, cMY, 0); //projection on sphere k.Set(z[0]+d[0],z[1]+d[1],z[2]+d[2]); // z - start position, k - end position k.SetZ(1); z.SetZ(1); rotaxis.CrossProduct(z, k); //rotation axis k.Normalize(); //normalizing vectors z.Normalize(); rotaxis.Normalize(); float pom = z[0]*k[0]+z[1]*k[1]+z[2]*k[2]; //dot product if(pom<-1) //setting angle (had problems that acos returned NAN) angle = -M_PI; else if (pom>1) angle = 0; else angle = acos(pom); float qw = cos(angle*0.5); //setting up quaternion float qx = rotaxis[0]*sin(angle*0.5); float qy = rotaxis[1]*sin(angle*0.5); float qz = rotaxis[2]*sin(angle*0.5); //quaternion transformed to rotation matrix ball.set( qw*qw + qx*qx - qy*qy - qz*qz, 2*qx*qy + 2*qw*qz, 2*qx*qz - 2*qw*qy, 0, 2*qx*qy - 2*qw*qz, qw*qw - qx*qx + qy*qy - qz*qz, 2*qy*qz + 2*qw*qx, 0, 2*qx*qz + 2*qw*qy, 2*qy*qz - 2*qw*qx, qw*qw - qx*qx - qy*qy + qz*qz, 0, 0, 0, 0, qw*qw + qx*qx + qy*qy + qz*qz ); } else ball.identity(); ball_new = ball_old * ball; ball_old = ball; } //RENDERING glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // camera transformation: matrixView.identity(); matrixView.rotate(-cameraAngleX, 1,0,0); // 1: rotate on x-axis matrixView.rotate(-cameraAngleY, 0,1,0); // 2: rotate on y-axis matrixView.rotate(-cameraAngleZ, 0,0,1); // 3: rotate on z-axis matrixView.translate(0, 0, -cameraDistance); // model transform: //matrixModel.identity(); //matrixModel.rotate(45, 0,1,0); // 1st transform //matrixModel.translate(0, 2, 0); // 2nd transform //matrixModel.translate(0, 0, -2); // build modeview matrix: Mmv = Mv * Mm matrixModelView.identity(); matrixModelView = matrixView * matrixModel * ball_new; glLoadMatrixf(matrixModelView.getTranspose()); //drawing   Thanks for any help suggestions! Mako