Jump to content

Kotov72rus

Members
  • Posts

    25
  • Joined

  • Last visited

Everything posted by Kotov72rus

  1. Hi, How to replace the standard window, on to any other window or object ?. For rendering engine.
  2. Cursor in the middle because you are using the function: MouseMove(X,Y); Try to do a background check: bool showMenu; //Loop if(showMenu){ ShowMouse(); } else { HideMouse(); MouseMove(X,Y); } Show cursor: ShowMouse();
  3. TSurface surf = GetSurface(TMesh mesh, long index=1); PaintSurface(surf, TMaterial material=NULL) or PaintSurface(GetSurface(TMesh mesh, long index=1), TMaterial material=NULL); http://www.leadwerks...ference/meshes/ http://www.leadwerks...rence/surfaces/
  4. Really very interesting, comfortable and functional. Thank you.
  5. The question is solved Class: void TempFunction(){} void (*TempCallback)(); void onClick(void (*callback)()); void TGuiButton::Create(...) { TempCallback = TempFunction; } void TGuiButton::onClick(void (*callback)()) { TempCallback = callback; //TempCallback(); } User function: void TestClick() { Terminate(); } .onClick(&TestClick);
  6. Please help me with an example, to replace the function of the class - the user function. There is a class: class TGuiButton { private: int x,y,width,height; string title; int MouseIn(TVec2 start, TVec2 dimensions); bool IsClick; bool buf1,buf2; TEntity buf; void * TempFunction; //To call the user function. public: string SoundEnter; string SoundLeave; string SoundClick; string TextureUp; string TextureHover; string TextureDown; bool Sounds; bool Enabled; bool Visible; void Create(int _x, int _y, int _width, int _height, string _title); void onClick(void *callback); //Function for replace. void Update(); void Delete(); }; .... void TGuiButton::onClick(void *callback) { //????? } .... And call a user function with TempFunction;
  7. Why does not work this method? Without checking the name, works with all objects, that are currently in contact with the object. void _stdcall EntityCollisionCallback( TEntity entity0, TEntity entity1, byte* position, byte* normal, byte* force, flt speed ) { if(GetEntityKey(entity1,"name")=="test_box") { HideEntity(entity1); } } //Entity box SetEntityKey(test_box, "name","test_box"); //Controller SetEntityKey(Controller, "name","controller"); SetEntityCallback(Controller,(byte*)EntityCollisionCallback,ENTITYCALLBACK_COLLISION);
  8. Hi, there is a character "name=controller" and the object box "name=box_test". How to determine the collision with box?, and then perform the desired action.
  9. This font ? http://xfont.ru/font/%D1%88%D1%80%D0%B8%D1%84%D1%82_StudioRegular_8644.htm Click to download button СКАЧАТЬ
  10. Do not judge me harshly , this is my first experience with C++
  11. I used this code: //Animation //Jumping jump = 0.0; isJump = false; if(KeyHit(KEY_SPACE)) { if (!ControllerAirborne(Controller)) { jump=8.0; isJump = true; } } if(KeyDown(KEY_W)) { sequence = 2; Angle = -180; } else if(KeyDown(KEY_S)) { sequence = 2; Angle = -0; } else if(KeyDown(KEY_A)) { sequence = 2; Angle = -90; } else if(KeyDown(KEY_D)) { sequence = 2; Angle = -260; } else { sequence = 1; } // if(KeyDown(KEY_W) && KeyDown(KEY_A)) { Angle = -140; } else if(KeyDown(KEY_W) && KeyDown(KEY_D)) { Angle = 140; } else if(KeyDown(KEY_S) && KeyDown(KEY_A)) { Angle = -40; } else if(KeyDown(KEY_S) && KeyDown(KEY_D)) { Angle = 40; } //Run if(KeyDown(KEY_W) && KeyDown(KEY_LSHIFT) || KeyDown(KEY_RSHIFT)) { sequence = 3; speed = 6; } else if(KeyDown(KEY_S) && KeyDown(KEY_LSHIFT) || KeyDown(KEY_RSHIFT)) { sequence = 3; speed = 6; } else if(KeyDown(KEY_A) && KeyDown(KEY_LSHIFT) || KeyDown(KEY_RSHIFT)) { sequence = 3; speed = 6; } else if(KeyDown(KEY_D) && KeyDown(KEY_LSHIFT) || KeyDown(KEY_RSHIFT)) { sequence = 3; speed = 6; } else { speed = 4; }
  12. Test Animation: http://youtu.be/fPZJuwmyNPI
  13. Works #pragma once #include "engine.h" #include "string" using namespace std; const int COLLISION_NONE = 0; const int COLLISION_PROP = 1; const int COLLISION_SCENE = 2; const int COLLISION_CHARACTER = 3; const int COLLISION_TRIGGER = 4; const int COLLISION_AILINEOFSIGHT = 5; class TPlayer { private: public: flt X,Y,Z; TCamera Camera; TMesh mesh; TEntity CameraPivot; float mx; float my; TVec3 camrotation; TController Controller; TMesh PlayerMesh; float move; float strafe; float Angle; void CreatePlayer(flt X, flt Y, flt Z); void Update(); }; TPlayer Player; //Global class void TPlayer::CreatePlayer(flt X, flt Y, flt Z) { Player.X = X; Player.Y = Y; Player.Z = Z; //Create player Controller = CreateController(2,0.3,0.5,45.01); EntityType(Controller,COLLISION_CHARACTER); PositionEntity(Controller,Vec3(X,Y,Z)); SetBodyDamping(Controller,0.0); SetWorldGravity(Vec3(0,-10,0)); SetBodyMass(Controller,50); //Set look camera position PositionEntity(Camera,Vec3(0,1,-4)); //Camera pivot CameraPivot=CreatePivot(); EntityParent(Camera, CameraPivot); //Load player mesh PlayerMesh = LoadMesh("abstract::crawler.gmf"); EntityType(PlayerMesh,COLLISION_CHARACTER); RotateEntity(PlayerMesh,Vec3(0,-180,0)); HideMouse(); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); Angle = -180; } void TPlayer::Update() { //Camera look mx=Curve(MouseX()-GraphicsWidth()/2,mx,6); my=Curve(MouseY()-GraphicsHeight()/2,my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); camrotation.Y=camrotation.Y-mx/9.0; camrotation.X=camrotation.X+my/9.0; //Limit the viewing angle in the vertical camrotation.X=min(camrotation.X,60); //Look Up camrotation.X=max(camrotation.X,-10); //Look Down //Rotate Camera RotateEntity(CameraPivot,camrotation); //Position Camera PositionEntity(CameraPivot,EntityPosition(Controller)); //Player movement move=(KeyDown(KEY_W)-KeyDown(KEY_S))*4; strafe=(KeyDown(KEY_D)-KeyDown(KEY_A))*4; //Set controller input UpdateController(Controller,camrotation.Y,move,strafe,0,45); //Player mesh position and rotation PositionEntity(PlayerMesh,EntityPosition(Controller)); RotateEntity(PlayerMesh,Vec3(0,camrotation.Y+Angle,0)); } Add to main: #include "Player.h" Player.Camera = GetLayerCamera(GetFrameworkLayer(0)); Player.CreatePlayer(0,9,0); Add to main loop: Player.Update(); http://youtu.be/YCm9-y1E7kI
  14. Hi. Do not understand why this code does not work?. This is for the test if (KeyDown(KEY_W)){sequence = 2;} else sequence = 1; if (KeyDown(KEY_S)){sequence = 2;} else sequence = 1; if (KeyDown(KEY_A)){sequence = 2;} else sequence = 1; if (KeyDown(KEY_D)){sequence = 2;} else sequence = 1; switch (sequence) { case 1: framebegin=0.0; frameend=69.0; break; case 2: framebegin=70.0; frameend=130.0; break; case 3: framebegin=131.0; frameend=171.0; break; } frame=AppTime()/15.0; frame=fmodf(frame,frameend-framebegin)+framebegin; Animate(PlayerMesh,frame,0.5,0,true); Animation works only when you press 'D'. Why is this?
  15. Hello. Show you how to rotate the camera around the object? Tried to fix this code: //Camera looking Player.mx=Curve(MouseX()-GraphicsWidth()/2,Player.mx,6); Player.my=Curve(MouseY()-GraphicsHeight()/2,Player.my,6); MoveMouse(GraphicsWidth()/2,GraphicsHeight()/2); Player.camrotation.X=Player.camrotation.X+Player.my/10.0; Player.camrotation.Y=Player.camrotation.Y-Player.mx/10.0; RotateEntity(Camera,Player.camrotation); but nothing
×
×
  • Create New...