-
Posts
25 -
Joined
-
Last visited
Content Type
Blogs
Forums
Store
Gallery
Videos
Posts posted by Kotov72rus
-
-
Hi,
How to replace the standard window, on to any other window or object ?. For rendering engine.
-
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();
-
TSurface surf = GetSurface(TMesh mesh, long index=1); PaintSurface(surf, TMaterial material=NULL)
or
PaintSurface(GetSurface(TMesh mesh, long index=1), TMaterial material=NULL);
- 2
-
Really very interesting, comfortable and functional. Thank you.
-
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);
-
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;
-
Project was built as a debug under x86
(Now everything is clear )
Update:
https://www.dropbox.com/s/6z6owup3q9am5ph/Demo.zip
WSAD - Move
Space - Jump
Shift - Run
HJ - Add, Delete health on 10 units
-
Error message: "Side-by-side configuration is incorrect"
The machine is missing the correct C++ runtime components for your type of system. (x86 or x64).
Installing the following update resolved the issue.
Microsoft Visual C++ 2008 SP1 Redistributable Package (x86)
http://www.microsoft...&displaylang=en
Microsoft Visual C++ 2008 SP1 Redistributable Package for (x64)
http://www.microsoft...&displaylang=en
Sorry
-
Hmm, very strange - works for me
-
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);
-
Jump from the high mountains, and see the result
https://www.dropbox.com/s/c90jr4fyl1r5zgn/game%202012-12-15%2020-59-54-29.jpg
-
Thanks
-
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.
-
This font ?
http://xfont.ru/font/%D1%88%D1%80%D0%B8%D1%84%D1%82_StudioRegular_8644.htm
Click to download button СКАЧАТЬ
- 1
-
Just a small tip:
Instead of multiple calls to KeyDown(KEY_A) you could save the result in a variable and use that.
bool bKeyDownA = KeyDown(KEY_A); .... if (bKeyDownA) { .... }
That saves some time, because it only has to Call KeyDown(KEY_A) once.
Not that it gives you much performance, but things like that add up easily, as your program evolves.
Oh and there is no judgement involved, just a simple tip
Thank you, will use it
-
Do not judge me harshly , this is my first experience with C++
-
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; }
-
Test Animation:
-
Thank you so much, work.
-
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();
- 1
-
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?
-
Thanks for the help
- 1
-
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
Rendering
in General Discussion
Posted
Thanks for the answer