Jump to content

  • Log In with Google      Sign In   
  • Create Account

SkyRaign

Member Since 23 Dec 2012
Offline Last Active Aug 10 2014 07:24 PM

Posts I've Made

In Topic: DirectX 10 - Displaying tile squares as...squares?

10 August 2014 - 07:27 PM

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.


In Topic: DirectX 10 - Displaying tile squares as...squares?

09 August 2014 - 07:48 PM

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.


In Topic: Using bitmap resources (*.rc) in Visual Studio 2010

23 December 2012 - 10:49 PM

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?


In Topic: Using bitmap resources (*.rc) in Visual Studio 2010

23 December 2012 - 04:16 PM

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?


In Topic: Using bitmap resources (*.rc) in Visual Studio 2010

23 December 2012 - 09:54 AM

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!

PARTNERS