public void Set(float damage,int Type) { Damage = damage; Timer = 30; sFont = new GTA.Font(0.08F, FontScaling.ScreenUnits); switch (Type) { case 0://Engine sFont.Color = Color.FromArgb(0, 255, 0); break; case 1://Petrol sFont.Color = Color.FromArgb(255,0, 0); break; case 2://Body sFont.Color = Color.FromArgb(0,0, 255); break; } Pos.X = (float)rnd.NextDouble(); Pos.Y = (float)rnd.NextDouble(); Pos.X = Pos.X * 0.4f + 0.2f; Pos.Y = Pos.Y * 0.4f + 0.2f; rect = new RectangleF(Pos.X,Pos.Y,0.2f,0.2f); }
public PerFrameRenderer(Client client) { this.client = client; font = new GTA.Font("Segoe UI", widthToPx(20.0f), FontScaling.Pixel); font_small = new GTA.Font("Segoe UI", widthToPx(10.0f), FontScaling.Pixel); font_consolas = new GTA.Font("Consolas", widthToPx(20.0f), FontScaling.Pixel); client.PerFrameDrawing += Client_PerFrameDrawing; }
public TextureDrawingExample() { Gauge = Resources.GetTexture("rpm_gauge.png"); Needle = Resources.GetTexture("rpm_needle.png"); TimerFont = new GTA.Font(0.08F, FontScaling.ScreenUnits); TimerFont.Color = Color.Yellow; PerFrameDrawing += new GTA.GraphicsEventHandler(TextureDrawingExample_PerFrameDrawing); }
public static float MeasureStringWidth(string str, Font font, float scale) { int screenw = Game.ScreenResolution.Width; int screenh = Game.ScreenResolution.Height; const float height = 1080f; float ratio = (float)screenw / screenh; float width = height * ratio; return MeasureStringWidthNoConvert(str, font, scale) * width; }
public DrawingExample() { screenFont = new GTA.Font(0.15F, FontScaling.ScreenUnits); screenFont.Color = Color.Red; pixelFont = new GTA.Font(48.0F, FontScaling.Pixel); pixelFont.Color = Color.Red; this.PerFrameDrawing += new GraphicsEventHandler(this.DrawingExample_PerFrameDrawing); }
public static float MeasureStringWidth(string text, string label, Font font, float scale) { var res = NativeFunctions.GetScreenResolution(out _); Function.Call(Hash._0x54CE8AC98E120CAB, label); // _BEGIN_TEXT_COMMAND_WIDTH Function.Call(Hash._0x6C188BE134E074AA, text); // ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME Function.Call(Hash.SET_TEXT_FONT, (int)font); Function.Call(Hash.SET_TEXT_SCALE, scale, scale); return(Function.Call <float>(Hash._0x85F061DA64ED2F67, 1) * res.Width); // _END_TEXT_COMMAND_GET_WIDTH }
public CoD() { rect = new RectangleF(0.1F, 0.7F, 0.8F, 0.1F); screenFont = new GTA.Font(0.07F, FontScaling.ScreenUnits); screenFont.Color = Color.White; GetFlag = false; player = Player.Character; Interval = 100; this.Tick += new EventHandler(this.Bombat_Tick); this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing); }
public Futtobi() { GUID = new Guid("CF7EB590-3851-11E0-88D2-1396DFD72085"); BindScriptCommand("Active", new ScriptCommandDelegate(Active)); screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); Interval = 500; this.Tick += new EventHandler(this.MOD_Tick); this.PerFrameDrawing += new GraphicsEventHandler(this.MOD_PerFrameDrawing); KeyDown += new GTA.KeyEventHandler(MOD_KeyDown); }
public PedStreamer(Client client, float range) : base(client, range) { nickfont = new Font("Segoe UI", 24, FontScaling.Pixel, false, false); nickfont.Effect = FontEffect.None; nickcolor = System.Drawing.Color.LightYellow; chatcolor = System.Drawing.Color.White; DrawDistance = 120.0f; checkLOS = true; //fa_font = new Font("FotntAwesome", 24, FontScaling.Pixel, false, false); }
//protected event KeyEventHandler KeyUp; //bool AcceptPressed; //bool CancelPressed; public UIMenu(string title) { Title = title; TitleFontSize = 0.9f; //TitleFont = 1.1f; for no-value fit. ItemTextFontSize = 0.452f; ItemTextFontType = Font.ChaletComprimeCologne; CalculateMenuPositioning(); //KeyUp += UIMenu_KeyUp; }
public HeartBeat() { SP1 = new SerialPort("COM3", 9600); SP1.DataReceived += new SerialDataReceivedEventHandler(OnDataReceived); SP1.Open(); rect = new RectangleF(0.1F, 0.7F, 0.8F, 0.3F); screenFont = new GTA.Font(0.07F, FontScaling.ScreenUnits); Interval = 100; this.PerFrameDrawing += new GraphicsEventHandler(this.mPerFrameDrawing); }
// Color screenBoxColor; public Kyori() { screenFont = new GTA.Font(0.15F, FontScaling.ScreenUnits); screenFont.Color = Color.Red; player = Player.Character; Interval = 10; this.Tick += new EventHandler(this.Kyori_Tick); this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing); //MODのロードが完了したと知らせる Game.DisplayText("MOD load successful.", 4000); }
private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e) { e.Graphics.Scaling = FontScaling.ScreenUnits; GTA.Font screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); if (TrendNitoro && Player.CanControlCharacter && Player.Character.isAlive) { if ((Time / 2) % 2 == 1) { e.Graphics.DrawText("※市ニトロ注意※", new RectangleF(0.0f, 0.15f, 1.0f, 0.1f), TextAlignment.Center | TextAlignment.Top, screenFont); } // e.Graphics.DrawRectangle(new RectangleF(0, 0, 1.0f, 0.05f), Color.FromArgb(30, 0, 0, 255)); } }
/* menu modes: * 1: scrolling * 2: select activate key * 3: select secondary key * 4: quit * 5: save and quit */ public GodmodePlus() { GeneralInfo = "Godmode Plus by thaCURSEDpie"; // Bind method BasicKeyExample_KeyDown to the KeyDown event screenFont = new GTA.Font(0.03f, FontScaling.ScreenUnits); setUpTexts(); loadSettings(); BindConsoleCommand("god", new ConsoleCommandDelegate(modOnConsole), "- Enable Godmode."); BindConsoleCommand("godmenu", new ConsoleCommandDelegate(openMenuConsole), "- Open the Godmode Plus menu."); this.PerFrameDrawing += new GraphicsEventHandler(this.DrawingExample_PerFrameDrawing); this.Tick += new EventHandler(this.TickEvent); Interval = 80; // Interval is the time between two Ticks (in milliseconds) this.KeyDown += new GTA.KeyEventHandler(this.KeyDownEvent); this.KeyUp += new GTA.KeyEventHandler(this.KeyUpEvent); }
public FLARE() { S = 0; T = 0; ActiveFlag = false; rnd = new Random(); cam = new Camera(); cam.Deactivate(); A = new Ped[4]; sFont = new GTA.Font(0.09F, FontScaling.ScreenUnits); Interval = 10; inputCheckerMOD.AddCheckKeys(new Keys[] { Keys.F, Keys.L, Keys.A, Keys.R,Keys.E }); this.Tick += new EventHandler(this.MOD_Tick); KeyDown += new GTA.KeyEventHandler(MOD_KeyDown); this.PerFrameDrawing += new GraphicsEventHandler(this.MOD_PerFrameDrawing); }
public PointControll() { Timer = 0; NowPoint = Share.POINTs; screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); isAdd = true; MissionAdd = false; Missions = false; provision = false; Interval = 100; this.Tick += new EventHandler(this.MOD_Tick); this.PerFrameDrawing += new GraphicsEventHandler(this.MOD_PerFrameDrawing); inputChecker.AddCheckKeys(new Keys[] { Keys.R, Keys.E, Keys.S, Keys.E, Keys.T }); inputChecker.AddCheckKeys(new Keys[] { Keys.OemMinus }); KeyDown += new GTA.KeyEventHandler(Point_KeyDown); Share.LoadPoint(); }
public CarDamage() { bod = 0; pet = 1; eng = 2; for (int i = 0; i < 3; i++) { Nom[i] = new GTA.Font(0.08F, FontScaling.ScreenUnits); small[i] = new GTA.Font(0.05F, FontScaling.ScreenUnits); switch (i) { case 0: Nom[i].Color = Color.Blue; small[i].Color = Color.Blue; break; case 1: Nom[i].Color = Color.Red; small[i].Color = Color.Red; break; case 2: Nom[i].Color = Color.Green; small[i].Color = Color.Green; break; } } D_Flag = new bool[3]; D_Timer = new int[3]; D = new float[3]; DC = new int[3]; Old = new float[3]; Posit = new Vector2[3]; rnd = new Random(); Reset(); player = Player.Character; Interval = 50; this.Tick += new EventHandler(this.Bombat_Tick); this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing); }
public JAMMING() { GUID = new Guid("915B924A-0D24-11E0-A534-02BCDFD72085"); BindScriptCommand("ChangeFlag", new ScriptCommandDelegate(ChangeFlag)); rnd = new Random(); JAMMING_FLAG = false; Interval = 200; scale = 0.14f; pX = 0.88f; pY = 0.04f; JAM_NO = Resources.GetTexture("JAMMING_NODOT.png"); JAM_DOT = Resources.GetTexture("JAMMING_DOT.png"); TimerFont = new GTA.Font(0.08F, FontScaling.ScreenUnits); TimerFont.Color = Color.Yellow; GTA.Native.Function.Call("ENABLE_FRONTEND_RADIO"); PerFrameDrawing += new GTA.GraphicsEventHandler(TextureDrawingExample_PerFrameDrawing); // KeyDown += new GTA.KeyEventHandler(JAM_KeyDown); this.Tick += new EventHandler(this.Bombat_Tick); }
public Parupunte() { screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); miniFont = new GTA.Font(0.03F, FontScaling.ScreenUnits); cam = GTA.Game.CurrentCamera; InitFlag = false; ChoseFlag = false; ActiveFlag = false; EndFlag = true; StopFlag = false; PlayerModel = Player.Model; skin = Player.Skin; FLAG_1 = false; Timer = 0; MaxTimer = -1; Number = -1; rnd = new Random(); inputCheckerMOD.AddCheckKeys(new Keys[] { Keys.R, Keys.N, Keys.T }); inputCheckerMOD.AddCheckKeys(new Keys[] { Keys.S, Keys.N,Keys.T}); inputCheckerMOD.AddCheckKeys(new Keys[] { Keys.A, Keys.S, Keys.N, Keys.T }); Interval = 100; this.Tick += new EventHandler(this.MOD_Tick); KeyDown += new GTA.KeyEventHandler(MOD_KeyDown); this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing); switch (Game.CurrentEpisode) { case GameEpisode.GTAIV: PlayerName = "ニコ"; break; case GameEpisode.TBOGT: PlayerName = "ルイス"; break; case GameEpisode.TLAD: PlayerName = "ジョニー"; break; } }
public static float GetTextWidth(string s, Font f, float scale) { Function.Call(Hash.SET_TEXT_FONT, (int) f); Function.Call(Hash.SET_TEXT_SCALE, scale, scale); Function.Call(Hash._0x54CE8AC98E120CAB, "STRING"); //SET_TEXT_ENTRY_FOR_WIDTH Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, s); return Function.Call<float>(Hash._0x85F061DA64ED2F67, 1); //_GET_TEXT_SCREEN_WIDTH }
public static float MeasureStringWidthNoConvert(string str, Font font, float scale) { Function.Call((Hash)0x54CE8AC98E120CAB, "STRING"); AddLongString(str); return Function.Call<float>((Hash)0x85F061DA64ED2F67, (int)font) * scale; }
public static float MeasureStringWidthNoConvert(string str, Font font, float scale) => Screen.GetTextWidth(str, font, scale);
private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e) { e.Graphics.Scaling = FontScaling.ScreenUnits; if (Player.CanControlCharacter && Player.Character.isAlive) { // e.Graphics.DrawText(string.Format("死者:{0, 3} / 破壊台数:{1,3} ",DC.AmountPed,DC.AmoutCars), new RectangleF(0.0f, 0.0f, 1.0f, 1.0f), TextAlignment.Center | TextAlignment.Top, screenFont); int j = 0; for (int i = 0; i < DPL.Timers.Length; i++) { if (DPL.Timers[DPL.NumberOfQueue(i)] > 0) { if (DPL.KilledByPlayer[DPL.NumberOfQueue(i)]) { Font = miniBigFont; } else { Font = miniFont; } Color cl; if (DPL.IsMissionChar[DPL.NumberOfQueue(i)]) { cl = Color.Red; } else { cl = Color.White; } e.Graphics.DrawText(DPL.str[DPL.NumberOfQueue(i)], new RectangleF(0.6f, 0.3f + 0.03f * j, 0.4f, 0.04f), TextAlignment.Right | TextAlignment.VerticalCenter, cl ,Font); DPL.Timers[DPL.NumberOfQueue(i)]--; if (DPL.Timers[DPL.NumberOfQueue(i)] == 0) { DPL.Check(); } j++; } } while (j < DPL.max) { // e.Graphics.DrawText(" ", new RectangleF(0.6f, 0.3f + 0.025f * j, 0.4f, 0.04f), TextAlignment.Right | TextAlignment.VerticalCenter, miniFont); j++; } } }
public HumanCounter() { DC = new DeadCounter(); DPL = new DeadPedList(10,Player); DC.Reset(); screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); Interval =500; this.Tick += new EventHandler(this.Bombat_Tick); this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing); KeyDown += new GTA.KeyEventHandler(Meteoat_KeyDown); inputChecker.AddCheckKeys(new Keys[] { Keys.R, Keys.E, Keys.S, Keys.E, Keys.T }); inputChecker.AddCheckKeys(new Keys[] { Keys.OemMinus }); miniFont = new GTA.Font(0.03F, FontScaling.ScreenUnits, false, false); miniBigFont = new GTA.Font(0.03F, FontScaling.ScreenUnits, true, true); }
public Label(string caption, Point position, float scale, Color color, Font font) : base(caption, position, scale, color, font, false) { Init(); }
public Label(string caption, Point position, float scale, Color color, Font font, bool centered) : base(caption, position, scale, color, font, centered) { Init(); }
public Label(string caption, Point position, float scale, Color color, Font font, bool centered, bool shadow, bool outline) : base(caption, position, scale, color, font, centered, shadow, outline) { Init(); }
public void SetLabel(string txt, float sc, Color c, Font f) { label = new Label(txt, new Point(OriginalPos.X+ OrigionalSize.Width/2, OriginalPos.Y+5), sc, c, f, false); label.SetAlignment(Label.Alignment.CENTER); }
private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e) { if (Player.Character.isInVehicle()) { e.Graphics.Scaling = FontScaling.ScreenUnits; // size on screen will always be the same, regardless of resolution for (int i = 0; i < 30; i++) { Vector3 V; GTA.Font F; //Engine if (E.IsDamegeActive(i)) { V = E.Pos[i]; F = new GTA.Font(0.04f, FontScaling.ScreenUnits); F.Color = E.GetColor(i); e.Graphics.DrawText(string.Format("-{0:f1}", E.Damage[i]), new RectangleF(V.X, V.Y, 0.1f, 0.5f), TextAlignment.Left | TextAlignment.Top, F); } //Body if (B.IsDamegeActive(i)) { V = B.Pos[i]; F = new GTA.Font(0.04f, FontScaling.ScreenUnits); F.Color = B.GetColor(i); e.Graphics.DrawText(string.Format("-{0:f1}", B.Damage[i]), new RectangleF(V.X, V.Y, 0.1f, 0.5f), TextAlignment.Left | TextAlignment.Top, F); } //Petrol if (P.IsDamegeActive(i)) { V = P.Pos[i]; F = new GTA.Font(0.04f, FontScaling.ScreenUnits); F.Color = P.GetColor(i); e.Graphics.DrawText(string.Format("-{0:f1}", P.Damage[i]), new RectangleF(V.X, V.Y, 0.1f, 0.5f), TextAlignment.Left | TextAlignment.Top, F); } } } }
private void Kyori_PerFrameDrawing(object sender, GraphicsEventArgs e) { e.Graphics.Scaling = FontScaling.ScreenUnits; GTA.Font screenFont = new GTA.Font(0.03F, FontScaling.ScreenUnits); for (int i = 0; i < 10; i++) { e.Graphics.DrawText(string.Format("{0}", times[i]), new RectangleF(0.1f, 0.04f + i * 0.042f, 0.08f, 0.04f), TextAlignment.Left | TextAlignment.VerticalCenter, screenFont); } }
private void TextureDrawingExample_PerFrameDrawing(System.Object sender, GTA.GraphicsEventArgs e) { e.Graphics.Scaling = FontScaling.ScreenUnits; if (Counter > 15 + 35) { screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); e.Graphics.DrawText("ブラックアウト!", new RectangleF(0.0f, 0.85f, 1.0f, 0.1f), TextAlignment.Center | TextAlignment.Top, screenFont); } else if(Counter > 35) { screenFont = new GTA.Font(0.1F, FontScaling.ScreenUnits); screenFont.Color = Color.FromArgb(64,235,50); e.Graphics.DrawRectangle(new RectangleF(0, 0, 1.0f, 1.0f), Color.FromArgb(255, 0, 0, 0)); e.Graphics.DrawText("ヒデオ", new RectangleF(0.75f, 0.05f, 0.2f, 0.1f), TextAlignment.Right | TextAlignment.Top, screenFont); } else if (Counter > 0) { screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); screenFont.Color = Color.FromArgb(64, 235, 50); e.Graphics.DrawRectangle(new RectangleF(0, 0, 1.0f, 1.0f), Color.FromArgb(255, 0, 0, 0)); e.Graphics.DrawText("ヒデオ", new RectangleF(0.75f, 0.05f, 0.2f, 0.1f), TextAlignment.Right | TextAlignment.Top, screenFont); } }
public static void DrawText(string text, PointF position, float size, Color color, int justify, Font font, bool shadow, bool outline) { var resolution = GetScreenResolution(out var a); var offset = GetOffsetForAspectRatio(a); Function.Call(Hash.SET_TEXT_FONT, (int)font); Function.Call(Hash.SET_TEXT_SCALE, size, size); Function.Call(Hash.SET_TEXT_COLOUR, color.R, color.G, color.B, color.A); if (shadow) { Function.Call(Hash.SET_TEXT_DROP_SHADOW); } if (outline) { Function.Call(Hash.SET_TEXT_OUTLINE); } switch (justify) { case 0: Function.Call(Hash.SET_TEXT_CENTRE, true); break; case 1: Function.Call(Hash.SET_TEXT_JUSTIFICATION, justify); break; case 2: Function.Call(Hash.SET_TEXT_RIGHT_JUSTIFY, true); Function.Call(Hash.SET_TEXT_WRAP, 0, position.X / resolution.Width + offset); break; } Function.Call(Hash.SET_TEXT_JUSTIFICATION, justify); Function.Call(Hash._0x25FBB336DF1804CB, "jamyfafi"); // BEGIN_TEXT_COMMAND_DISPLAY_TEXT Function.Call(Hash._0x6C188BE134E074AA, text); // ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME Function.Call(Hash._0xCD015E5BB0D96A57, position.X / resolution.Width + offset, position.Y / resolution.Height + offset); // END_TEXT_COMMAND_DISPLAY_TEXT }
public SpeedMeter() { screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); PerFrameDrawing += new GTA.GraphicsEventHandler(TextureDrawingExample_PerFrameDrawing); }
// LightsControl lc; public MeteoStorm() { // lc = new LightsControl(5); T = 0; GUID = new Guid("060201CC-E734-11DF-9215-D104DFD72085"); BindScriptCommand("ChangeProbability", new ScriptCommandDelegate(ChangeProbability)); Easy = false; Interval = 400; seed = rnd.Next(); screenFont = new GTA.Font(0.05F, FontScaling.ScreenUnits); F_Probability = -1; Probability = Disp_Probability = 20; MeteoInterval = 0; RF = new RectangleF(0.0f, 0.2f, 1.0f, 0.2f); inputCheckerMeteo.AddCheckKeys(new Keys[] { Keys.M, Keys.E, Keys.T, Keys.E, Keys.O }); inputCheckerMeteo.AddCheckKeys(new Keys[] { Keys.A, Keys.L, Keys.L, Keys.O, Keys.N }); inputCheckerMeteo.AddCheckKeys(new Keys[] { Keys.E, Keys.A, Keys.S, Keys.Y }); this.Tick += new EventHandler(this.Meteoat_Tick); KeyDown += new GTA.KeyEventHandler(Meteoat_KeyDown); this.PerFrameDrawing += new GraphicsEventHandler(this.Kyori_PerFrameDrawing); }
public UIResText(string caption, Point position, float scale, Color color, Font font, Alignment justify) : base(caption, position, scale, color, font, false) { TextAlignment = justify; }