Author Topic: [C] Possible Reasons?  (Read 8946 times)

0 Members and 1 Guest are viewing this topic.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
[C] Possible Reasons?
« on: January 09, 2010 »
This occurs in everything I've done to date in CPP, which I don't understand why it keeps popping up. i've only used tinyptc for drawing to the screen with, just as its what im used to.
 
1>LIBCMT.lib(cpu_disp.obj) : warning LNK4210: .CRT section exists; there may be unhandled static initializers or terminators
 
firstly, what is .CRT ( is that a lib for the monitor? )
does this also mean that in the LIBCMT.lib there are static variables that aren't set to for eg static int scan_line=0 and maybe aren't being used?
 
I know this is a warning, so I may have to count my stars and live with it!
 
Cheers and thanks so much,
Clyds.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C] Possible Reasons?
« Reply #1 on: January 10, 2010 »
Clyde - all the problems you are having relate to the fact you are using the tinyptc library.  It's not really set up right for using in C++.  It has several things in it that force you to jump through all the hoops we discussed earlier.

CRT = C Run Time library (libc)

LIBCMT = libc, Multi-Threaded

Static initialisers are something that C++ uses.  For instance, you can write

Engine *startup =  new Engine();

at global scope and it will run before main() is called.

Jim
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C] Possible Reasons?
« Reply #2 on: January 10, 2010 »
Many thanks for the information Jim.
I'll put this on my Birthday wish list, and wonder if members with alot more skill than I, might be up for working out a tiny ptc C++ version / equivalent.

There's no harm in asking!

Cheers and huge respect,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C] Possible Reasons?
« Reply #3 on: January 10, 2010 »
Check out this post:
http://www.dbfinteractive.com/forum/index.php/topic,1638.0.html
It's based on a simple Windows framework that I wrote and Stonemonkey improved (sorry can't find the original).  Tetra added some triangle drawing.  It doesn't use any extra libraries at all, and is fast and simple.  I use it (or something very like it) for all my pixel demos.
I think this would be a better place to start.

Jim
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: [C] Possible Reasons?
« Reply #4 on: January 11, 2010 »
i dont know if anyone would be interested but i managed to take your oglptc code jim and include it in my project a while back so that my project and oglptc all builds up without any libs it works great but i dont know if others particularly like ogl for this.

i do however so i use it.

@clyde if you want to include a few files in your project you can get rid of the lib and make your project more c++ friendly plus jims framework alows for some extra functionality that the normal ptc doesnt like full 3d ogl rendering if you wish.

if you would like to give it a shot then i will post up an example.
Challenge Trophies Won:

Offline bj

  • ZX 81
  • *
  • Posts: 20
  • Karma: 10
    • View Profile
Re: [C] Possible Reasons?
« Reply #5 on: January 11, 2010 »
I'd love to see an example. I'm some way off being able to use it at the mo (Doing the exercises in ch 6 of Deitel's How to Program C++, 6th edition at the mo - only 18 more chapters to go!)

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C] Possible Reasons?
« Reply #6 on: January 12, 2010 »
Thanks Jim & Nino ( post it up Im sure many would benefit from it )
Will look more closely at that. tried compiling and told me about being unable to convert a T Char.

Is that method known as GDI or is it using Direct2D like ptc?
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C] Possible Reasons?
« Reply #7 on: January 12, 2010 »
This is GDI, straight Windows blit from system memory to video.  It's pretty quick.  About the same as a DirectDraw blit.  About the same as a texture load.

Can you go into the Project settings and change it from unicode to multibyte (we've done this before, I think it's in the configuration settings under project properties)?  That should fix the TCHAR problem.

Jim
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: [C] Possible Reasons?
« Reply #8 on: January 12, 2010 »
ok guys im on a new comp at the mo so i will install my dev stuff and post an example up.
Challenge Trophies Won:

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C] Possible Reasons?
« Reply #9 on: January 13, 2010 »
Cool!

I'll still be looking out for a cpp version / equivalent of TinyPTC ext for CPP if its poss, in the mean time it's a good learning curve.

I have a few more questions which I'll post up later in a new thread, for now though Dudes, how'd I set the gdi framework for a fullscreen application?

<edit - aarr 5q>
 
I like how rbz has made it, and small exe.s

Cheers,
Clyde.
« Last Edit: January 13, 2010 by cLYdE »
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline hellfire

  • Sponsor
  • Pentium
  • *******
  • Posts: 1294
  • Karma: 466
    • View Profile
    • my stuff
Re: [C] Possible Reasons?
« Reply #10 on: January 13, 2010 »
Quote
still be looking out for a cpp version of TinyPTC
The original version of TinyPTC *is* C but doesn't include the features rbz added to TinyPTC Ext (which is C, too).
If you're not interessted in very small file-size, I'd recommend to look at PixelToaster.
On the other hand pixel-effects are pretty much obsolete - unless, of course, your code is optimized enough to fill my hd-screen.
So better grab SFML instead.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C] Possible Reasons?
« Reply #11 on: January 13, 2010 »
Quote
how'd I set the gdi framework for a fullscreen application?

You have two choices:
1) create the window as the same res as the screen and set the position to 0,0
2) switch the display size using ChangeDisplaySettingsEx(), create the window at that size and set the position to 0,0

The problem with forcing the display res is that often you want 640x480 but noone has screens that shape any more, so all the demos appear stretched.  It should be 848x480.

Jim
Challenge Trophies Won:

Offline rdc

  • Pentium
  • *****
  • Posts: 1495
  • Karma: 140
  • Yes, it is me.
    • View Profile
    • Clark Productions
Re: [C] Possible Reasons?
« Reply #12 on: January 16, 2010 »
SFML looks quite useful. It appears to have a lot of capability and supports a variety of compilers. I will have to take a look at this one more closely. It looks to be a good graphic library alternative.

Offline Clyde

  • A Little Fuzzy Wuzzy
  • DBF Aficionado
  • ******
  • Posts: 7271
  • Karma: 71
    • View Profile
Re: [C] Possible Reasons?
« Reply #13 on: January 16, 2010 »
Thanks for the suggestions, I'll experiment.
I don't have a super deluxe widescreen HD monitor; but I'll keep googling for full screen.

ta,
Clyde.
Still Putting The IT Into Gravy
If Only I Knew Then What I Know Now.

Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C] Possible Reasons?
« Reply #14 on: January 17, 2010 »
Code: [Select]
int ChangeScreenResolution(int wwidth, int hheight, int bitsPerPixel)
{
DEVMODE dmScreenSettings;

ZeroMemory(&dmScreenSettings, sizeof(DEVMODE));
dmScreenSettings.dmSize = sizeof dmScreenSettings;
dmScreenSettings.dmPelsWidth = wwidth;
dmScreenSettings.dmPelsHeight = hheight;
dmScreenSettings.dmBitsPerPel = bitsPerPixel;
dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT | DM_DISPLAYFREQUENCY;
dmScreenSettings.dmDisplayFrequency = 60;
if (ChangeDisplaySettings (&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL)
return 0;

return 1;   
}
« Last Edit: January 17, 2010 by Jim »
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: [C] Possible Reasons?
« Reply #15 on: January 17, 2010 »
as jim said clyde its a good idea to cater for 16:9 as well as 4:3 displays i recently started using my 47" phillips tv as a monitor and you would not belive some of the difficultes i have had in getting even some comercial games to display properly in 16:9 maybe even a simple check to see if its widescreen and deciding what res too use.

as for the ogl ptc i seem too have lost it in the transitions from my old comp to new one :( i would have no problems writting the code again but i cant for the life of me find jims ogl ptc source so if anyone can point me too it i would be hugely gratefull.
Challenge Trophies Won:

Offline Jim

  • Founder Member
  • DBF Aficionado
  • ********
  • Posts: 5301
  • Karma: 402
    • View Profile
Re: [C] Possible Reasons?
« Reply #16 on: January 17, 2010 »
Here's the source for ogl ptc.  We might need to work on the flip to use a texture and a quad because back in the day some PCs had real performance problems with glDrawPixel.
Challenge Trophies Won:

Offline ninogenio

  • Pentium
  • *****
  • Posts: 1668
  • Karma: 133
    • View Profile
Re: [C] Possible Reasons?
« Reply #17 on: January 17, 2010 »
yeah no problem jim, thanks i will get cracking.
Challenge Trophies Won: