Jump to content

Qbound

Members
  • Posts

    71
  • Joined

  • Last visited

Posts posted by Qbound

  1. Hi all,

     

    hopefully someone can proof this bug. if not i have to dig a lot deeper...

     

    Since a few hours i try to convert my game NightFist to 231. But i have a small little problem and i think i can reproduce it.

     

    I think that the initialization of the engine has changed a little bit. Because i get an error if i want to log something into the logfile before the world is created.

     

    Here is an example:

    #include "engine.h"
    
    int WINAPI WinMain( HINSTANCE hInstance,
    				HINSTANCE hPrevInstance,
    				LPSTR lpCmdLine,
    				int nShowCmd ) 
    {
    Initialize() ;
    RegisterAbstractPath("D:/04 Leadwerks/10 SDK 231");
    SetAppTitle( "test231" ) ;
    Graphics( 800, 600 ) ;
    AFilter() ;
    TFilter() ;
    
    
    TWorld	world;
    TBuffer gbuffer;
    TCamera camera;
    TMesh	mesh;
    TLight	light;
    TMesh	ground;
    TMaterial material;
    
    // AppLog( "A BIGGGGG Problem if i want to log something at this position !!!!!!!!!!!!!!!!!!!!!!!!!!" );
    
    world = CreateWorld() ;
    
    
    AppLog( "Here is OK" );
    
    
    
    
    if (!world) {
    	MessageBoxA(0,"Error","Failed to create world.",0);
    	return Terminate();
    }
    
    
    
    gbuffer=CreateBuffer(GraphicsWidth(),GraphicsHeight(),BUFFER_COLOR|BUFFER_DEPTH|BUFFER_NORMAL);
    
    camera=CreateCamera();
    PositionEntity(camera,Vec3(0,0,-2));
    
    material=LoadMaterial("abstract::cobblestones.mat");
    
    mesh=CreateCube();
    PaintEntity(mesh,material);
    
    ground=CreateCube();
    ScaleEntity(ground,Vec3(10,1,10));
    PositionEntity(ground,Vec3(0,-2,0));
    PaintEntity(ground,material);
    
    light=CreateDirectionalLight();
    RotateEntity(light,Vec3(45,45,45));
    
    // Game loop
    while( !KeyHit() && !AppTerminate() )
    {
    	if( !AppSuspended() ) // We are not in focus!
    	{
    		// Rotate cube
    		TurnEntity( mesh, Vec3( 0.5f*AppSpeed() ) ) ;
    
    		// Update timing and world
    		UpdateAppTime();
    		UpdateWorld(AppSpeed()) ;
    
    		// Render
    		SetBuffer(gbuffer);
    		RenderWorld();
    		SetBuffer(BackBuffer());
    		RenderLights(gbuffer);
    
    		// Send to screen
    		Flip(0) ;
    	}
    }
    
    // Done
    return Terminate() ;
    }
    

     

    The initialization of my game uses a lot of AppLogs before the world is created.

    Hopefully this is the problem and it can be solved inside of the engine... if not... i have to go deeper...

     

    cu

    Oliver

  2. Hi Rick,

     

    here is the rough layout.

     

    You have a widget as a base class this can be a button, a frame element, an editfield or what ever you want.

    Every widget can have as many childs it wants to have. think about grouping or windows with subwindows and so on.

     

    The widget has a map which stores all the childs of this widget.

    When you attach to widget Alpha a window Beta and this cotains a button Charly and you want to check if the mouse is over charly

    you first check if the mouse X and Y is inbound the rect of the window Alpha. If this is true then the windowwidget Alpha goes through

    the list of its childs and finds 1 window namend Beta and if the mouse is inbout Beta the widget looks up the childs list if

    the mouse is in the rectangle of on of his childs like Charly... and so on...

    This algo stops when the mouse has the final widget under its pointer from the topmost widget you see... that is what you want.

     

    It is stable, fast and precise.

     

    Cu

    Oliver

  3. you dont need a recursion here. (ok i wrote it... but its late here in germany and i have to go to bed :))

     

    my way was.

     

    you have a sheet which can contain widgets. Those are stored in the a simple STL map. When the user click into the screen (sheet) it asks the widgets if there is a widget which has an intersection in its rect.

    If there is an intersection this widgets asks all the childs if any of the childs has an intersection, if so then return it.

     

    This worked really well. it was easy and precise.

     

    // ------------------------------------------------------------------------------------------------
    // Name: getWidget( uint16 _uiX, uint16 _uiY, bool _bfindAll )
    // Info: Get the widget at position _uiX _uiY
    //
    // Return			= (LPCLEG_WIDGET)		Topmost widget at this position
    //
    // _uiX				= (uint16)				Position X
    // _uiY				= (uint16)				Position Y
    // _bfindAll		= (bool)				Find all widget, override the find flag (default false)
    // ------------------------------------------------------------------------------------------------
    LPCLEG_WIDGET CLEG_SHEET::getWidget( uint16 _uiX, uint16 _uiY, bool _bfindAll )
    {
    // First check if the point is different
    if( !_bfindAll && ( m_sPointLastChecked.iX == _uiX ) && ( m_sPointLastChecked.iY == _uiY ) ) return m_pWidgetUnderPoint;
    
    // Set the point
    m_sPointLastChecked.iX = (int16)_uiX;
    m_sPointLastChecked.iY = (int16)_uiY;
    
    // Variablen init
    LPCLEG_WIDGET								pWidget			= NULL;		// Widget
    LPCLEG_WIDGET								pReturnWidget	= NULL;		// Widget
    list< LPCLEG_WIDGET >::reverse_iterator		itor;						// Iterator
    
    // Is the list empty?
    if( m_liWidgets_Active.size() <= 1 ) return pWidget;
    
    // No.. we can search for a widget
    itor = m_liWidgets_Active.rbegin();
    while( itor != m_liWidgets_Active.rend() )
    {
    	// Get Widget
    	pWidget = *itor;
    
    	// Check if we can find this widget
    	if( _bfindAll == false )
    		// Check if the widget is not visible or we set the flag that we do not want to find it by this action. Maybe the contextmenue!
    		if(( pWidget->getFLAG_Visible() == false ) || ( pWidget->getFLAG_FindByPointInside() == false  ) )
    		{
    			// Next Element
    			++itor;
    
    			// and go on
    			continue;
    		}
    
    	// Check position
    	if( pWidget->isPointInside( _uiX, _uiY ) )
    	{
    		// This Point is inside, so check if the point is inside of a childwidget
    		pReturnWidget = pWidget->getChildAtPoint( _uiX, _uiY );
    
    		// Do we have a child at this point?
    		if( pReturnWidget != NULL ) return pReturnWidget;
    
    		// return
    		return pWidget;
    	}
    
    	// Next Element
    	++itor;
    }
    
    // bye
    return NULL;
    }
    // ------------------------------------------------------------------------------------------------
    

     

    cu

    Oliver

  4. Hi Rick,

     

    i wrote a GUI for LE by myself in the past. It does a lot but i stopped the development in the middle of the gui editor because then i realized that i reinvent the wheel again...

    But here is my code for getChildAtPoint()

     

    I have a widget which is the base for all. And every widget has those 2 functions (and a lot more)

     

    1. isPointInside()

    2. getChildatPoint()

     

    the 2. is the recursive one and calls for every widget 1. this returns true or false if the point is inside

    every widget can contain a lot of subwidgets (buttons, editboxes etc) therefore i dig through all childs of the widget.

     

    here is the code

    // ------------------------------------------------------------------------------------------------
    // Name: isPointInside( int iPosX, int iPosY );
    // Info: is the point inside this widgetspace?
    //
    // Return			= (bool)				true / false
    //
    // iPosX			= (int)					Position Add X
    // iPosY			= (int)					Position Add Y
    // ------------------------------------------------------------------------------------------------
    bool CLEG_WIDGET::isPointInside( uint16 _uiX, uint16 _uiY )
    { return getRect().IntersectPoint( getBorderIntersection(), _uiX, _uiY ); }
    // ------------------------------------------------------------------------------------------------
    
    
    // ------------------------------------------------------------------------------------------------
    // Name: getChildAtPoint( uint16 _uiX, uint16 _uiY )
    // Info: Get the Childwidget at position _uiX _uiY
    //
    // Return			= (LPCLEG_WIDGET)		Topmost childwidget at this position
    //
    // _uiX				= (uint16)				Position X
    // _uiY				= (uint16)				Position Y
    // ------------------------------------------------------------------------------------------------
    LPCLEG_WIDGET CLEG_WIDGET::getChildAtPoint( uint16 _uiX, uint16 _uiY )
    {
    //Variablen init
    mWIItor	itor;																// Iterator
    LPCLEG_WIDGET		pChild = NULL;
    
    // Render all sheets
    for( itor = m_mapWidgets.begin(); itor != m_mapWidgets.end(); ++itor )
    {
    	// Pointer
    	pChild = (*itor).second;
    
    	// Pointer valid?
    	if( pChild == NULL ) continue;
    
    	// Resize ok?
    	if( pChild->isPointInside( _uiX, _uiY ) == true ) return pChild;
    }
    
    // bye
    return NULL;
    }
    // ------------------------------------------------------------------------------------------------
    

     

    hope this helps

     

    cu Oliver

  5. now i figured out how i can download the files... only do a second download... how simple :)

    But i experienced the same issue with the password on:

    - Slum

    - Houses

    - Blacksmith

     

    Those are converted by NoOdle i think. @NoOdle did you converted them? and if so what is the password?

     

    cu

    Oliver

  6. Thanx Rick for the replay. I use UU3D and i do the conversion by myself.

    But if i can save some time due to a download then i am very happy :D

     

    I downloaded the the marketplace and the slum set but both did not contain the gmf files.

     

    cu

    Oliver

  7. Hi,

     

    one question... how do can i download those packs with the newly inlcuded gmf file?

    When i use the link from the emails i recieve only the 'old' files without the gmf files?

     

    Thanks for the hints.

     

    Cu

    Oliver

  8. works on my 64bit machine now... well done... i got some minor exceptions from the buttons in your menuebar.

     

    Well done.

     

    one suggestion:

    - maybe you can add a normal textexport. so that we can copy and paste the settings :rolleyes:

     

    thumbs up

    Oliver

  9. Thanks for the help. Ill try this out. At the moment i think the problem is that i do not hit a surface and there for there is no decal created.

     

    btw. why you don't use 0.0625 as the 3rd parameter. it will be faster then everytime a devision.

     

    cu

    Oliver

  10. Hi all,

     

    are the decals working in 2.3? i tried to create a decal but i got a NULL pointer back. And i think i setup the parameters right. hopefully ;)

     

    here is the code

    	// Create the pick
    TPick _Pick;
    
    // get the ground of the mesh
    LinePick( &_Pick, m_vPositionCurrent, Vec3( m_vPositionCurrent.X, m_vPositionCurrent.Y -10, m_vPositionCurrent.Z ),0 ,1 );
    
    // Create the ground decal
    m_MeshDecal				= CreateDecal( _Pick.surface, m_vPositionCurrent, 2, 32 );
    m_matDecal				= LoadMaterial( "abstract::SFX_DECAL_WAKE.mat" );	PaintEntity( m_MeshDecal, m_matDecal );

     

    m_vPositionCurrent is the current position of the player and it is set correct. It has an offset of 2 and the linepick gave me a surface back.

    I do not understand what the parameter at the end of the createdecal is. so far with searching the forum (old one) most used 32 a change of this parameter has no effect at all.

     

    cu

    Oliver

×
×
  • Create New...