public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); int sx = (graphics.Screen.Width / 2) - ((96 * 2) + (16 * 2)); int sy = (graphics.Screen.Height / 2) - (96 / 2); playButton = new SampleButton(sx + 0, sy - 24, 96, 48); stopButton = new SampleButton(sx + 112, sy - 24, 96, 48); pauseButton = new SampleButton(sx + 224, sy - 24, 96, 48); resumeButton = new SampleButton(sx + 336, sy - 24, 96, 48); volumeSlider = new SampleSlider(sx + 88, sy + 96, 256, 48); volTextPosX = (sx + 88) - 96; volTextPosY = (sy + 96) + 12; playButton.SetText("Play"); stopButton.SetText("Stop"); pauseButton.SetText("Pause"); resumeButton.SetText("Resume"); bgm = new Bgm("/Application/Sample/Audio/BgmPlayerSample/GAME_BGM_01.mp3"); bgmPlayer = bgm.CreatePlayer(); return(true); }
static bool Init() { graphics = new GraphicsContext(); stopwatch = new Stopwatch(); stopwatch.Start(); SampleDraw.Init(graphics); program = new ShaderProgram("/Application/Sample/Graphics/TriangleSample/shaders/VertexColor.cgx"); vertices = new VertexBuffer(3, VertexFormat.Float3, VertexFormat.Float4); program.SetUniformBinding(0, "WorldViewProj"); program.SetAttributeBinding(0, "a_Position"); program.SetAttributeBinding(1, "a_Color0"); float[] positions = { 0.0f, 1.0f, 0.0f, -0.5f, 0.0f, 0.0f, 0.5f, 0.0f, 0.0f, }; float[] colors = { 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, }; vertices.SetVertices(0, positions); vertices.SetVertices(1, colors); return(true); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); return(true); }
static void Init() { stopwatch = new Stopwatch(); graphics = new GraphicsContext(); SampleDraw.Init(graphics); DspWidth = graphics.Screen.Width; DspHeight = graphics.Screen.Height; sceneList = new List <IScene>(); sceneList.Add(new SceneSimpleShader()); sceneList.Add(new SceneVertexLightingShader()); sceneList.Add(new SceneGouraudShader()); sceneList.Add(new ScenePhongShader()); sceneList.Add(new SceneGlossMapShader()); sceneList.Add(new SceneTextureShader()); sceneList.Add(new SceneMultiTextureShader()); sceneList.Add(new SceneToonShader()); sceneList.Add(new SceneFogShader()); sceneList.Add(new SceneBumpMapShader()); sceneList.Add(new SceneProjectionShadow()); // graphics context graphics.SetViewport(0, 0, DspWidth, DspHeight); graphics.SetClearColor(0.0f, 0.5f, 1.0f, 1.0f); graphics.Enable(EnableMode.DepthTest); graphics.Enable(EnableMode.CullFace); graphics.SetCullFace(CullFaceMode.Back, CullFaceDirection.Ccw); // camera float aspect = DspWidth / (float)DspHeight; float fov = FMath.Radians(45.0f); camera = new Camera(fov, aspect, 10.0f, 100.0f); // light light = new LightModel(); light.Color = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); light.Ambient = new Vector4(0.3f, 0.3f, 0.3f, 1.0f); // model // model = new Model( BasicMeshFactory.CreateSphere( 4.0f, 20 ) ); model = new Model(BasicMeshFactory.CreateTorus(3.0f, 1.0f, 40, 12)); model.Position = new Vector3(0.0f, 4.0f, 0.0f); model.DiffuseColor = new Vector4(0.5f, 0.5f, 1.0f, 1.0f); model.AmbientColor = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); model.SpecularColor = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); // Bg modelBg = new BgModel(40.0f, 40.0f, 10, 10); id = 0; sceneList[id].Setup(graphics, model); stopwatch.Start(); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); textureList = new List <Texture2D>(); var image1 = new Image("/Application/Sample/Imaging/ImageSample/test.jpg"); image1.Decode(); textureList.Add(createTexture(image1)); image1.Dispose(); var image2_1 = new Image("/Application/Sample/Imaging/ImageSample/test.jpg"); var image2_2 = new Image("/Application/Sample/Imaging/ImageSample/test.png"); image2_1.Decode(); image2_2.Decode(); image2_1.DrawImage(image2_2, new ImagePosition((image2_1.Size.Width - image2_2.Size.Width) / 2, (image2_1.Size.Height - image2_2.Size.Height) / 2)); textureList.Add(createTexture(image2_1)); image2_2.Dispose(); image2_1.Dispose(); var image3_1 = new Image("/Application/Sample/Imaging/ImageSample/test.jpg"); var image3_2 = image3_1.Crop(new ImageRect(image3_1.Size.Width / 4, image3_1.Size.Height / 4, image3_1.Size.Width / 4, image3_1.Size.Height / 4)); var image3_3 = image3_2.Resize(new ImageSize(image3_1.Size.Width, image3_1.Size.Height)); textureList.Add(createTexture(image3_3)); image3_3.Dispose(); image3_2.Dispose(); image3_1.Dispose(); #if false int pixelX = 32; int pixelY = 128; #endif int pixelX = (graphics.Screen.Width / 2) - ((125 * 3) + (8 * 2)); int pixelY = (graphics.Screen.Height / 2) - (250 / 2); SampleDraw.AddSprite("Simple Image", 0xffffffff, pixelX, pixelY - 32); SampleDraw.AddSprite("DrawImage", 0xffffffff, pixelX + 266, pixelY - 32); SampleDraw.AddSprite("Crop", 0xffffffff, pixelX + 532, pixelY - 32); foreach (var texture in textureList) { SampleDraw.AddSprite(new SampleSprite(texture, pixelX, pixelY)); pixelX += texture.Width + 16; } return(true); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); SystemEvents.OnRestored += delegate(object sender, RestoredEventArgs e) { Console.WriteLine("Restored"); }; return(true); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); calcMatrix4(); calcVector3(); calcQuaternion(); return(true); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); spriteList = new List <SampleSprite>(); int positionX = 0; int positionY = 72; int line = 0; while (positionY < SampleDraw.Height) { int size = 8 + line * 3; var fonts = new Font[] { new Font(FontAlias.System, size, FontStyle.Regular), new Font(FontAlias.System, size, FontStyle.Bold), new Font(FontAlias.System, size, FontStyle.Italic), new Font(FontAlias.System, size, FontStyle.Bold | FontStyle.Italic), }; var textSets = new[] { new { text = System.String.Format("{0}pt", size), font = fonts[0] }, new { text = "/", font = fonts[0] }, new { text = "Regular", font = fonts[0] }, new { text = "/", font = fonts[0] }, new { text = "Bold", font = fonts[1] }, new { text = "/", font = fonts[0] }, new { text = "Italic", font = fonts[2] }, new { text = "/", font = fonts[0] }, new { text = "BoldItalic", font = fonts[3] }, new { text = "/", font = fonts[0] }, new { text = "こんにちは", font = fonts[0] }, }; positionX = 0; foreach (var textSet in textSets) { var texture = createTexture(textSet.text, textSet.font, 0xffffffff); spriteList.Add(new SampleSprite(texture, positionX, positionY)); positionX += textSet.font.GetTextWidth(textSet.text, 0, textSet.text.Length); } positionY += size; line++; foreach (var font in fonts) { font.Dispose(); } } return(true); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); connectButton = new SampleButton(48, 48, 256, 64); connectButton.SetText("Connect"); connectState = ConnectState.None; return(true); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); serverButton = new SampleButton(32, 32, 128, 48); clientButton = new SampleButton(32 + (SampleDraw.Width / 2), 32, 128, 48); serverButton.SetText(tcpServer.buttonString); clientButton.SetText(tcpClient.buttonString); return(true); }
static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); program = new ShaderProgram("/Application/Sample/Graphics/PrimitiveSample/shaders/VertexColor.cgx"); program.SetUniformBinding(0, "WorldViewProj"); program.SetAttributeBinding(0, "a_Position"); program.SetAttributeBinding(1, "a_Color0"); vertices = createVertices(modeInfo[modeIndex].drawMode); return(true); }
static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); ballTexture = new Texture2D("/Application/Sample/Graphics/SpriteSample/test.png", false); ballTexture.SetWrap(TextureWrapMode.ClampToEdge); ballScale = 1.0f; enableBallRotate = true; balls = new Queue <Ball>(); balls.Enqueue(new Ball()); return(true); }
/// Initialize public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); screenWidth = graphics.Screen.Width; screenHeight = graphics.Screen.Height; isFileExist = System.IO.File.Exists(SAVE_FILE); // Set status of the object from the contents SetupObjects(); return(true); }
/// 初期化 public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); screenWidth = graphics.Screen.Width; screenHeight = graphics.Screen.Height; // Gets the state of the object from PersistentMemory persistentMemoryData = PersistentMemory.Read(); // Set status of the object from the contents from PersistentMemory SetupObjects(); return(true); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); screenWidth = graphics.Screen.Width; screenHeight = graphics.Screen.Height; soundButtonList = new List <SoundButton>(); soundButtonList.Add(new SoundButton(0, (graphics.Screen.Width / 2) - (480 / 2), (graphics.Screen.Height / 2) - 128 + 0)); soundButtonList.Add(new SoundButton(1, (graphics.Screen.Width / 2) - (480 / 2), (graphics.Screen.Height / 2) - 128 + 64)); soundButtonList.Add(new SoundButton(2, (graphics.Screen.Width / 2) - (480 / 2), (graphics.Screen.Height / 2) - 128 + 128)); soundButtonList.Add(new SoundButton(3, (graphics.Screen.Width / 2) - (480 / 2), (graphics.Screen.Height / 2) - 128 + 192)); return(true); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); int rectW = 256; int rectH = 64; int rectX = (SampleDraw.Width - rectW) / 2; int rectY = (SampleDraw.Height - 24 - rectH * 3) / 2; browserButton = new SampleButton(rectX, rectY, rectW, rectH); browserButton.SetText("Browser"); return(true); }
public static void Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); // Set up LuaInterface lua = new Lua(); // Register C# function lua.RegisterFunction("FillCircle", null, typeof(LuaSample).GetMethod("FillCircle")); lua.RegisterFunction("MoveText", null, typeof(LuaSample).GetMethod("MoveText")); lua.RegisterFunction("btnText", null, typeof(LuaSample).GetMethod("btnText")); // Read Lua file lua.DoFile("/Application/touch.lua"); titleString = Convert.ToString(lua["TitleString"]); TitleStringX = Convert.ToInt32(lua["TitleStringX"]);
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); int rectW = SampleDraw.Width / 2; int rectH = 32; int rectX = (SampleDraw.Width - rectW) / 2; int rectY = (SampleDraw.Height - 24) / 2; button = new SampleButton(rectX, rectY, rectW, rectH); button.SetText("InputText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle); dialog = null; return(true); }
static void Init() { graphics = new GraphicsContext(); stopwatch = new Stopwatch(); stopwatch.Start(); SampleDraw.Init(graphics); // framebuffer frameBuffer = new FrameBuffer(); renderTexture = new Texture2D(offscreenWidth, offscreenHeight, false, PixelFormat.Rgba, PixelBufferOption.Renderable); depthBuffer = new DepthBuffer(offscreenWidth, offscreenHeight, PixelFormat.Depth16); frameBuffer.SetColorTarget(renderTexture, 0); frameBuffer.SetDepthTarget(depthBuffer); // vcolor shader vcolorShader = new ShaderProgram("/Application/Sample/Graphics/PixelBufferSample/shaders/VertexColor.cgx"); vcolorShader.SetUniformBinding(0, "WorldViewProj"); vcolorShader.SetAttributeBinding(0, "a_Position"); vcolorShader.SetAttributeBinding(1, "a_Color0"); // texture shader textureShader = new ShaderProgram("/Application/Sample/Graphics/PixelBufferSample/shaders/Texture.cgx"); textureShader.SetUniformBinding(0, "WorldViewProj"); textureShader.SetAttributeBinding(0, "a_Position"); textureShader.SetAttributeBinding(1, "a_TexCoord"); // vertex buffer triangleVertices = CreateTriangleVertices(); cubeVertices = CreateCubeVertices(); // renderstate graphics.Enable(EnableMode.DepthTest); graphics.Enable(EnableMode.CullFace); graphics.SetCullFace(CullFaceMode.Back, CullFaceDirection.Ccw); graphics.Enable(EnableMode.CullFace, false); }
public static bool Init() { graphics = new GraphicsContext(); SampleDraw.Init(graphics); inputTextButton = new SampleButton(32, 64, 480, 32); copyButton = new SampleButton(544, 64, 96, 32); pasteButton = new SampleButton(32, 240, 96, 32); copyTextButton = new SampleButton(160, 240, 480, 32); copyTextButton.ButtonColor = 0xff7f7f7f; inputTextButton.SetText("InputText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle); copyButton.SetText("Copy"); pasteButton.SetText("Paste"); copyTextButton.SetText("CopyText", SampleButton.TextAlign.Left, SampleButton.VerticalAlign.Middle); dialog = null; return(true); }