SkyRaign

Member
  • Content count

    9
  • Joined

  • Last visited

Community Reputation

109 Neutral

About SkyRaign

  • Rank
    Newbie
  1. I can't seem to attach pics directly, so I'll do the next best thing:   //This is how the square SHOULD look     XXXX   XXXX   XXXX   XXXX   //This is how it actually comes out:     XXXXXX   XXXXXX   XXXXXX   XXXXXX   In regards to the projection matrix, I will have to do some more research on this one in time, but this is the function I have to initialize it: D3DXMatrixOrthoOffCenterLH(_matProjection,float(_viewport->TopLeftX),float(_viewport->Width),float(_viewport->TopLeftY),float(_viewport->Height),0.1,10); Note that this function call is nested in a function call to initialize all of my directX components.  This comes almost straight out of Wendy Jones' book "DirectX 10 for beginners" but it works......now it needs some tweaking.
  2. Matias, that is precisely what I meant......sorry for my lack of lingo.   DXGI_SWAP_CHAIN_DESC gSwapChain;     gSwapChain.BufferDesc.Width=VIEWPORT_WIDTH;     gSwapChain.BufferDesc.Height=VIEWPORT_HEIGHT*1050/1680   This takes care of the aspect ratio for my specific monitor, applying the 1/AR method you indicated.  I can also apply AR to the X axis for a similar effect; this just "shrinks" the square area.  (Actually, this seems counterintuitive to what I understand about AR......it's width/height, right?).   I will make it a point to look up some tutorials since this doesn't seem like it should be that complicated.  I want to, in theory, be able to run this app on any monitor.  This is strictly 2D with Direct3D10 so that should narrow things down a bit.
  3. Hi all!   I use lots of square tiles in my project, e.g. 32 x 32 map tiles.  I am having some trouble formatting the application to display them as perfect squares, as intended.  It seems that the pixels are "stretched" to accommodate the size of the application window, so when I see it, it is an elongated rectangle.  My intention at the end is to run this in "fullscreen" mode, so any adjustments I would make would be with that in mind.  Does anyone have tips?  I would appreciate that a lot.
  4. Problem solved.  This topic can be nuked.
  5. I am just coming back to my project after a bit of a hiatus.  Where I left off was working on incorporating graphics files (.BMP, .PNG mostly) into my game without having to rely on accessing the hard disk each and every time I call the graphics up.  Someone here helped me out with this (Adeyblue) and I was able to get it functional.    What I ended up doing was to add my graphics files to the *.rc, then go into the *.rc file and change their types from BITMAP or PNG to RCDATA ///////////////////////////////////////////////////////////////////////////// // // RCDATA // IDB_BITMAP2 RCDATA "C:\\filepath"   And from here, I call up the resources in the main like so: ID3D10Texture2D* texture2D=0; ID3D10Resource* pD3D10Resource=0;   HRSRC hResource = FindResource(hInstance, MAKEINTRESOURCE(IDB_BITMAP2), RT_RCDATA); HGLOBAL hResourceData = LoadResource(hInstance, hResource); PVOID data = LockResource(hResourceData); DWORD dataSize = SizeofResource(hInstance, hResource); hResult = D3DX10CreateTextureFromMemory(pD3DDevice, data, dataSize, 0, 0, &pD3D10Resource, 0); What I want to do now is incorporate tables of sprites, map tiles, etc. all into one or two files that I will be using.  This makes the most sense for animations as all I would need to do is change the index to the next animation frame.  Using this method, I would have to load an entire file into memory, then copy only the specific regions that I want to display.    My question is, does it make sense to load all of those graphics (sprites, tiles, etc.) into memory once and have them tie up system memory until the *.exe terminates?  Or is there a different way to access the graphics so I can load only the parts I want into memory?  Alternatively, do you have any suggestions as to a different approach altogether?
  6. Well Ravnock I looked into the links you provided.  Having investigated further I still cannot see why D3DX10CreateTextureFromResource is not working.  The second parameter should be a handle to the instance creating it, which in my case should be the .exe.  Having made that change it still does not work.   hResult=D3DX10CreateTextureFromResource(pD3DDevice,GetModuleHandle(0), MAKEINTRESOURCE(IDB_BITMAP1), 0 , 0 ,  &pD3D10Resource , 0 );     I tried using D3DX10CreateTextureFromMemory as follows:   HBITMAP hBit = LoadBitmap(hInstance,MAKEINTRESOURCE(IDB_BITMAP1)); hResult=D3DX10CreateTextureFromMemory(pD3DDevice,hBit, 0 , 0 , 0 , &pD3D10Resource , 0 );   It did not work, even if I cast hBit to "HMODULE".  LoadBitmap() -->DOES<-- return a valid pointer to a bitmap, but now I am left with how to access it through Direct3D10.  The second paramter to the function call is an LPCVOID pointer but I can't seem to make it work for me.  Still, all I am getting here is E_FAIL in the hResult return value.   Bout ready to pull the hair out of my head here.  What on earth could I be missing?  Is it maybe a linker issue?
  7. Ok so I have seemingly made some progress.  Here is what the code looks like now:   In my resource file, "resource3.h":   #define IDB_BITMAP1 101   In my main file:   #include "resource3.h"   hResult = D3DX10CreateTextureFromResource(pD3DDevice,0,MAKEINTRESOURCE(IDB_BITMAP1),0,0,&pD3D10Resource,0);   This example compiles, but the hResult always returns as "E_FAIL".  Conveniently enough, this is the "unspecified" code.  Some of the tutorials I have read have indicated coding things this way but it just isn't working.  Any thoughts?
  8. Ravnock: You are undoubtedly right about the game size but right now I am just trying to learn how to use the resources. This is SOOOOOOO frustrating. I looked at the links you posted and followed http://www.winprog.o.../resources.html the best I could (using "BITMAP" as a resource type instead of "ICON") but it did not work. Nick C.: Noting the above, this is the result of what I get: In my resource file, "resource3.h" #define IDB_BITMAP1 101 In my main file: #include "resource3.h" ~ ~ ~ ~ IDB_BITMAP1 BITMAP "Image.bmp"; ^^^these are the compiler errors that I get 1>DirectX10 Exp Part 2.cpp(214): error C2146: syntax error : missing ';' before identifier 'BITMAP' 1>DirectX10 Exp Part 2.cpp(214): error C2143: syntax error : missing ';' before 'string'1>DirectX10 Exp Part 2.cpp(214): error C2275: 'BITMAP' : illegal use of this type as an expression I haven't even gotten to creating textures yet. Bottom line is I want to be able to use these bitmap resources to create textures through Direct3D10 functionality. This seems like such a simple issue but I cannot find ANY helpful documentation on this!
  9. Hi, I am trying to find a way to use bitmaps in my game without having to load files from the hard disk at runtime.  I can include bitmap files into a *.rc, but I have searched on the web for hours and cannot find a way to access the images from code.  Nothing I have tried has worked.   This is the "name" that my file "TryRes.rc" has given my bitmap:   IDB_BITMAP1   This identified throws a compiler error, saying it is "undeclared".    I am using DirectX10 for graphics; my intention is to use "CreateTextureFromResource" once I am able to access the images...unless someone knows a better way to do this.  The idea is to be able to port the executable over to another computer and still be able to run it without all the extra graphics files.
  10. Untitled Album