Jump to content

  • Log In with Google      Sign In   
  • Create Account

hikarihe

Member Since 08 Feb 2013
Offline Last Active Mar 24 2013 10:40 PM

Topics I've Started

GUI for 3D game using only SDL

19 March 2013 - 02:46 PM

Building on the idea of this tutorial: http://www.lazyfoo.net/SDL_tutorials/lesson09/index.php

  1. Draw menu and buttons as flat 3D surfaces
  2. When left mouse button pressed check coordinates ( if cursor inside a button )
  3. Follow button routine

 

Is this the only way to do it?

 

Thanks ^^


passing 2D array to struct

02 March 2013 - 05:31 AM

how do you do it?

 

I have this array:

 

 

char textureFileNames[ NUMBER_OF_TEXTURES ][ 48 ];
 

 

 

and:

 

 

// this is what I want
examplestruct.filenames = textureFileNames;
 

 

  • how do I declare the struct member so that it allows me to pass the address of my array to the member?
  • then how do i assign the address of the 2D array to the member?

 

any help appreciated happy.png


diagonal joystick axes

28 February 2013 - 09:08 PM

// handle joystick motion events
case SDL_JOYAXISMOTION:

	// initialize all joystick variables
	eventStates[ JOYSTICK_UP ] = 0;
	eventStates[ JOYSTICK_DOWN ] = 0;
	eventStates[ JOYSTICK_RIGHT ] = 0;
	eventStates[ JOYSTICK_LEFT ] = 0;

	// check left-right movement
	if( event->jaxis.axis == 0 ) 
	{
		// if joystick moving left
		if ( event->jaxis.value < -800 )
		{

			// move left
			eventStates[ JOYSTICK_LEFT ] = 1;
		}

		// if joystick moving right
		else if ( event->jaxis.value > 800 )
		{

			// move right
			eventStates[ JOYSTICK_RIGHT ] = 1;
		}
	}

	// check up-down movement
	if( event->jaxis.axis == 1 ) 
	{
		// if joystick moving up
		if ( event->jaxis.value < -800 )
		{

			// move up
			eventStates[ JOYSTICK_UP ] = 1;
		}

		// if joystick moving down
		else if ( event->jaxis.value > 800 )
		{

			// move down
			eventStates[ JOYSTICK_DOWN ] = 1;
		}
	}

	eventStates[ JOYSTICK_SCALE ] = event->jaxis.value;

	break;

 

my joystick event states are one directional. is it possible to get diagonal states in SDL?

 

something like this: joystick mapping


HDMI laptop to TV

28 February 2013 - 01:24 PM

Has anyone successfully done this? If so please guide me ^ ^

 

My TV recognizes the laptop and opens the correct HDMI channel but says "no video signal".


map_refl & map_Kd difference?

24 February 2013 - 04:16 AM

i'm trying to load an obj model into my opengl program and I came across these reading the .mtl files.

 

What is the difference between map_refl and map_Kd for textures?

 

I haven't used lighting yet and I just want the textures to appear on the model. In this case does it make a difference if I just pass the given texture (ignoring these prefixes) when drawing faces?

 

thanks ^^

 

EDIT:

as expected, it works but the refl (reflection?) texture looks weird. also map_refl is not an official mtl declaration (maybe blender only?)


PARTNERS