Example #1
4
File: esp.py Project: powergun/EHF
 def _drawPlayerEsp(self, player):
     """
     example:
     self.getLine()
     
     drawBox(line, x, y, w, h, width, color):
         w, h: width and height of the box,
         x, y: top-left corner
     """
     _color = self.colorTeammate if player.team == self.appVars["myTeam"] \
                                 else self.colorEnemy
     feet, head, sizeX, sizeY = self._calculatePlayerScreenSize(player)
     if feet and head:
         ehfgraphics.drawBox(self.getLine(), feet.x - sizeX/2, feet.y, sizeX, -sizeY, self.lineWidth, _color)
Example #2
4
 def _run(self):
     ehfgraphics.drawBox(self.getLine(), self.oX, self.oY, 50, 50, self.getclw(), self.getclc())
Example #3
1
File: esp.py Project: powergun/EHF
    def _run(self):
        # delayed init
        self.delayedInit()
        
        # figure out the time interval
        worldTransform = ehfmaths_functions.getIdMatrix()
        viewTransform = ehfmaths_functions.getViewMatrix(
                                                         self.appVars["upVec"], 
                                                         self.appVars["rightVec"], 
                                                         self.appVars["forwardVec"], 
                                                         self.appVars["viewOrigin"]
                                                         )
        viewOrigin = self.appVars["viewOrigin"].toPointVector4()
        
        if not self.miniMap:
            self.miniMap = widgets.SimpleMiniMap( 
                 # location control
                 centerX=200, centerY=200, boundaryX=160, boundaryY=160,
                 # color/drawing style
                 borderWidth=3, lineWidth=3, selfColor=0xFF00FF00, teamColor=0xFF1111FF, enemyColor=0xFFFF1111, boundaryColor=0xFFFF1111,
                 # size/scale control
                 scale=2, spotSize=3,
                 # other attributes
                 vecForward=self.appVars["forwardVec"]
                 )
        else:
            self.miniMap.setVecForward(self.appVars["forwardVec"])
            self.miniMap.setViewAxisZ(self.appVars["forwardVec"])

        self.miniMap.drawBoundary(self.getLine())
        self.miniMap.drawSelf(self.getLine())
        
        projectionTransform = ehfmaths_functions.getProjectionMatrix(
                                                                     self.appVars["zn"], 
                                                                     self.appVars["zf"], 
                                                                     self.appVars["fov_x"], 
                                                                     self.appVars["fov_y"]
                                                                     )
        
        hintColor = 0xFFFF11FF
        
        # loop through simple player objects
        for player in self.appVars["players"]:
            # don't draw "self"
            if player.address == self.appVars["localPlayerAddress"]:
                continue
            
            # skip team players
            if player.teamId == self.appVars["localPlayerTeamId"]:
                continue
                
            if not self._validatePlayer(player):
                continue
            
            _color = self.colorTeammate if player.teamId == self.appVars["localPlayerTeamId"] \
                                        else self.colorEnemy
            pos4 = player.position.toPointVector4()
            pos4TankAimAssist = player.position.toPointVector4()
            
            distant = (pos4 - viewOrigin)._length()
            deltaY = pos4.y - viewOrigin.y
            
            _posV = pos4.multToMat(worldTransform).multToMat(viewTransform)
            _posVP = _posV.multToMat(projectionTransform)
            _posV.x *= -1
            
            # ----------------get bullet drop
            aimCompensationY = naiveGetBulletDrop(distant, deltaY, GRAVITY, SPEED)
            # ----------------done getting bullet drop
            
            pos4TankAimAssist.y += aimCompensationY 
            posVTankAimAssist = pos4TankAimAssist.multToMat(worldTransform).multToMat(viewTransform)
            posVTankAimAssist = posVTankAimAssist.multToMat(projectionTransform)
            
            self.miniMap.drawPlayer(self.getLine(), _posV, player.teamId == self.appVars["localPlayerTeamId"])

            if abs(_posVP.w) < 0.001:
                continue
            if _posVP.z > 0:
                continue
            x = self.screenCenterX*(1+_posVP.x/_posVP.w)
            y = self.screenCenterY*(1+_posVP.y/_posVP.w)
            
            xAim = self.screenCenterX*(1+posVTankAimAssist.x/posVTankAimAssist.w)
            yAim = self.screenCenterY*(1+posVTankAimAssist.y/posVTankAimAssist.w)
            
            
            # ---------- draw player distance hint text ---------
            if player.teamId != self.appVars["localPlayerTeamId"]:
                ehfgraphics.drawStringLeft(self.getFont(), 
                                           x+5, 
                                           y+5, 
                                           10, 
                                           40, 
                                           _color, 
                                           "%0.1f" % distant)

            # ---------- draw a spot for tank aim assist -----------
                ehfgraphics.drawSpot(self.getLine(),
                                     xAim,
                                     yAim, 
                                     _color,
                                     size=1.5)
                
                ehfgraphics.drawLine(self.getLine(), x , y, xAim-x, yAim-y, 0.5, color=_color)
                
            # ---------- draw boxed esp -------------
            _width, _height = self.getWidthHeight(distant)
            if player.poseType:
                y = y + _height/2.0
            x = x - _width/2.0
            ehfgraphics.drawBox(self.getLine(), 
                                x, 
                                y, 
                                _width, 
                                _height, 
                                2, 
                                _color)
Example #4
0
File: esp.py Project: ieralt/EHF
 def _drawPlayerEsp(self, player):
     """
     example:
     self.getLine()
     
     drawBox(line, x, y, w, h, width, color):
         w, h: width and height of the box,
         x, y: top-left corner
     """
     _color = self.colorTeammate if player.team == self.appVars["myTeam"] \
                                 else self.colorEnemy
     feet, head, sizeX, sizeY = self._calculatePlayerScreenSize(player)
     if feet and head:
         ehfgraphics.drawBox(self.getLine(), feet.x - sizeX / 2, feet.y,
                             sizeX, -sizeY, self.lineWidth, _color)
Example #5
0
 def _run(self):
     ehfgraphics.drawBox(self.getLine(), self.oX, self.oY, 50, 50,
                         self.getclw(), self.getclc())
Example #6
0
    def _run(self):
        # delayed init
        self.delayedInit()

        # figure out the time interval
        worldTransform = ehfmaths_functions.getIdMatrix()
        viewTransform = ehfmaths_functions.getViewMatrix(
            self.appVars["upVec"], self.appVars["rightVec"],
            self.appVars["forwardVec"], self.appVars["viewOrigin"])
        viewOrigin = self.appVars["viewOrigin"].toPointVector4()

        if not self.miniMap:
            self.miniMap = widgets.SimpleMiniMap(
                # location control
                centerX=200,
                centerY=200,
                boundaryX=160,
                boundaryY=160,
                # color/drawing style
                borderWidth=3,
                lineWidth=3,
                selfColor=0xFF00FF00,
                teamColor=0xFF1111FF,
                enemyColor=0xFFFF1111,
                boundaryColor=0xFFFF1111,
                # size/scale control
                scale=2,
                spotSize=3,
                # other attributes
                vecForward=self.appVars["forwardVec"])
        else:
            self.miniMap.setVecForward(self.appVars["forwardVec"])
            self.miniMap.setViewAxisZ(self.appVars["forwardVec"])

        self.miniMap.drawBoundary(self.getLine())
        self.miniMap.drawSelf(self.getLine())

        projectionTransform = ehfmaths_functions.getProjectionMatrix(
            self.appVars["zn"], self.appVars["zf"], self.appVars["fov_x"],
            self.appVars["fov_y"])

        hintColor = 0xFFFF11FF

        # loop through simple player objects
        for player in self.appVars["players"]:
            # don't draw "self"
            if player.address == self.appVars["localPlayerAddress"]:
                continue

            # skip team players
            if player.teamId == self.appVars["localPlayerTeamId"]:
                continue

            if not self._validatePlayer(player):
                continue

            _color = self.colorTeammate if player.teamId == self.appVars["localPlayerTeamId"] \
                                        else self.colorEnemy
            pos4 = player.position.toPointVector4()
            pos4TankAimAssist = player.position.toPointVector4()

            distant = (pos4 - viewOrigin)._length()
            deltaY = pos4.y - viewOrigin.y

            _posV = pos4.multToMat(worldTransform).multToMat(viewTransform)
            _posVP = _posV.multToMat(projectionTransform)
            _posV.x *= -1

            # ----------------get bullet drop
            aimCompensationY = naiveGetBulletDrop(distant, deltaY, GRAVITY,
                                                  SPEED)
            # ----------------done getting bullet drop

            pos4TankAimAssist.y += aimCompensationY
            posVTankAimAssist = pos4TankAimAssist.multToMat(
                worldTransform).multToMat(viewTransform)
            posVTankAimAssist = posVTankAimAssist.multToMat(
                projectionTransform)

            self.miniMap.drawPlayer(
                self.getLine(), _posV,
                player.teamId == self.appVars["localPlayerTeamId"])

            if abs(_posVP.w) < 0.001:
                continue
            if _posVP.z > 0:
                continue
            x = self.screenCenterX * (1 + _posVP.x / _posVP.w)
            y = self.screenCenterY * (1 + _posVP.y / _posVP.w)

            xAim = self.screenCenterX * (
                1 + posVTankAimAssist.x / posVTankAimAssist.w)
            yAim = self.screenCenterY * (
                1 + posVTankAimAssist.y / posVTankAimAssist.w)

            # ---------- draw player distance hint text ---------
            if player.teamId != self.appVars["localPlayerTeamId"]:
                ehfgraphics.drawStringLeft(self.getFont(), x + 5, y + 5, 10,
                                           40, _color, "%0.1f" % distant)

                # ---------- draw a spot for tank aim assist -----------
                ehfgraphics.drawSpot(self.getLine(),
                                     xAim,
                                     yAim,
                                     _color,
                                     size=1.5)

                ehfgraphics.drawLine(self.getLine(),
                                     x,
                                     y,
                                     xAim - x,
                                     yAim - y,
                                     0.5,
                                     color=_color)

            # ---------- draw boxed esp -------------
            _width, _height = self.getWidthHeight(distant)
            if player.poseType:
                y = y + _height / 2.0
            x = x - _width / 2.0
            ehfgraphics.drawBox(self.getLine(), x, y, _width, _height, 2,
                                _color)
Example #7
-1
 def drawBoundary(self, line):
     ehfgraphics.drawBox(line, 
                         self.centerX-self.boundaryX, 
                         self.centerY-self.boundaryY, 
                         self.boundaryX*2, 
                         self.boundaryY*2, 
                         self.borderWidth, 
                         self.boundaryColor)