SdlWindow.cs :  » Game » RealmForge » Axiom » RenderSystems » OpenGL » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Game » RealmForge 
RealmForge » Axiom » RenderSystems » OpenGL » SdlWindow.cs
using System;
using Axiom.Core;
using Axiom.Graphics;
using Tao.OpenGl;
using Tao.Sdl;

namespace Axiom.RenderSystems.OpenGL{
  /// <summary>
  /// Summary description for SdlWindow.
  /// </summary>
  public class SdlWindow : RenderWindow {
    #region Fields

    private Sdl.SDL_Surface surface;

    #endregion Fields

    public SdlWindow() {
    }

    #region RenderWindow Members

    /// <summary>
    /// 
    /// </summary>
    /// <param name="name"></param>
    /// <param name="width"></param>
    /// <param name="height"></param>
    /// <param name="colorDepth"></param>
    /// <param name="fullScreen"></param>
    /// <param name="left"></param>
    /// <param name="top"></param>
    /// <param name="depthBuffer"></param>
    /// <param name="miscParams"></param>
    public override void Create(string name, int width, int height, int colorDepth, bool fullScreen, int left, int top, bool depthBuffer, params object[] miscParams) {
      this.name = name;
      this.width = width;
      this.height = height;
      this.colorDepth = colorDepth;

      int flags = Sdl.SDL_OPENGL | Sdl.SDL_HWPALETTE;

      // full screen?
      if(fullScreen) {
        flags |= Sdl.SDL_FULLSCREEN;
      }

      // we want double buffering
      Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_DOUBLEBUFFER, 1 );

      // request good stencil size if 32-bit color
      if (colorDepth == 32 && depthBuffer) {
        Sdl.SDL_GL_SetAttribute( Sdl.SDL_GL_STENCIL_SIZE, 8);
      }

      // set the video mode (and create the surface)
      // TODO: Grab return val once changed to the right type
      Sdl.SDL_SetVideoMode(width, height, colorDepth, flags);

      // lets get active!
      isActive = true;

      // set the window text for windowed mode
      if(!fullScreen) {
        Sdl.SDL_WM_SetCaption(name, null);
      }
    }

    public override void Destroy() {
      //Sdl.SDL_FreeSurface(
    }

    public override void Reposition(int left, int right) {

    }

    public override void Resize(int width, int height) {

    }

    public override void SaveToFile(string fileName) {

    }

    /// <summary>
    ///    Update the render window.
    /// </summary>
    /// <param name="waitForVSync"></param>
    public override void SwapBuffers(bool waitForVSync) {
      Sdl.SDL_GL_SwapBuffers();
    }


    #endregion RenderWindow Members
  }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.