Jump to content

Reynolds_

Members
  • Posts

    8
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Reynolds_'s Achievements

Newbie

Newbie (4/54)

0

Reputation

  1. Although it seems that "support for CFF OpenType fonts with dxCreateFont" has been added to MTA 1.4, I'm still unable to add any OTF fonts to my server w/ the dxdraw api. Because most of my GUI fonts are OTF (because they are less ugly & anti-aliased better), not being able to use them is a big problem for me. The question is simple: How can I use otf fonts in dxCreateFont? (No code is posted as the problem simply happens whenever I try to use a font with .otf extension w/ dxCreateFont. The same code works perfectly fine w/ .ttf fonts.)
  2. Problem is solved. I looked up the issue on some German/Russian forums and executing dbExec(gDbInstance, "SET NAMES 'utf8';") after connecting seems to have solved my issues.
  3. I am trying to make a simple GUI with data queried from a MySQL table. The problem is that accents do not appear properly in the game: This is the line for the sql conncetion: gDbInstance = dbConnect( "mysql", "dbname=xxx;host=localhost", "xyx", "xxyxy", "charset=utf8" ) What can cause the issue and how am I able to resolve it? I have all my tables and fields set to utf8_general_ci.
  4. Thanks for your answers. I got to dxGetWidth already, and, as I said, I am more concerned with word wrapping and its effect on this whole thing. I would want to keep my text's width constant and set the height according to the amount of text in the dxText. I already found my answer, which is the dxGetFontHeight function. It was kind of stupid, I must've missed it late at night. Thanks for all your answers.
  5. Simply put, how am I supposed to make a dynamic bounding box? The box's size should change with the text in the GUILabel/d3text. If I type in more text, it should expand to accomodate said text, if I type in less text, it should retract. To be more precise, I want a dialog box similar to the ones found in all GTA Games positioned in the top left corner which shows hints & other stuff to the palyer.
  6. You should read what I've originally posted. I've never claimed that that particular part of the script was mine, the renderer was from another resource, but I did the radar frame itself, I resized the whole radar to fit my particular GUI and I edited a lot of other stuff on it. It is just the case that the part from the other resource (which I had to use because I am a noob when it comes to graphics rendering) is the very reason the script does not work properly. Anyways, how would I set about taking the cursor's relative position & w/h into consideration? As I said, the whole thing is a black spot for me, so I would appreciate it if someone could give me some help as to how I should begin editing the script. Another thing is that the problem happened when I edited the script originally found in the resource you posted, to be exact, when I resized the original map to fit my radar frame. The cursor's size was not the problem, resizing the map was. I did resize the cursor but it didn't affect anything, however, as soon as I changed the dimensions of the map, even if I scaled it down instead of changing the whole w/h ratio, it screwed up and didn't rotate properly.
  7. If I change gUVRotCenter to the (x,y) position normalized to the map's size, it will have a "globe effect" instead of the effect I want. To be honest, low-level graphics manipulation has never been my thing. Could you recommend a way to make this work properly using the shader I posted? e.1.: btw this problem appeared first when I resized the map from the resource I edited. The rotation was completely fine with the original width/height params.
  8. I'm trying to make a simple radar which is rectangular and looks like the one from Grand Theft Auto V. I've managed to do most of the work and did a couple of edits from other resources when I needed to. My problem is that the 'map rotation' & the 'blip rotation' doesn't quite match up and sometimes I end up being at four different positions depending on how I rotate my mouse. Pictures: http://imagerz.com/QBVAX0tvAwMMUltEQAVQ http://imagerz.com/QBVAX0tvAwMMUltEQwVQ http://imagerz.com/QBVAX0tvAwMMUltEQgVQ http://imagerz.com/QBVAX0tvAwMMUltERQVQ The corresponding renderer: function updateHUD1 ( ) if not guiGetVisible(Radar.Frame) then return end local hp = getElementHealth ( getLocalPlayer() ) if hp > 100 then hp = 100 end local armor = getPedArmor ( getLocalPlayer() ) if armor > 100 then armor = 100 end guiSetSize ( Radar.Armor, 0.465*armor*0.01, 0.056, true ) guiSetSize ( Radar.Health, 0.465*hp*0.01, 0.056, true ) dxSetShaderValue( Radar.maskFX, "sMaskTexture", Radar.maskTexture ) local x,y = getElementPosition( localPlayer ) local zoom = 13 x = ( x ) / 6000 y = ( y ) / -6000 dxSetShaderValue( Radar.maskFX, "gUVPosition", x,y ) dxSetShaderValue( Radar.maskFX, "gUVScale", 1/zoom, 1/zoom ) local _, _, c_Rot = getElementRotation( getCamera()); local _, _, p_Rot = getElementRotation( localPlayer ) dxSetShaderValue( Radar.maskFX, "gUVRotAngle", math.rad( -c_Rot )) dxDrawImage(70*sW, 562*sH, 0.64*265*sW, 0.83*135*sH, Radar.maskFX, 0,0,0, tocolor(255,255,255,210)) dxDrawImage(149.5*sW, 618.025*sH, 10*sW, 10*sH, "map/img/radar_player.png", -p_Rot+c_Rot, 0, 0, tocolor(255, 255, 255, 255)) end addEventHandler( "onClientRender", root, updateHUD1) The masking shader: // // Example shader - hud_mask.fx // #include "fx/matrix.fx" /////////////////////////////////////////////////////////////////////////////// // Global variables /////////////////////////////////////////////////////////////////////////////// texture sPicTexture; texture sMaskTexture; float2 gUVPrePosition = float2( 0, 0 ); float2 gUVScale = float( 1 ); // UV scale float2 gUVScaleCenter = float2( 0.5, 0.5 ); float gUVRotAngle = float( 0 ); // UV Rotation float2 gUVRotCenter = float2( 0.5, 0.5 ); float2 gUVPosition = float2( 0, 0 ); // UV position /////////////////////////////////////////////////////////////////////////////// // Functions /////////////////////////////////////////////////////////////////////////////// //------------------------------------------- // Returns UV transform using external settings //------------------------------------------- float3x3 getTextureTransform() { return makeTextureTransform( gUVPrePosition, gUVScale, gUVScaleCenter, gUVRotAngle, gUVRotCenter, gUVPosition ); } /////////////////////////////////////////////////////////////////////////////// // Techniques /////////////////////////////////////////////////////////////////////////////// technique hello { pass P0 { // Set up texture stage 0 Texture[0] = sPicTexture; TextureTransform[0] = getTextureTransform(); TextureTransformFlags[0] = Count2; AddressU[0] = Clamp; AddressV[0] = Clamp; // Color mix texture and diffuse ColorOp[0] = Modulate; ColorArg1[0] = Texture; ColorArg2[0] = Diffuse; // Alpha mix texture and diffuse AlphaOp[0] = Modulate; AlphaArg1[0] = Texture; AlphaArg2[0] = Diffuse; // Set up texture stage 1 Texture[1] = sMaskTexture; TexCoordIndex[1] = 0; AddressU[1] = Clamp; AddressV[1] = Clamp; // Color pass through from stage 0 ColorOp[1] = SelectArg1; ColorArg1[1] = Current; // Alpha modulate mask texture with stage 0 AlphaOp[1] = Modulate; AlphaArg1[1] = Current; AlphaArg2[1] = Texture; // Disable texture stage 2 ColorOp[2] = Disable; AlphaOp[2] = Disable; } }
×
×
  • Create New...