Results 1 to 8 of 8

Thread: OpenGL Include [Development]

  1. #1
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default OpenGL Include [Development]

    Been Playing with Brandons OGL and thought i would help try get the ball rolling with the development of the include.

    here's what ive played about with so far

    Simba Code:
    {$loadlib GLHook}

    type TModel = record
      ID: Cardinal;
      SX, SY: Integer;
      Stride: Cardinal;
      TriangleCount: Integer;
    end;

    type TFontInfo = record
      ID: Cardinal;
      R, G, B, A: Byte;
      Colour: Integer;
      X, Y: Single;
      Symbol: Char;
      Shadow: Boolean;
      Translate: Array [0..2] Of Single;
      VX, VY, TX, TY: Array [0..3] Of Integer;
    end;

    type PFontInfo = ^TFontInfo;
    type TFontArray = array of TFontInfo;
    type pByte = ^Byte;
    type pInt  = ^Integer;
    type pBool = ^Boolean;
    type pFloat = ^Single;


    //Brandons
    Function GLHook_GetFontsByArea(Area: TBox): TFontArray;
    var
      Ptr: Pointer;
      Size, I: Integer;
    begin
      Ptr := GLHGetFontsArea(Area.X1, Area.Y1, Area.X2, Area.Y2, Size);
      SetLength(Result, Size);
      For I := 0 To Size - 1 Do
      begin
        Result[I].ID := pInt(Ptr)^;
        Ptr := Ptr + sizeof(Integer);

        Result[I].R := pByte(Ptr)^;
        Result[I].G := pByte(Ptr + sizeof(Byte))^;
        Result[I].B := pByte(Ptr + (2 * sizeof(Byte)))^;
        Result[I].A := pByte(Ptr + (3 * sizeof(Byte)))^;
        Ptr := Ptr + (sizeof(Byte) * 4);

        Result[I].Colour := RGBToColor(Result[I].R, Result[I].G, Result[I].B);

        Result[I].X := pFloat(Ptr)^;
        Result[I].Y := pFloat(Ptr + sizeof(Single))^;
        Ptr := Ptr + (sizeof(Single) * 2);

        Result[I].Symbol := pChar(Ptr)^;
        Result[I].Shadow := pBool(Ptr + sizeof(Boolean))^;
        Ptr := Ptr + (sizeof(Char) + sizeof(Boolean)) + 2;  //Padded by 2.

        Result[I].Translate[0] := pFloat(Ptr)^;
        Result[I].Translate[1] := pFloat(Ptr + sizeof(Single))^;
        Result[I].Translate[2] := pFloat(Ptr + (2 * sizeof(Single)))^;
        Ptr := Ptr + (sizeof(Single) * 3);

        Result[I].VX[0] := pInt(Ptr)^;
        Result[I].VX[1] := pInt(Ptr + sizeof(Integer))^;
        Result[I].VX[2] := pInt(Ptr + (2 * sizeof(Integer)))^;
        Result[I].VX[3] := pInt(Ptr + (3 * sizeof(Integer)))^;
        Ptr := Ptr + (sizeof(Integer) * 4);

        Result[I].VY[0] := pInt(Ptr)^;
        Result[I].VY[1] := pInt(Ptr + sizeof(Integer))^;
        Result[I].VY[2] := pInt(Ptr + (2 * sizeof(Integer)))^;
        Result[I].VY[3] := pInt(Ptr + (3 * sizeof(Integer)))^;
        Ptr := Ptr + (sizeof(Integer) * 4);

        Result[I].TX[0] := pInt(Ptr)^;
        Result[I].TX[1] := pInt(Ptr + sizeof(Integer))^;
        Result[I].TX[2] := pInt(Ptr + (2 * sizeof(Integer)))^;
        Result[I].TX[3] := pInt(Ptr + (3 * sizeof(Integer)))^;
        Ptr := Ptr + (sizeof(Integer) * 4);

        Result[I].TY[0] := pInt(Ptr)^;
        Result[I].TY[1] := pInt(Ptr + sizeof(Integer))^;
        Result[I].TY[2] := pInt(Ptr + (2 * sizeof(Integer)))^;
        Result[I].TY[3] := pInt(Ptr + (3 * sizeof(Integer)))^;
        Ptr := Ptr + (sizeof(Integer) * 4);
      end;
    end;
    //Brandons
    Function FontsToText(var FontArray: TFontArray; Shadow: Boolean; MinHSpacing: Integer; MinVSpacing: Integer): TStringArray;
    var
      I, J, L: Integer;
      Str: String;
    Begin
      L := High(FontArray);

      If Shadow Then J := 1 Else J := 2;
      SetLength(Result, 1);

      For I := 0 To L Do
        If (FontArray[I].Shadow = Shadow) Then
        Begin
          If (((FontArray[I].Translate[0] - (FontArray[I - J].Translate[0] + FontArray[I - J].VX[3] - FontArray[I - J].VX[0])) >= MinHSpacing) And (I >= 2)) Then
            Str := Str + ' ';

          If ((((FontArray[I].Translate[1] - FontArray[I - J].Translate[1]) >= MinVSpacing) And (I >= 2) And MinVSpacing > 0) Or (Ord(FontArray[I].Symbol) = 10)) Then
            Str := Str + Chr(13);

          If (Ord(FontArray[I].Symbol) <> 10) Then
            Str := Str + FontArray[I].Symbol;
        End;

      ExplodeWrap(Chr(13), Str, Result);
      For I := 0 To High(Result) Do
        Result[I] := Trim(Result[I]);
    End;

    function GLGetTextPosEx(TB:TBox;Text:String):TPoint;
    var
    FF:TFontArray;
    TP:TPoint;
    Found:TStringArray;
    begin
        FF:=GLHook_GetFontsByArea(TB);
        Found:=FontsToText(FF,0,0,0);
      if Found[0] = Text then
      begin
        writeln(Found);
        Result:=Point(round(FF[0].x),round(FF[0].y));
      end else
        writeln('faied');
    end;

    function GLIsTextEx(TB: TBox; Text: string): Boolean;
    var
      FA: TFontArray;
      Found: TStringArray;
    begin
      FA := GLHook_GetFontsByArea(TB);
      Found := FontsToText(FA, 0, 0, 0);
      if Found[0] = Text then
      begin
        Result := true;
        writeln(Found[0]);
      end else
        Result := false;
    end;

    function GLGetTextEx(TB: TBox): string;
    var
      FA: TFontArray;
      Found: TStringArray;
    begin
      FA := GLHook_GetFontsByArea(TB);
      Found := FontsToText(FA, 0, 0, 0);
      Result:=Found[0];
    end;

    function GLIsUpText(Text:string):Boolean;
    var
    TB:TBox;
    begin
      TB:=IntToBox(7, 56, 83, 74);
      Result:=GLIsTextEx(TB,Text);
    end;

    function GLGetModelPos(ID:integer):TPoint;
    var
       P: Pointer;
       M: ^TModel;
       X, Y, Size:integer;
    begin
       P := GLHGetModelsByID(ID, Size);
       M := P;
       Result:=Point(Result.x:=M^.SX+randomRange(-2, 2),Result.y:=M^.SY+randomRange(-2, 2));
    end;

    function GLGetItemPos(ID:integer):TPoint;
    var
       P: Pointer;
       M: ^TModel;
       X,Y,Size:integer;
    begin
       P := GLHGetItemsByID(ID, Size);
       M := P;
       Result:=Point(Result.x:=M^.SX+randomRange(-2, 2),Result.y:=M^.SY+randomRange(-2, 2));
    end;;

  2. #2
    Join Date
    Oct 2011
    Posts
    207
    Mentioned
    1 Post(s)
    Quoted
    20 Post(s)

    Default

    Is there any other way o read text from OGL expect OCR? or is it planned for future developing?

  3. #3
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    Quote Originally Posted by djborec View Post
    Is there any other way o read text from OGL expect OCR? or is it planned for future developing?
    What do you mean? the current method (ogl) can read text 100% correctly.

  4. #4
    Join Date
    Mar 2012
    Posts
    690
    Mentioned
    2 Post(s)
    Quoted
    40 Post(s)

    Default

    Not to be a dick but you did a double ";" at the bottom

  5. #5
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default

    oh lol i just copy pasted parts from my own include

  6. #6
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    I'm at school right now.. so I don't have time to check over everything but as far as I can tell from skimming through, this won't work.

    Simba Code:
    P := GLHGetModelsByID(ID, Size);
       M := P;
       Result:=Point(Result.x:=M^.SX+randomRange(-2, 2),Result.y:=M^.SY+randomRange(-2, 2));

    That kind of stuff won't work. The functions from the DLL include return a pointer to an array of "Whatever".. NOT a single entity.
    I am Ggzz..
    Hackintosher

  7. #7
    Join Date
    May 2007
    Location
    England/Liverpool
    Posts
    1,004
    Mentioned
    9 Post(s)
    Quoted
    106 Post(s)

    Default

    these function are just wht i used to test out your plugin didnt need to sort though the array as there was only 1 matching id available
    i will continue to develop these function just wanted to get others interested in your project


    I have tested all Function they do work maybe explode the Text again to remove spaces but all seems fine to me
    Last edited by Mark; 10-03-2012 at 07:31 PM.

  8. #8
    Join Date
    Sep 2010
    Location
    Azeroth
    Posts
    395
    Mentioned
    0 Post(s)
    Quoted
    17 Post(s)

    Default

    $i ogl? lol not that easy

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •